Beispiel #1
0
        /// <summary>
        /// ibtnSettingsSave_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ibtnSettingsSave_Click(object sender, EventArgs e)
        {
            try
            {
                _currentSettingsDL = new SettingsDL();

                // Set whether Add / Edit
                if (hfUserSettingID.Value.ToString() != "0")
                {
                    _currentSettingsDL.UserSettingsID = Convert.ToInt32(hfUserSettingID.Value);
                    _currentSettingsDL.AddEditOption  = 1;
                }
                else
                {
                    _currentSettingsDL.AddEditOption  = 0;
                    _currentSettingsDL.UserSettingsID = 0;
                }

                _currentSettingsDL.UserID            = Convert.ToInt32(hfUserID.Value);
                _currentSettingsDL.DateFormatID      = Convert.ToInt32(ddlDateFormat.SelectedValue);
                _currentSettingsDL.BackgroundColorID = 0;
                // Add / Edit the User Settings
                TransactionResult result;
                _currentSettingsDL.ScreenMode = ScreenMode.Add;
                result = _currentSettingsDL.Commit();

                // Display the Status - Whether successfully saved or not
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append("<script>alert('" + result.Message.ToString() + ".');");
                sb.Append("</script>");
                ScriptManager.RegisterStartupScript(this.Page, typeof(string), "MyScript", sb.ToString(), false);

                // If successful get and display the saved User Settings
                if (result.Status == TransactionStatus.Success)
                {
                    GetUserSettings(Convert.ToInt32(hfUserID.Value), true);
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogErrorMessageToDB("Settings.aspx", "", "ibtnSettingsSave_Click", ex.Message, new ACEConnection());
            }
        }
Beispiel #2
0
        /// <summary>
        /// To retrieve the details of a particular user settings
        /// </summary>
        /// <param name="UserID">UserID</param>
        /// <param name="isProperties">Whether all properties</param>
        private void GetUserSettings(int userID, bool isProperties)
        {
            try
            {
                _currentSettingsDL          = new SettingsDL(userID, isProperties);
                hfUserID.Value              = _currentSettingsDL.UserID.ToString();
                hfUserSettingID.Value       = _currentSettingsDL.UserSettingsID.ToString();
                ddlDateFormat.SelectedValue = Convert.ToString(_currentSettingsDL.DateFormatID);

                if (_currentSettingsDL.DateFormatID != 0)
                {
                    DateFormatDL _dateformatDL = new DateFormatDL(Convert.ToInt32(_currentSettingsDL.DateFormatID), true);
                    Session["DateFormat"] = _dateformatDL.DateFormatValue.ToString();
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogErrorMessageToDB("Settings.aspx", "", "GetUserSettings(int UserID, bool isProperties)", ex.Message, new ACEConnection());
            }
        }