Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            tbluseraccess employee = _userAccessService.GetAccess(Global.loggedUserId);

            //check if no blanks
            if (txtCurrentPassword.Text != string.Empty &&
                txtNewPassword.Text != string.Empty &&
                txtRepeatPassword.Text != string.Empty
                )
            {
                if (txtCurrentPassword.Text.Trim() != employee.Password)
                {
                    MessageBox.Show("Incorrect Password");
                }
                else
                {
                    if (txtNewPassword.Text.Trim() != txtRepeatPassword.Text.Trim())
                    {
                        MessageBox.Show("Passwords do not match");
                        txtNewPassword.Focus();
                    }
                    else
                    {
                        _userAccessService.UpdatePassword(Global.loggedUserId, txtNewPassword.Text.Trim());
                        MessageBox.Show("Password Updated");
                        this.Close();
                    }
                }
            } //else do not insert
            else
            {
            }
        }
Esempio n. 2
0
        private void FrmUserMaintenance_Load(object sender, EventArgs e)
        {
            btnEdit.Visible = false;

            lstAccess = _userAccessService.LoadAccess();

            cmbAccessLevel.DataSource    = lstAccess;
            cmbAccessLevel.ValueMember   = "AccessId";
            cmbAccessLevel.DisplayMember = "AccessName";

            if (Global.isUserEdit == true)
            {
                //edit user
                //if valid existing employee number for edit
                tbluser       empDetails    = new tbluser();
                tbluseraccess empUserAccess = new tbluseraccess();
                empDetails    = _userService.GetEmployee(Global.selectedUser);
                empUserAccess = _userAccessService.GetAccess(Global.selectedUser);


                cmbAccessLevel.SelectedValue = empUserAccess.AccessId;
                txtUsername.Text             = empDetails.UserId.ToString();
                txtEmpNo.Text      = empDetails.EmployeeNo;
                txtContact.Text    = empDetails.MobileNo;
                txtFirstName.Text  = empDetails.FirstName;
                txtMiddleName.Text = empDetails.MiddleName;
                txtLastName.Text   = empDetails.LastName;
                // cmbSuffix.SelectedValue = empDetails.Suffix;
                txtEmail.Text   = empDetails.Email;
                txtContact.Text = empDetails.MobileNo;

                //disable the fields
                txtEmpNo.Enabled      = false;
                txtFirstName.Enabled  = false;
                txtMiddleName.Enabled = false;
                txtLastName.Enabled   = false;
                txtEmail.Enabled      = false;
                txtContact.Enabled    = false;
                txtUsername.Enabled   = false;
                btnUpload.Enabled     = false;
                //cmbSuffix.Enabled = false;
                pbUserImage.Image = Image.FromFile(String.IsNullOrEmpty(empDetails.Path) ? defaultImage : empDetails.Path);
                btnSave.Hide();
                btnEdit.Show();
            }
            else if (Global.isUserEdit == false)
            {
                //new input
                pbUserImage.Image = Image.FromFile(@"D:\Projects\dotnet\SVM_Suite\SVM_Suite\SVM_Contracts\imgresource\images.png");


                lstAccess = _userAccessService.LoadAccess();
                cmbAccessLevel.Enabled = true;

                txtEmpNo.Focus();
            }

            //cmbEmployeeNo.DataSource = _userService.LoadUsers();
            //cmbEmployeeNo.Enabled = true;



            btnEdit.Show();
            btnSave.Hide();
        }