Skip to content

Instantly share code, notes, and snippets.

@grumpycatsaysno
Created July 7, 2017 13:59
Show Gist options
  • Save grumpycatsaysno/3cedbbf489803af0aebe0ef8ed51bdbb to your computer and use it in GitHub Desktop.
Save grumpycatsaysno/3cedbbf489803af0aebe0ef8ed51bdbb to your computer and use it in GitHub Desktop.
private string SetDates(string sYear, string sMonth, string sDay, out System.Collections.Generic.List<object> values, string propertyName, int index1, int index2)
{
System.DateTime time;
System.DateTime time2;
int num = int.Parse(sYear);
if (string.IsNullOrEmpty(sMonth))
{
time = new System.DateTime(num, 1, 1, 0, 0, 0);
time2 = new System.DateTime(num, 12, System.DateTime.DaysInMonth(num, 12), 0x17, 0x3b, 0x3b);
}
else if (string.IsNullOrEmpty(sDay))
{
int num2 = int.Parse(sMonth);
time = new System.DateTime(num, num2, 1, 0, 0, 0);
time2 = new System.DateTime(num, num2, System.DateTime.DaysInMonth(num, num2), 0x17, 0x3b, 0x3b);
}
else
{
int num3 = int.Parse(sMonth);
int num4 = int.Parse(sDay);
time = new System.DateTime(num, num3, num4, 0, 0, 0);
time2 = new System.DateTime(num, num3, num4, 0x17, 0x3b, 0x3b);
}
values = new System.Collections.Generic.List<object>();
values.Add(time);
values.Add(time2);
return new System.Text.StringBuilder().Append("(").Append(propertyName).Append(" >= @" + index1 + " && ").Append(propertyName).Append(" <= @" + index2 + ")").ToString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment