private bool Process() { Page.Validate(); if (!Page.IsValid) { return(false); } if (startDate == DateTime.MinValue) { throw new NotSupportedException("Start date is not specified"); } int blockTypeInstanceId = int.Parse(ProjectList.SelectedValue); if (blockTypeInstanceId < 0) { lblError2.Style.Add("display", ""); return(false); } McMetaViewPreference pref = CHelper.GetMetaViewPreference(CurrentView); int ownerId = int.Parse(UserList.SelectedValue, CultureInfo.InvariantCulture); double maxMinutes = (double)(24 * 60); TimeTrackingManager.AddEntryWithData(blockTypeInstanceId, startDate, ownerId, txtEntry.Text, Math.Min((new TimeSpan(Day1Time.Value.Ticks)).TotalMinutes, maxMinutes), Math.Min((new TimeSpan(Day2Time.Value.Ticks)).TotalMinutes, maxMinutes), Math.Min((new TimeSpan(Day3Time.Value.Ticks)).TotalMinutes, maxMinutes), Math.Min((new TimeSpan(Day4Time.Value.Ticks)).TotalMinutes, maxMinutes), Math.Min((new TimeSpan(Day5Time.Value.Ticks)).TotalMinutes, maxMinutes), Math.Min((new TimeSpan(Day6Time.Value.Ticks)).TotalMinutes, maxMinutes), Math.Min((new TimeSpan(Day7Time.Value.Ticks)).TotalMinutes, maxMinutes)); BindNullValues(); return(true); }
private bool Process() { Page.Validate(); if (!Page.IsValid) { return(false); } int blockTypeInstanceId = int.Parse(ProjectList.SelectedValue); if (blockTypeInstanceId < 0) { lblError2.Style.Add("display", ""); return(false); } McMetaViewPreference pref = CHelper.GetMetaViewPreference(CurrentView); DateTime startDate = CHelper.GetRealWeekStartByDate(pref.GetAttribute <DateTime>(TTFilterPopupEdit.FilterWeekAttr, TTFilterPopupEdit.FilterWeekAttr, DateTime.Today)); if (startDate == DateTime.MinValue) { startDate = CHelper.GetRealWeekStartByDate(DateTime.Today); } double maxMinutes = (double)(24 * 60); TimeTrackingManager.AddEntryWithData(blockTypeInstanceId, startDate, Mediachase.IBN.Business.Security.CurrentUser.UserID, txtEntry.Text, Math.Min((new TimeSpan(Day1Time.Value.Ticks)).TotalMinutes, maxMinutes), Math.Min((new TimeSpan(Day2Time.Value.Ticks)).TotalMinutes, maxMinutes), Math.Min((new TimeSpan(Day3Time.Value.Ticks)).TotalMinutes, maxMinutes), Math.Min((new TimeSpan(Day4Time.Value.Ticks)).TotalMinutes, maxMinutes), Math.Min((new TimeSpan(Day5Time.Value.Ticks)).TotalMinutes, maxMinutes), Math.Min((new TimeSpan(Day6Time.Value.Ticks)).TotalMinutes, maxMinutes), Math.Min((new TimeSpan(Day7Time.Value.Ticks)).TotalMinutes, maxMinutes)); BindNullValues(); return(true); }