private string GetDateGroupText(DateTime value, APSqlDateGroupMode mode) { if (_dateGroupText != null) { return(_dateGroupText(value, mode)); } switch (mode) { case APSqlDateGroupMode.Year: return(String.Format(CultureInfo.CurrentCulture, "{0:yyyy}", value)); case APSqlDateGroupMode.Month: return(String.Format(CultureInfo.CurrentCulture, "{0:yyyy-MM}", value)); case APSqlDateGroupMode.Day: return(String.Format(CultureInfo.CurrentCulture, "{0:yyyy-MM-dd}", value)); case APSqlDateGroupMode.Week: return(String.Format(CultureInfo.CurrentCulture, "week {1}, {0:yyyy}", value, GetWeekOfYear(value))); case APSqlDateGroupMode.Quarter: return(String.Format(CultureInfo.CurrentCulture, "quarter {1}, {0:yyyy}", value, (value.Month + 2) % 3)); default: return(""); } }
/// <summary> /// Create a new APSqlDateGroupExpr. /// </summary> /// <param name="rowSelectExpr">Row SQL 'SELECT' Expression.</param> /// <param name="dateGroupMode">Date group mode.</param> public APSqlDateGroupExpr(APSqlExpr rowSelectExpr, APSqlDateGroupMode dateGroupMode) { _rawExpr = rowSelectExpr; _dateGroupMode = dateGroupMode; }
/// <summary> /// Create a new APSqlDateGroupExpr. /// </summary> /// <param name="rowSelectExpr">Row SQL 'SELECT' Expression.</param> /// <param name="dateGroupMode">Date group mode.</param> public APSqlDateGroupExpr(APSqlExpr rowSelectExpr, APSqlDateGroupMode dateGroupMode) { _rawExpr = rowSelectExpr; _dateGroupMode = dateGroupMode; }
private string GetDateGroupText(DateTime value, APSqlDateGroupMode mode) { if (_dateGroupText != null) return _dateGroupText(value, mode); switch (mode) { case APSqlDateGroupMode.Year: return String.Format(CultureInfo.CurrentCulture, "{0:yyyy}", value); case APSqlDateGroupMode.Month: return String.Format(CultureInfo.CurrentCulture, "{0:yyyy-MM}", value); case APSqlDateGroupMode.Day: return String.Format(CultureInfo.CurrentCulture, "{0:yyyy-MM-dd}", value); case APSqlDateGroupMode.Week: return String.Format(CultureInfo.CurrentCulture, "week {1}, {0:yyyy}", value, GetWeekOfYear(value)); case APSqlDateGroupMode.Quarter: return String.Format(CultureInfo.CurrentCulture, "quarter {1}, {0:yyyy}", value, (value.Month+2) % 3); default: return ""; } }
/// <summary> /// Build a SQL date group Expression. /// </summary> /// <param name="columnDef">Column definition.</param> /// <param name="dateGroupMode">Date group mode.</param> /// <returns>SQL date group Expression.</returns> public static APSqlDateGroupExpr DateGroup(this DateTimeAPColumnDef columnDef, APSqlDateGroupMode dateGroupMode) { return(new APSqlDateGroupExpr(new APSqlColumnExpr(columnDef), dateGroupMode)); }
/// <summary> /// Create a new APRptGroupDef. /// </summary> /// <param name="columnId">ID of APRptColumn.</param> /// <param name="according">Order according.</param> /// <param name="dateGroupMode">Date group mode of APRptColumn.</param> public APRptGroupDef(string columnId, APSqlOrderAccording according, APSqlDateGroupMode dateGroupMode) { ColumnId = columnId; According = according; DateGroupMode = dateGroupMode; }
/// <summary> /// Create a new APRptGroupDef. /// </summary> /// <param name="columnId">ID of APRptColumn.</param> /// <param name="according">Order according.</param> /// <param name="dateGroupMode">Date group mode of APRptColumn.</param> public APRptGroupDef(string columnId, APSqlOrderAccording according, APSqlDateGroupMode dateGroupMode) { ColumnId = columnId; According = according; DateGroupMode = dateGroupMode; }