Example #1
0
        private void ApplyTimeslipSecurity(appDB.TimeSlipRow atr)
        {
            try
            {
                atriumBE.FileManager FMActivityTime = FM.AtMng.GetFile(atr.FileId);
                FMActivityTime.GetActivity().Load(atr.ActivityId);
                atriumDB.ActivityTimeRow actr = FMActivityTime.GetActivityTime().Load(atr.ActivityTimeId);

                bool canDelete = FMActivityTime.GetActivityTime().CanDelete(actr);

                if (canDelete)
                {
                    timeSlipGridEX.RootTable.Columns["Delete"].ButtonStyle = Janus.Windows.GridEX.ButtonStyle.Image;
                }
                else
                {
                    timeSlipGridEX.RootTable.Columns["Delete"].ButtonStyle = Janus.Windows.GridEX.ButtonStyle.NoButton;
                }

                if (FMActivityTime.GetActivityTime().CanEdit(actr))
                {
                    timeSlipGridEX.AllowEdit = Janus.Windows.GridEX.InheritableBoolean.True;
                }
                else
                {
                    timeSlipGridEX.AllowEdit = Janus.Windows.GridEX.InheritableBoolean.False;
                }
            }
            catch (Exception x)
            {
                timeSlipGridEX.RootTable.Columns["Delete"].ButtonStyle = Janus.Windows.GridEX.ButtonStyle.NoButton;
                timeSlipGridEX.AllowEdit = Janus.Windows.GridEX.InheritableBoolean.False;
            }
        }
Example #2
0
        private void DeleteTimeSlip(appDB.TimeSlipRow actr)
        {
            if (UIHelper.ConfirmDelete())
            {
                atriumBE.FileManager FMActivityTime = FM.AtMng.GetFile(actr.FileId);
                FMActivityTime.GetActivity().Load(actr.ActivityId);
                atriumDB.ActivityTimeRow atr = FMActivityTime.GetActivityTime().Load(actr.ActivityTimeId);
                Application.UseWaitCursor = true;
                atr.Delete();
                actr.Delete();
                try
                {
                    atLogic.BusinessProcess bp = FMActivityTime.GetBP();
                    bp.AddForUpdate(FMActivityTime.GetActivityTime());

                    bp.Update();

                    if (CurrentRowSRP().IsSRPSubmittedDateNull())
                    {
                        CalculateOpenPeriodTotals(CurrentRowSRP());
                    }
                }
                catch (Exception x1)
                {
                    FMActivityTime.DB.ActivityTime.RejectChanges();
                    throw x1;
                }
                finally
                {
                    Application.UseWaitCursor = false;
                }
            }
        }
Example #3
0
        private void timeSlipGridEX_CellUpdated(object sender, Janus.Windows.GridEX.ColumnActionEventArgs e)
        {
            try
            {
                int fileid = CurrentRowACTimeSlip().FileId;
                if (e.Column.Key == "Hours" || e.Column.Key == "Comment")
                {
                    timeSlipGridEX.UpdateData();
                    Application.UseWaitCursor = true;
                    //get FM, load activitytime record and update hours/comment
                    atriumBE.FileManager FMActivityTime = FM.AtMng.GetFile(fileid);
                    FMActivityTime.GetActivity().Load(CurrentRowACTimeSlip().ActivityId);
                    atriumDB.ActivityTimeRow atr = FMActivityTime.GetActivityTime().Load(CurrentRowACTimeSlip().ActivityTimeId);
                    if (CurrentRowACTimeSlip().IsHoursNull())
                    {
                        CurrentRowACTimeSlip().Hours = 0;
                    }
                    atr.Hours   = CurrentRowACTimeSlip().Hours;
                    atr.Comment = CurrentRowACTimeSlip().Comment;

                    timeSlipBindingSource.EndEdit();
                    try
                    {
                        atLogic.BusinessProcess bp = FM.GetBP();
                        bp.AddForUpdate(FMActivityTime.GetActivityTime());

                        bp.Update();

                        CalculateOpenPeriodTotals(CurrentRowSRP());
                    }
                    catch (Exception x1)
                    {
                        FMActivityTime.DB.ActivityTime.RejectChanges();
                        throw x1;
                    }
                    Application.UseWaitCursor = false;
                }
            }
            catch (Exception x)
            {
                Application.UseWaitCursor = false;
                UIHelper.HandleUIException(x);
            }
        }