private void buttonConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                labelReturnMsg.Text = null;

                if (textBoxNewPassword.Text == staticUserPassword)
                {
                    labelReturnMsg.Text = Constants.msgPasswordEqualsToPrevious;
                }
                else if (string.IsNullOrEmpty(textBoxNewPassword.Text))
                {
                    labelReturnMsg.Text = Constants.msgNewPasswordBlank;
                }
                else if (string.IsNullOrEmpty(textBoxConfirmPassword.Text))
                {
                    labelReturnMsg.Text = Constants.msgConfirmPasswordBlank;
                }
                else if (textBoxNewPassword.Text != textBoxConfirmPassword.Text)
                {
                    labelReturnMsg.Text = Constants.msgNewAndConfirmPasswordNotEquals;
                }
                else
                {
                    LoginValidationWSIntegration.LoginValidationWS loginWS = new LoginValidationWSIntegration.LoginValidationWS();
                    loginWS.passwordFormatValidation(textBoxNewPassword.Text);
                    loginWS.passwordFormatValidation(textBoxConfirmPassword.Text);

                    UserWSIntegration.UserWS userWS = new UserWSIntegration.UserWS();
                    int resultQuery = userWS.updateUser(staticUserName, textBoxNewPassword.Text, staticUserLevelDescription, staticUserID);
                    if (resultQuery < 1)
                    {
                        labelReturnMsg.Text = Constants.msgErrorBusinessToUser;
                    }
                    else
                    {
                        staticUserPassword = textBoxNewPassword.Text;
                        this.Close();
                    }
                }
            }
            catch (SoapException ex)
            {
                //Error log simulate
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());
                labelReturnMsg.ForeColor = System.Drawing.Color.Red;
                labelReturnMsg.Text      = ex.Message;
            }
            catch (Exception ex)
            {
                //Error log simulate
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());
                labelReturnMsg.ForeColor = System.Drawing.Color.Red;
                labelReturnMsg.Text      = Constants.msgErrorSystemToUser;
            }
        }
Example #2
0
        private void buttonSaveUserModification_Click(object sender, EventArgs e)
        {
            try
            {
                labelSystemMessage.Text = null;

                if (textBoxUserName.Text == null)
                {
                    labelSystemMessage.Text = Constants.msgUserNameBlank;
                }
                else
                {
                    UserWSIntegration.UserWS userWS = new UserWSIntegration.UserWS();
                    int returnOperation             = userWS.updateUser(textBoxUserName.Text, staticUserPassword, comboBoxUserLevel.Text, staticUserID);
                    if (returnOperation < 1)
                    {
                        labelSystemMessage.Text = Constants.msgNoRecordUpdated;
                    }
                    else
                    {
                        labelSystemMessage.Text = Constants.msgOperationCompleted;
                        staticUserName          = textBoxUserName.Text;
                    }
                }
            }
            catch (SoapException ex)
            {
                //Error log simulate
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());
                labelSystemMessage.ForeColor = System.Drawing.Color.Red;
                labelSystemMessage.Text      = Constants.msgErrorBusinessToUser + ex.Message;
            }
            catch (Exception ex)
            {
                //Error log simulate
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());
                labelSystemMessage.ForeColor = System.Drawing.Color.Red;
                labelSystemMessage.Text      = Constants.msgErrorSystemToUser;
            }
        }