Beispiel #1
0
        private void Login()
        {
            UserBO CurrentUser = null;
            try
            {

                CurrentUser = new UserDAL().UserLogin(textBoxUserName.Text.Trim(), textBoxPassword.Text.Trim());
                if (CurrentUser != null)
                {
                    Common.User = CurrentUser;
                    new Main().Show();
                    this.Hide();
                }
                else
                {
                    MessageBoxClass.ShowMessage(ErrorMessagesClass.InvaliedLogin, true);
                }
            }

            catch (Exception ex)
            {
                MessageBoxClass.ShowMessage(ex.Message, true);
            }
        }
        private void GetUserInfo(UserBO user)
        {
            user = new UserDAL().LoadUserByUserName(user);

            textBoxUserName.Text = user.UserName;
            textBoxEmail.Text = user.Email;
            //txtInitials.Text = user.Initials;
            textBoxFirstName.Text = user.FirstName;
            textBoxLastName.Text = user.LastName;
            textBoxAddress.Text = user.Address;
            userID = user.UserId;
            checkBoxStatus.Checked = user.IsEnable;
            //txtTelephone.Text = user.TelHome;
            //txtMobile.Text = user.TelMobile;
            //txtNIC.Text = user.Nic;
            //txtPassport.Text = user.PassportNo;
            //ddlBranchs.SelectedValue = user.UserBranchIdPrimary.ToString();
            //ddlBranchs.DataBind();
            //txtEmpNo.Text = user.EmpNo;

            //BindOldDesignations(user.Designation);
            //ChkAccountManager.Checked = user.IsAccountManager;
            //ChkClientManager.Checked = user.IsClientManager;
            //ChkActive.Checked = user.IsEnable;
            //lbluserName.Text = user.UserName;
            //lbluserName.Visible = true;
            //UserName.Visible = false;

            //lblPassword.Visible = true;
            //Password.Visible = false;
            //lblPassword.Text = "xxxxxxxxxx";

            //ConfirmPassword.Visible = false;
            //lblConfirmpassword.Visible = true;
            //lblConfirmpassword.Text = "xxxxxxxxxx";

            //lblUserId.Text = user.UserId.ToString();

            //ddlUserLevel.SelectedValue = user.UserLevelPrimary.UserLevelId.ToString();
            //txtPasswordExpirePeriod.Text = user.PasswordExpirePeriod.ToString();
            //ChkPasswordExpire.Checked = user.IsPasswordExpire;
            //ChkUserPasswordChange.Checked = user.IsUserChangePasswordFirstLogin;
            //ChkConcurrentConnection.Checked = user.IsAllowConcurrentConnection;

            //if (user.IsPasswordExpire)
            //{
            //    txtPasswordExpirePeriod.Enabled = true;
            //}
            //else
            //{
            //    txtPasswordExpirePeriod.Enabled = false;
            //}
        }
        private void ChangePass()
        {
            UserBO user = new UserBO();
            var userDal = new UserDAL();
            try
            {

                bool passwordExists = userDal.IsOldPasswordExist(SelectedUserId, textBoxOldPassword.Text.Trim());
               if (passwordExists)
               {
                   bool passwordChanged = userDal.ChangePasswordByUserId(SelectedUserId, textBoxConfirmPassword.Text.Trim(), Common.User.UserId);
                  if (passwordChanged)
                  {
                      MessageBoxClass.ShowMessage(CommonMethods.GetError("U_016"), false);

                  }
                  else
                  {
                      MessageBoxClass.ShowMessage(CommonMethods.GetError("U_015"), false);
                  }
               }
               else
               {
                   MessageBoxClass.ShowMessage(CommonMethods.GetError("U_014"), false);
               }

            }
            catch
            {
                MessageBoxClass.ShowMessage(CommonMethods.GetError("U_015"), true);
            }
        }