partial void UpdateSystemUser(SystemUser instance);
partial void DeleteSystemUser(SystemUser instance);
partial void InsertSystemUser(SystemUser instance);
public void loadDataForEditSystemUser(int systemUserId) { this.Text = "Chỉnh sửa người dùng này"; this.btnAdd.Text = "Cập nhật"; SystemUserService systemUserService = new SystemUserService(); systemUser = systemUserService.GetSystemUser(systemUserId); short userType = systemUser.Type; string o = cbUserType.Text; if (userType == BHConstant.USER_TYPE_ID1) { cbUserType.Text = BHConstant.USER_TYPE_NAME1; } else if (userType == BHConstant.USER_TYPE_ID2) { cbUserType.Text = BHConstant.USER_TYPE_NAME2; } else if (userType == BHConstant.USER_TYPE_ID3) { cbUserType.Text = BHConstant.USER_TYPE_NAME3; } if (systemUser != null) { txtName.Text = systemUser.FullName ; txtCode.Text = systemUser.Username; txtCode.Enabled = false; txtConfirmPass.Text = ""; txtPass.Text = ""; } }
private void btnAdd_Click(object sender, EventArgs e) { if (validator1.Validate()) { short userType = 0; string o = cbUserType.Text; if (o != null && o != "" && o != " ") { if (o.Contains(BHConstant.USER_TYPE_NAME1)) { userType = BHConstant.USER_TYPE_ID1; } else if (o.Contains(BHConstant.USER_TYPE_NAME2)) { userType = BHConstant.USER_TYPE_ID2; } else if (o.Contains(BHConstant.USER_TYPE_NAME3)) { userType = BHConstant.USER_TYPE_ID3; } } if (systemUser != null) { systemUser.FullName = txtName.Text; if (txtPass.Text != "" && txtConfirmPass.Text != "" && txtPass.Text.Equals(txtConfirmPass.Text)) { systemUser.Password = txtPass.Text; } systemUser.Type = userType; SystemUserService systemUserService = new SystemUserService(); if (systemUserService.UpdateSystemUser(systemUser)) { MessageBox.Show("Người dùng đã được cập nhật thành công"); ((SystemUserList)this.CallFromUserControll).loadSystemUserList(); this.Close(); } else { MessageBox.Show("Hiện tại hệ thống đang có lỗi. Vui lòng thử lại sau!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { systemUser = new SystemUser { FullName = txtName.Text, Password = txtPass.Text, Type = userType, Username = txtCode.Text }; SystemUserService systemUserService = new SystemUserService(); if (systemUserService.AddPSystemUser(systemUser)) { MessageBox.Show("Người dùng đã được tạo thành công"); ((SystemUserList)this.CallFromUserControll).loadSystemUserList(); this.Close(); } else { MessageBox.Show("Hiện tại hệ thống đang có lỗi. Vui lòng thử lại sau!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
/// <summary> /// Deprecated Method for adding a new object to the SystemUsers EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSystemUsers(SystemUser systemUser) { base.AddObject("SystemUsers", systemUser); }
/// <summary> /// Create a new SystemUser object. /// </summary> /// <param name="userId">Initial value of the UserId property.</param> /// <param name="username">Initial value of the username property.</param> /// <param name="password">Initial value of the password property.</param> /// <param name="type">Initial value of the Type property.</param> public static SystemUser CreateSystemUser(global::System.Int32 userId, global::System.String username, global::System.String password, global::System.Int16 type) { SystemUser systemUser = new SystemUser(); systemUser.UserId = userId; systemUser.username = username; systemUser.password = password; systemUser.Type = type; return systemUser; }