static bool IsColumnEmpty(this DataRowView row, string columnName)
{
return row[columnName] == null || string.IsNullOrEmpty(row[columnName].ToString());
}static DateTime GetFirstDayOfMonth(this DateTime date)
{
return new DateTime(date.Year, date.Month, 1);
}
static DateTime GetFirstDayOfWeek(this DateTime date, DayOfWeek startOfWeek)
{
date = new DateTime(date.Year, date.Month, date.Day);
int diff = date.DayOfWeek - startOfWeek;
if (diff < 0)
{
diff += 7;
}
return date.AddDays(-1 * diff);
}
static string Append(this String str, params string[] parameters)
{
return string.Concat(str, parameters);
}
static string Prepend(this String str, params string[] parameters)
{
return string.Concat(parameters, str);
}
static int GetChildInt(this XmlNode node, string childNode)
{
int result = -1;
string str = node.GetChildString(childNode);
if (str != null)
{
int.TryParse(str, out result);
str = null;
}
return result;
}static string GetChildString(this XmlNode node, string childNode)
{
string str = null;
XmlNode cNode = node.SelectSingleNode(string.Format("./{0}", childNode));
if (cNode != null)
{
str = cNode.InnerText;
cNode = null;
}
return str;
}