private void CalculateOpenPeriodTotals(atriumDB.SRPDataTable dtSRP) { foreach (atriumDB.SRPRow srpRow in dtSRP.Select("Fileid=" + FM.CurrentFile.FileId.ToString())) { if (!LoadedSRPs.Contains(srpRow.SRPID) && srpRow.IsSRPSubmittedDateNull()) { appDB.TimeSlipDataTable TSdt2Merge = new appDB.TimeSlipDataTable(); DateTime endDate = srpRow.SRPDate.AddMonths(1).AddMinutes(-1); officeDB.OfficerRow or = FM.AtMng.OfficeMng.GetOfficer().LoadByMyFileId(FM.CurrentFile.FileId); if (or != null) { TSdt2Merge = (appDB.TimeSlipDataTable)FM.GetActivityTime().LoadByOfficerId(or.OfficerId, srpRow.SRPDate, endDate); if (TSdt2Merge.Rows.Count > 0) { decimal srpTotalTime = Convert.ToDecimal((TSdt2Merge.Compute("sum(Hours)", String.Empty))); srpRow.FeesClaimed = srpTotalTime; } else { srpRow.FeesClaimed = 0; } LoadedSRPs.Add(srpRow.SRPID); TSdt.Merge(TSdt2Merge); LoadSrpClient(or.OfficerId, srpRow.SRPID, srpRow.SRPDate, endDate); tsData.TimeSlipBranch.Merge(FM.GetActivityTime().LoadBranchByOfficerId(or.OfficerId, srpRow.SRPDate, endDate)); } else { MessageBox.Show(LawMate.Properties.Resources.ThePersonalFileAssociatedTimekeepingNotFound, LawMate.Properties.Resources.PersonalFileNotFound, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } } }
private void sRPBindingSource_CurrentChanged(object sender, EventArgs e) { try { Application.UseWaitCursor = true; if (CurrentRowSRP() == null) { //TODO: handle unloading of grid data return; } if (!LoadedSRPs.Contains(CurrentRowSRP().SRPID) && !CurrentRowSRP().IsSRPSubmittedDateNull()) //unclosed period - load by officer { appDB.TimeSlipDataTable TSdt2Merge = new appDB.TimeSlipDataTable(); TSdt2Merge = (appDB.TimeSlipDataTable)FM.GetActivityTime().LoadBySRPID(CurrentRowSRP().SRPID); LoadedSRPs.Add(CurrentRowSRP().SRPID); TSdt.Merge(TSdt2Merge); LoadSrpClient(CurrentRowSRP().SRPID); tsData.TimeSlipBranch.Merge(FM.GetActivityTime().LoadBranchBySRPID(CurrentRowSRP().SRPID)); } //Enabling/Disabling // AND FILTER ON TIMESLIP BINDING SOURCE sRPClientBindingSource.Filter = "SRPID=" + CurrentRowSRP().SRPID.ToString(); TimeslipReadOnly(!CurrentRowSRP().IsSRPSubmittedDateNull()); ToggleGridGroups(); timeSlipGridEX.RootTable.ApplyFilter(timeSlipGridEX.RootTable.FilterApplied); //if (CurrentRowSRP().IsSRPSubmittedDateNull()) //{ // Janus.Windows.GridEX.GridEXFormatStyle fsTSNotClosed; // Janus.Windows.GridEX.GridEXFormatCondition fcNoHours; // Janus.Windows.GridEX.GridEXFormatStyle fsNoHours; // fsTSNotClosed = new Janus.Windows.GridEX.GridEXFormatStyle(); // fsTSNotClosed.ForeColor = Color.Empty; // fsTSNotClosed.BackColor = Color.Empty; // fcNoHours = new Janus.Windows.GridEX.GridEXFormatCondition(timeSlipGridEX.RootTable.Columns["Hours"], Janus.Windows.GridEX.ConditionOperator.Equal, 0); // fsNoHours = new Janus.Windows.GridEX.GridEXFormatStyle(); // fsNoHours.ForeColor = Color.Red; // fsNoHours.BackColor = Color.PaleGoldenrod; // fcNoHours.FormatStyle = fsNoHours; // timeSlipGridEX.AllowEdit = Janus.Windows.GridEX.InheritableBoolean.True; // timeSlipGridEX.RootTable.Columns["Hours"].Selectable = true; // timeSlipGridEX.RootTable.Columns["Comment"].Selectable = true; // timeSlipGridEX.RootTable.RowFormatStyle = fsTSNotClosed; // timeSlipGridEX.RootTable.FormatConditions.Add(fcNoHours); // timeSlipGridEX.VisualStyle = Janus.Windows.GridEX.VisualStyle.Office2007; // DateTime endDate = CurrentRowSRP().SRPDate.AddMonths(1).AddMinutes(-1); // timeSlipBindingSource.Filter = "StartTime >= '" + CurrentRowSRP().SRPDate + "' and StartTime <='" + endDate + "'"; // DateTime DateOKToClose = CurrentRowSRP().SRPDate.AddMonths(1).AddDays(-1); // if (DateTime.Today >= DateOKToClose) // cmdCloseTimeSlip.Enabled = Janus.Windows.UI.InheritableBoolean.True; // else // cmdCloseTimeSlip.Enabled = Janus.Windows.UI.InheritableBoolean.False; //} //else //{ // Janus.Windows.GridEX.GridEXFormatStyle fsTSClosed; // fsTSClosed = new Janus.Windows.GridEX.GridEXFormatStyle(); // fsTSClosed.ForeColor = SystemColors.ControlDarkDark; // fsTSClosed.BackColor = SystemColors.ControlLight; // timeSlipGridEX.AllowEdit = Janus.Windows.GridEX.InheritableBoolean.False; // timeSlipGridEX.RootTable.Columns["Hours"].Selectable = false; // timeSlipGridEX.RootTable.Columns["Comment"].Selectable = false; // timeSlipGridEX.RootTable.RowFormatStyle = fsTSClosed; // timeSlipGridEX.RootTable.FormatConditions.Clear(); // timeSlipGridEX.VisualStyle = Janus.Windows.GridEX.VisualStyle.VS2005; // timeSlipBindingSource.Filter = "SRPID=" + CurrentRowSRP().SRPID.ToString(); // cmdCloseTimeSlip.Enabled = Janus.Windows.UI.InheritableBoolean.False; //} //if (btnExpandCollapseNextSteps.Text == LawMate.Properties.Resources.ExpandAll) // timeSlipGridEX.CollapseGroups(); //else // timeSlipGridEX.ExpandGroups(); } catch (Exception x) { UIHelper.HandleUIException(x); } finally { Application.UseWaitCursor = false; } }
/// <summary> /// SRP Client for closed period /// </summary> /// <param name="SRPId"></param> private void LoadSrpClient(int SRPId) // closed period { appDB.SRPClientDataTable SrpClient2Merge = new appDB.SRPClientDataTable(); SrpClient2Merge = (appDB.SRPClientDataTable)FM.GetActivityTime().LoadSRPClientBySRPID(CurrentRowSRP().SRPID); SRPClientDt.Merge(SrpClient2Merge); }
/// <summary> /// SRP Client for open period /// </summary> /// <param name="officerId"></param> /// <param name="SRPId"></param> /// <param name="srpStart"></param> /// <param name="srpEnd"></param> private void LoadSrpClient(int officerId, int SRPId, DateTime srpStart, DateTime srpEnd) //open period { appDB.SRPClientDataTable SrpClient2Merge = new appDB.SRPClientDataTable(); SrpClient2Merge = (appDB.SRPClientDataTable)FM.GetActivityTime().LoadSRPClientByOfficerId(SRPId, officerId, srpStart, srpEnd); SRPClientDt.Merge(SrpClient2Merge); }