Пример #1
0
        private void menuItemHomePageSave_Click(object sender, EventArgs e)
        {
            if (WikiPageCur == null)
            {
                MsgBox.Show(this, "Invalid wiki page selected.");
                return;
            }
            List <UserOdPref> listUserOdPrefs = UserOdPrefs.GetByUserAndFkeyType(Security.CurUser.UserNum, UserOdFkeyType.WikiHomePage);

            if (listUserOdPrefs.Count > 0)
            {
                //User is updating their current home page to a new one.
                listUserOdPrefs[0].ValueString = WikiPageCur.PageTitle;
                UserOdPrefs.Update(listUserOdPrefs[0]);
            }
            else
            {
                //User is saving a custom home page for the first time.
                UserOdPref userOdPref = new UserOdPref();
                userOdPref.UserNum     = Security.CurUser.UserNum;
                userOdPref.ValueString = WikiPageCur.PageTitle;
                userOdPref.FkeyType    = UserOdFkeyType.WikiHomePage;
                UserOdPrefs.Insert(userOdPref);
            }
            MsgBox.Show(this, "Home page saved.");
        }
Пример #2
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (!(textStartDate.errorProvider1.GetError(textStartDate) == ""))
     {
         if (checkShowFinished.Checked)
         {
             MsgBox.Show(this, "Invalid finished task start date");
             return;
         }
         else
         {
             //We are not going to be using the textStartDate so not reason to warn the user, just reset it back to the default value.
             textStartDate.Text = DateTimeOD.Today.AddDays(-7).ToShortDateString();
         }
     }
     if (_taskCollapsedPref == null)
     {
         _taskCollapsedPref             = new UserOdPref();
         _taskCollapsedPref.Fkey        = 0;
         _taskCollapsedPref.FkeyType    = UserOdFkeyType.TaskCollapse;
         _taskCollapsedPref.UserNum     = Security.CurUser.UserNum;
         _taskCollapsedPref.ValueString = POut.Bool(checkCollapsed.Checked);
         UserOdPrefs.Insert(_taskCollapsedPref);
     }
     else
     {
         _taskCollapsedPref.ValueString = POut.Bool(checkCollapsed.Checked);
         UserOdPrefs.Update(_taskCollapsedPref);
     }
     IsShowFinishedTasks       = checkShowFinished.Checked;
     IsShowArchivedTaskLists   = checkShowArchivedTaskLists.Checked;
     DateTimeStartShowFinished = PIn.Date(textStartDate.Text);          //Note that this may have not been enabled but we'll pass it back anyway, won't be used.
     IsSortApptDateTime        = checkTaskSortApptDateTime.Checked;
     DialogResult = DialogResult.OK;
 }
Пример #3
0
 private void SavePreferences()
 {
     #region Logoff After Minutes
     if (textLogOffAfterMinutes.Text.IsNullOrEmpty() && !_logOffAfterMinutesInitialValue.IsNullOrEmpty())
     {
         UserOdPrefs.Delete(_logOffAfterMinutes.UserOdPrefNum);
     }
     else if (textLogOffAfterMinutes.Text != _logOffAfterMinutesInitialValue)            //Only do this if the value has changed
     {
         if (_logOffAfterMinutes == null)
         {
             _logOffAfterMinutes = new UserOdPref()
             {
                 Fkey = 0, FkeyType = UserOdFkeyType.LogOffTimerOverride, UserNum = Security.CurUser.UserNum
             };
         }
         _logOffAfterMinutes.ValueString = textLogOffAfterMinutes.Text;
         UserOdPrefs.Upsert(_logOffAfterMinutes);
         if (!PrefC.GetBool(PrefName.SecurityLogOffAllowUserOverride))
         {
             MsgBox.Show(this, "User logoff overrides will not take effect until the Global Security setting \"Allow user override for automatic logoff\" is checked");
         }
     }
     #endregion
     #region Suppress Logoff Message
     if (checkSuppressMessage.Checked && _suppressLogOffMessage == null)
     {
         UserOdPrefs.Insert(new UserOdPref()
         {
             UserNum  = Security.CurUser.UserNum,
             FkeyType = UserOdFkeyType.SuppressLogOffMessage
         });
     }
     else if (!checkSuppressMessage.Checked && _suppressLogOffMessage != null)
     {
         UserOdPrefs.Delete(_suppressLogOffMessage.UserOdPrefNum);
     }
     #endregion
     #region Theme Change
     if (_themePref == null)
     {
         _themePref = new UserOdPref()
         {
             UserNum = Security.CurUser.UserNum, FkeyType = UserOdFkeyType.UserTheme
         };
     }
     _themePref.Fkey = comboTheme.SelectedIndex;
     UserOdPrefs.Upsert(_themePref);
     if (PrefC.GetBool(PrefName.ThemeSetByUser))
     {
         UserOdPrefs.SetThemeForUserIfNeeded();
     }
     else
     {
         //No need to return, just showing a warning so they know why the theme will not change.
         MsgBox.Show("Theme will not take effect until the miscellaneous preference has been set for users can set their own theme.");
     }
     #endregion
 }
