Пример #1
0
        /// <summary>
        /// Performs the data storage. Changes the user's password when is is valid.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveData_Click(object sender, EventArgs e)
        {
            var pwdData = GetPasswordData();

            if (CheckPassword(pwdData, service.GetClient(ClientIdValue)))
            {
                if (ModelState.IsValid)
                {
                    try
                    {
                        if (IsPerson)
                        {
                            service.ChangePersonData(GetNewPersonData());
                        }
                        else if (IsFirm)
                        {
                            service.ChangeFirmData(GetNewFirmData());
                        }
                        if (ChangePassword(pwdData.OldPassword, pwdData.NewPassword, ClientIdValue))
                        {
                            service.Save();
                            MessageLabel.Text = "Data saved successfully.";
                        }
                    }
                    catch (Exception ex)
                    {
                        ModelState.AddModelError("", ex.Message);
                    }
                }
            }
        }