public string GetScale(bool isHeader) { string ganttScale = "<div class='scaleContainer'>"; string scaleTpl = "<div style='width:{0}px'>{1}</div>"; string content = isHeader? LowerBoundDate.ToString("MMM-yy") : " "; ganttScale += string.Format(scaleTpl, GetMonthScaleWidth(LowerBoundDate), content); DateTime date = LowerBoundDate.AddMonths(1); while (date <= UpperBoundDate) { content = isHeader? date.ToString("MMM-yy") : " "; ganttScale += string.Format(scaleTpl, GetMonthScaleWidth(date), content); date = date.AddMonths(1); } ganttScale += "</div>"; return(ganttScale); }
public void Init(ColumnField field, object filter) { if (this.field != null) { return; } System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(Map.Database.DefaultCulture); this.field = field; System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(Map.Database.DefaultCulture); //Bounds dates LowerBoundDate string filters = filter == null? "" : filter.ToString(); string lowerDate = string.Empty; string upperDate = string.Empty; if (filters.Contains("between") && filters.Contains("to")) { string[] words = System.Text.RegularExpressions.Regex.Split(filters.Trim(), "to"); lowerDate = words[0].Substring(7).Trim(); upperDate = words[1].Trim(); } if (lowerDate == string.Empty || lowerDate == string.Empty) { LowerBoundDate = new DateTime(DateTime.Today.Year, 1, 1); UpperBoundDate = new DateTime(DateTime.Today.Year, 12, 31); } else { LowerBoundDate = Durados.DateFormatsMapper.GetDateFromClient(lowerDate, field.Format); UpperBoundDate = Durados.DateFormatsMapper.GetDateFromClient(upperDate, field.Format); LowerBoundDate = new DateTime(LowerBoundDate.Year, LowerBoundDate.Month, 1); DateTime firstDay = new DateTime(UpperBoundDate.Year, UpperBoundDate.Month, 1); UpperBoundDate = firstDay.AddMonths(1).AddDays(-1); } this.FilterText = "between " + LowerBoundDate.ToString(field.Format) + " to " + UpperBoundDate.ToString(field.Format); totalGanttDays = 1 + new TimeSpan(UpperBoundDate.Ticks).Days - new TimeSpan(LowerBoundDate.Ticks).Days; }