Пример #4
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (checkSuppressMessage.Checked && _suppressLogOffMessage == null)
     {
         //insert
         UserOdPrefs.Insert(new UserOdPref()
         {
             UserNum  = Security.CurUser.UserNum,
             FkeyType = UserOdFkeyType.SuppressLogOffMessage
         });
     }
     else if (!checkSuppressMessage.Checked && _suppressLogOffMessage != null)
     {
         //delete
         UserOdPrefs.Delete(_suppressLogOffMessage.UserOdPrefNum);
     }
     DialogResult = DialogResult.OK;
 }
Пример #5
0
 ///<summary>Helper method to update or insert the passed in UserOdPref utilizing the specified valueString and keyType.
 ///If the user pref passed in it null then a new user pref will be inserted.  Otherwise the user pref is updated.</summary>
 private void UpsertUserOdPref(UserOdPref userOdPref, UserOdFkeyType keyType, string valueString)
 {
     if (userOdPref == null)
     {
         UserOdPref userOdPrefTemp = new UserOdPref();
         userOdPrefTemp.Fkey        = 0;
         userOdPrefTemp.FkeyType    = keyType;
         userOdPrefTemp.UserNum     = _userNumCur;
         userOdPrefTemp.ValueString = valueString;
         UserOdPrefs.Insert(userOdPrefTemp);
     }
     else
     {
         userOdPref.FkeyType    = keyType;
         userOdPref.ValueString = valueString;
         UserOdPrefs.Update(userOdPref);
     }
 }
Пример #6
0
 private void butClose_Click(object sender, EventArgs e)
 {
     if (_userPrefShowReceived == null)
     {
         UserOdPrefs.Insert(new UserOdPref()
         {
             UserNum     = Security.CurUser.UserNum,
             FkeyType    = UserOdFkeyType.ReceivedSupplyOrders,
             ValueString = POut.Bool(checkShowReceived.Checked)
         });
     }
     else
     {
         if (_userPrefShowReceived.ValueString != POut.Bool(checkShowReceived.Checked))               //The user preference has changed.
         {
             _userPrefShowReceived.ValueString = POut.Bool(checkShowReceived.Checked);
             UserOdPrefs.Update(_userPrefShowReceived);
         }
     }
     Close();
 }
Пример #7
0
        private void FormAutoNoteCompose_FormClosing(object sender, FormClosingEventArgs e)
        {
            //store the current node expanded state for this user
            List <long> listExpandedDefNums = treeListMain.Nodes.OfType <TreeNode>().SelectMany(x => GetNodeAndChildren(x))
                                              .Where(x => x.Tag is Def && x.IsExpanded).Select(x => ((Def)x.Tag).DefNum).Where(x => x > 0).ToList();

            if (_userOdCurPref == null)
            {
                UserOdPrefs.Insert(new UserOdPref()
                {
                    UserNum     = Security.CurUser.UserNum,
                    FkeyType    = UserOdFkeyType.AutoNoteExpandedCats,
                    ValueString = string.Join(",", listExpandedDefNums)
                });
            }
            else
            {
                _userOdCurPref.ValueString = string.Join(",", listExpandedDefNums);
                UserOdPrefs.Update(_userOdCurPref);
            }
        }
        private void butOK_Click(object sender, EventArgs e)
        {
            if (_selectedUserNum == 0)
            {
                MsgBox.Show(this, "Please select a user.");
                return;
            }
            UserOdPref userDosePref = UserOdPrefs.GetByCompositeKey(_selectedUserNum, _programErx.ProgramNum, UserOdFkeyType.Program);

            userDosePref.ValueString = _providerErxCur.UserId.ToString();
            if (userDosePref.IsNew)
            {
                userDosePref.Fkey = _programErx.ProgramNum;
                UserOdPrefs.Insert(userDosePref);
            }
            else
            {
                UserOdPrefs.Update(userDosePref);
            }
            DialogResult = DialogResult.OK;
        }