コード例 #1
0
        protected override void AfterChange(DataColumn dc, DataRow row)
        {
            officeDB.OfficerRow dr = (officeDB.OfficerRow)row;

            switch (dc.ColumnName)
            {
            case "OutOfOfficeStartDateLocal":
                if (!dr.IsOutOfOfficeStartDateLocalNull())
                {
                    if (dr.OutOfOfficeStartDateLocal > dr.OutOfOfficeEndDateLocal)
                    {
                        dr.OutOfOfficeEndDateLocal = dr.OutOfOfficeStartDateLocal;
                        dr.OutOfOfficeEndDateLocal = dr.OutOfOfficeEndDateLocal.AddMinutes(15);
                        dr.OutOfOfficeEndDate      = dr.OutOfOfficeEndDateLocal.ToUniversalTime();
                    }
                    dr.OutOfOfficeStartDate = dr.OutOfOfficeStartDateLocal.ToUniversalTime();
                    dr.EndEdit();
                }
                break;

            case "OutOfOfficeEndDateLocal":
                if (!dr.IsOutOfOfficeEndDateLocalNull())
                {
                    if (dr.OutOfOfficeStartDateLocal > dr.OutOfOfficeEndDateLocal)
                    {
                        dr.OutOfOfficeStartDateLocal = dr.OutOfOfficeEndDateLocal;
                        dr.OutOfOfficeEndDateLocal   = dr.OutOfOfficeEndDateLocal.AddMinutes(15);
                        dr.OutOfOfficeStartDate      = dr.OutOfOfficeStartDateLocal.ToUniversalTime();
                    }
                    dr.OutOfOfficeEndDate = dr.OutOfOfficeEndDateLocal.ToUniversalTime();
                    dr.EndEdit();
                }
                break;

            case "OutOfOffice":
                if (dr.IsOutOfOfficeNull() || !dr.OutOfOffice)
                {
                    dr.SetOutOfOfficeStartDateNull();
                    dr.SetOutOfOfficeStartDateLocalNull();
                    dr.SetOutEndEngNull();
                    dr.SetOutEndFreNull();
                    dr.SetOutOfOfficeEndDateNull();
                    dr.SetOutOfOfficeEndDateLocalNull();
                    dr.EndEdit();
                }
                else
                {
                    dr.OutOfOfficeStartDateLocal = DateTime.Today.AddHours(DateTime.Now.Hour);
                    dr.OutOfOfficeEndDateLocal   = dr.OutOfOfficeStartDateLocal.AddDays(1);
                    dr.OutOfOfficeEndDate        = dr.OutOfOfficeEndDateLocal.ToUniversalTime();
                    dr.OutOfOfficeStartDate      = dr.OutOfOfficeStartDateLocal.ToUniversalTime();
                    dr.EndEdit();
                }
                break;
            }
        }
