Exemple #1
0
        private void frmEditLink_FormClosing(object sender, FormClosingEventArgs e)
        {
            frmPrimary frmPrimary = Application.OpenForms["frmPrimary"] as frmPrimary;

            if (frmPrimary != null)
            {
                delgRefresh delRefresh = new delgRefresh(frmPrimary.delgLoadData);
                delRefresh();
            }
        }
Exemple #2
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtUserName.Text) || string.IsNullOrWhiteSpace(txtPass.Text) || string.IsNullOrWhiteSpace(txtRetypePass.Text) || string.IsNullOrWhiteSpace(txtRecoverEmail.Text))
            {
                FlatMessageBox.FlatMsgBox.Show("Bạn phải nhập đủ thông tin", "", FlatMessageBox.FlatMsgBox.Buttons.OK, FlatMessageBox.FlatMsgBox.Icon.Info);
                return;
            }
            if (txtPass.Text.Trim() != txtRetypePass.Text.Trim())
            {
                FlatMessageBox.FlatMsgBox.Show("Mật khẩu không khớp", "", FlatMessageBox.FlatMsgBox.Buttons.OK, FlatMessageBox.FlatMsgBox.Icon.Info);
                return;
            }
            Users user = new Users();

            user.UserName   = txtUserName.Text;
            user.Password   = UtilityFunction.GetSHA256Hash(txtPass.Text);
            user.Email      = txtRecoverEmail.Text;
            user.ModifyDate = DateTime.Now;
            user.ModifyBy   = UserManagement.UserSession.UserName;
            user.FullName   = txtFullName.Text;
            user.CreateDate = DateTime.Now;
            user.CreateBy   = user.ModifyBy;
            if (cbbUserGroup.SelectedValue != null)
            {
                user.UserGroupId = int.Parse(cbbUserGroup.SelectedValue.ToString());
            }
            if (Create(user) == true)
            {
                FlatMessageBox.FlatMsgBox.Show("Success");
                frmUsersView frmViewUser = FormUtility.FindUserCtrl("frmUsersView") as frmUsersView;
                if (frmViewUser != null)
                {
                    if (UserManagement.AllowViewAll("USers") == true)
                    {
                        frmViewUser.isLoadAll = true;
                    }
                    else
                    {
                        frmViewUser.isLoadAll = false;
                    }
                    delgRefresh delgLoadUser = new delgRefresh(frmViewUser.LoadGrid);
                    delgLoadUser();
                    Close();
                }
            }
            else
            {
                FlatMessageBox.FlatMsgBox.Show("Không thành công");
            }
        }