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"); } }
private void CallPage(string tableName, string tabPageName, UserControl frmView, delgloadData delgLoad) { if (UserManagement.AllowViewAll(tableName) == false && UserManagement.AllowViewOwn(tableName) == false) { FlatMsgBox.Show("Bạn không có quyền ở mục này"); return; } if (delgLoad != null) { delgLoad(); } TabPage tab = new TabPage(tabPageName); tab.Name = tableName; tab.Controls.Add(frmView); mainTabCtrl.TabPages.Add(tab); mainTabCtrl.SelectedTab = tab; }
private void frmTileView_Load(object sender, System.EventArgs e) { foreach (DevExpress.XtraEditors.TileGroup tileGroup in tileControl1.Groups) { foreach (DevExpress.XtraEditors.TileItem tilel in tileGroup.Items) { if (tilel.Tag == null) { tilel.Visible = false; } else if (UserManagement.AllowViewAll(tilel.Tag.ToString()) == false) { tilel.Visible = false; } else { tilel.Visible = true; } } } }