コード例 #2
0
        private void SavePrefs()
        {
            try
            {
                Application.UseWaitCursor = true;

                SaveSearchOnOptions();

                prefBE.SetPref(OfficerPrefsBE.BFDaysAhead, tbBFDays.Value);

                //Language - stored in registry, not DB
                if (rbEng.Checked)
                {
                    UIHelper.SaveSetting("UserLanguage", "ENG");
                }
                else if (rbFre.Checked)
                {
                    UIHelper.SaveSetting("UserLanguage", "FRE");
                }

                //Grid selection mode
                if (rbCheck.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.GridSelectionMode, OfficerPrefsBE.vGridSelectionModeCheckbox);
                }
                else if (rbMulti.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.GridSelectionMode, OfficerPrefsBE.vGridSelectionModeMulti);
                }

                //load bflist on startup
                if (cbLoadBFList.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.LoadBFListOnStartup, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.LoadBFListOnStartup, false);
                }

                // peter Load EnableReminders
                if (chkReminders.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.EnableReminders, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.EnableReminders, false);
                }

                if (chkFastdataEntry.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.FastDataEntry, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.FastDataEntry, false);
                }

                if (chkBFNotify.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.BFShowNotify, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.BFShowNotify, false);
                }


                prefBE.SetPref(OfficerPrefsBE.LoadCalendarOnStartup, chkLoadCal.Checked);
                prefBE.SetPref(OfficerPrefsBE.ReadMailOnTimer, chkBFTimer.Checked);

                //load personal file on startup
                if (chkLoadPF.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.LoadPersonalFileOnStartup, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.LoadPersonalFileOnStartup, false);
                }

                //autohide officer toolkit on startup
                if (chkAutoHideToolkit.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.AutoHideOfficerToolkitOnStartup, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.AutoHideOfficerToolkitOnStartup, false);
                }

                //Remember Search On Selection
                if (cbRememberSearchOn.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.RememberSearchOnSelection, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.RememberSearchOnSelection, false);
                    prefBE.SetPref(OfficerPrefsBE.SearchOnDefault, cbDefaultSearchOn.SelectedItem.Value.ToString());
                }

                prefBE.SetPref(OfficerPrefsBE.hhBackground, cbHHBackground.SelectedColor.ToArgb());
                prefBE.SetPref(OfficerPrefsBE.hhForeground, cbHHForeground.SelectedColor.ToArgb());

                if (cbExecuteHitCount.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.RetrieveHitCount, true);
                    prefBE.SetPref(OfficerPrefsBE.HitCountTimerDelay, (int)tbHitTimer.Value);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.RetrieveHitCount, false);
                }

                //Officer Toolkit Hide BF List
                if (chkOTBFList.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHideBF, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHideBF, false);
                }

                //Officer Toolkit Hide Docs
                if (chkOTEmailsDocs.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHideDocs, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHideDocs, false);
                }

                //Officer Toolkit Hide Files
                if (chkOTFiles.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHideFiles, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHideFiles, false);
                }

                //Officer Toolkit Hide Address Book
                if (chkOTAddressBook.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHideAddBook, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHideAddBook, false);
                }

                //Officer Toolkit Hide Calendar
                if (chkOTCalendar.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHideCalendar, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHideCalendar, false);
                }

                //Officer Toolkit Hide Personal File
                if (chkOTPersonalFile.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHidePersonalFile, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHidePersonalFile, false);
                }

                //Officer Toolkit Hide My Office
                if (chkOTOfficeFile.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHideMyOffice, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.OfficerTKHideMyOffice, false);
                }

                //Auto Creation of Timeslip for Every Activity
                if (chkAutoTimeslip.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.TimeslipForEveryActivity, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.TimeslipForEveryActivity, false);
                }

                //Create REVISE DOC activity when checking in a document
                if (chkDocCheckInReviseDocAct.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.ReviseDocOnDocCheckIn, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.ReviseDocOnDocCheckIn, false);
                }

                //Display Draft Banner
                if (chkAlwaysShowDraftMessage.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.AlwaysDisplayDraftDocMessage, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.AlwaysDisplayDraftDocMessage, false);
                }

                if (chkMeta.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.PromptMetaData, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.PromptMetaData, false);
                }

                //Prompt on AppClose
                if (chkConfirmOnClose.Checked)
                {
                    prefBE.SetPref(OfficerPrefsBE.PromptOnClose, true);
                }
                else
                {
                    prefBE.SetPref(OfficerPrefsBE.PromptOnClose, false);
                }



                //Save Out Of Office info
                officerRow.OutOfOffice = chkOutOfOffice.Checked;
                if (chkOutOfOffice.Checked)
                {
                    officerRow.OutOfOfficeStartDateLocal = startDateCalendarCombo.Value.AddHours(-startDateCalendarCombo.Value.Hour);
                    officerRow.OutOfOfficeStartDateLocal = officerRow.OutOfOfficeStartDateLocal.AddMinutes(-startDateCalendarCombo.Value.Minute);
                    officerRow.OutOfOfficeStartDateLocal = officerRow.OutOfOfficeStartDateLocal.AddHours(startTimeCalendarCombo.Value.Hour);
                    officerRow.OutOfOfficeStartDateLocal = officerRow.OutOfOfficeStartDateLocal.AddMinutes(startTimeCalendarCombo.Value.Minute);

                    officerRow.OutOfOfficeEndDateLocal = endDateCalendarCombo.Value.AddHours(-endDateCalendarCombo.Value.Hour);
                    officerRow.OutOfOfficeEndDateLocal = officerRow.OutOfOfficeEndDateLocal.AddMinutes(-endDateCalendarCombo.Value.Minute);
                    officerRow.OutOfOfficeEndDateLocal = officerRow.OutOfOfficeEndDateLocal.AddHours(endTimeCalendarCombo.Value.Hour);
                    officerRow.OutOfOfficeEndDateLocal = officerRow.OutOfOfficeEndDateLocal.AddMinutes(endTimeCalendarCombo.Value.Minute);
                }
                else
                {
                    officerRow.SetOutOfOfficeStartDateNull();
                    officerRow.SetOutOfOfficeEndDateNull();
                }

                //myAtmng.OfficeMng.GetOfficer().SaveOutOfOffice();
                atLogic.BusinessProcess bp = myAtmng.OfficeMng.GetBP();
                bp.AddForUpdate(myAtmng.OfficeMng.GetOfficer());
                bp.AddForUpdate(myAtmng.OfficeMng.GetOfficerPrefs());
                bp.Update();
                //prefBE.SavePrefsCommit();
            }
            catch (Exception x)
            {
                UIHelper.HandleUIException(x);
                Application.UseWaitCursor = false;
            }
            finally { Application.UseWaitCursor = false; }

            //myAtmng.OfficeMng.GetOfficer().SavePrefs(prefs);
        }