Пример #1
0
        public ucTimeslip()
        {
            InitializeComponent();

            TSdt        = tsData.TimeSlip;
            SRPClientDt = tsData.SRPClient;
        }
Пример #2
0
 internal appDB.TimeSlipDataTable SetTimeSlipHours(appDB.TimeSlipDataTable dt)
 {
     fixingHours = true;
     foreach (appDB.TimeSlipRow dr in dt)
     {
         dr.Hours = dr.Minutes / 60;
         dr.AcceptChanges();
     }
     fixingHours = false;
     return(dt);
 }
Пример #3
0
        public appDB.TimeSlipDataTable LoadBySRPID(int srpId, int shortcutsForId)
        {
            this.sqlDa.SelectCommand = sqlSelect;
            this.sqlSelect.Parameters.Clear();
            this.sqlSelect.CommandText = "[ActivityTimeSelectBySRPID]";
            this.sqlSelect.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
            this.sqlSelect.Parameters.Add(new System.Data.SqlClient.SqlParameter("@SRPID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
            this.sqlSelect.Parameters["@SRPID"].Value = srpId;
            this.sqlSelect.Parameters.Add(new System.Data.SqlClient.SqlParameter("@shortcutsForId", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
            this.sqlSelect.Parameters["@shortcutsForId"].Value = shortcutsForId;


            appDB.TimeSlipDataTable dt = new appDB.TimeSlipDataTable();
            Fill(dt);
            return(dt);
        }
Пример #4
0
        public appDB.TimeSlipDataTable LoadByOfficerId(int officerId, DateTime startDate, DateTime endDate, int shortcutsForId)
        {
            this.sqlDa.SelectCommand = sqlSelect;
            this.sqlSelect.Parameters.Clear();
            this.sqlSelect.CommandText = "[ActivityTimeSelectByOfficerId]";
            this.sqlSelect.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
            this.sqlSelect.Parameters.Add(new System.Data.SqlClient.SqlParameter("@OfficerId", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
            this.sqlSelect.Parameters.Add(new System.Data.SqlClient.SqlParameter("@startdate", System.Data.SqlDbType.SmallDateTime, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
            this.sqlSelect.Parameters.Add(new System.Data.SqlClient.SqlParameter("@enddate", System.Data.SqlDbType.SmallDateTime, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
            this.sqlSelect.Parameters["@OfficerId"].Value = officerId;
            this.sqlSelect.Parameters["@startdate"].Value = startDate;
            this.sqlSelect.Parameters["@enddate"].Value   = endDate;
            this.sqlSelect.Parameters.Add(new System.Data.SqlClient.SqlParameter("@shortcutsForId", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
            this.sqlSelect.Parameters["@shortcutsForId"].Value = shortcutsForId;

            appDB.TimeSlipDataTable dt = new appDB.TimeSlipDataTable();
            Fill(dt);
            return(dt);
        }
Пример #5
0
        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;
                    }
                }
            }
        }
Пример #6
0
        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;
            }
        }