public uc_GroupUserDetail(uc_GroupUser _parent, SYS_tblGroupUserDTO item) { InitializeComponent(); Initialize(); parentForm = _parent; LoadDataToEdit(item); SetPermission(); }
public SYS_tblGroupUserDTO GetDataByID(string group_id, string username, string language_id) { DataRow dr = db.GetDataRow("SYS_spfrmGroupUser", new string[] { "Activity", "Username", "LanguageID", "GroupID" }, new object[] { "GetDataByID", username, language_id, group_id }); SYS_tblGroupUserDTO result = new SYS_tblGroupUserDTO(); if (dr != null) { result.GroupID = dr["GroupID"] + ""; result.GroupCode = dr["GroupCode"] + ""; result.GroupName = dr["GroupName"] + ""; result.Note = dr["Note"] + ""; result.IsDefault = Convert.ToBoolean(dr["IsDefault"]); result.Active = Convert.ToBoolean(dr["Active"]); result.IsRoot = Convert.ToBoolean(dr["IsRoot"]); return result; } return null; }
private bool SaveGroupUser(bool isEdit) { string strError = ""; try { SYS_tblGroupUserDTO item = new SYS_tblGroupUserDTO { GroupID = txtGroupID.Text, GroupCode = txtGroupCode.Text, GroupName = txtGroupName.Text, Note = mmoNote.Text, IsDefault = chkIsDefault.Checked, Active = chkActive.Checked, Activity = (isEdit) ? "Update" : "Insert", Username = User.UserInfo.Username, LanguageID = User.UserInfo.LanguageID }; strError = (isEdit) ? busGroupUser.UpdateGroupUser(item) : busGroupUser.InsertGroupUser(item); if (strError != "") { Commons.ShowMessage(strError, 0); txtGroupCode.Focus(); return false; } else parentForm.LoadAllData(); } catch (Exception ex) { Commons.ShowExceptionMessage(ex); txtGroupCode.Focus(); return false; } return true; }
private void LoadDataToEdit(SYS_tblGroupUserDTO item) { txtGroupID.EditValue = (item == null) ? null : item.GroupID; txtGroupCode.EditValue = (item == null) ? null : item.GroupCode; txtGroupName.EditValue = (item == null) ? null : item.GroupName; mmoNote.EditValue = (item == null) ? null : item.Note; chkIsDefault.EditValue = (item == null) ? false : item.IsDefault; chkActive.EditValue = (item == null) ? true : item.Active; if (item == null) { depError.ClearErrors(); this.ParentForm.Text = (User.UserInfo.LanguageID.Equals("VN")) ? "Thêm Mới Nhóm Người Dùng" : "Insert New Group User"; } txtGroupCode.Focus(); }
public string UpdateGroupUser(SYS_tblGroupUserDTO item) { string strError = ""; strError = db.sExecuteSQL("SYS_spfrmGroupUser", new string[] { "Activity", "Username", "LanguageID", "GroupID", "GroupCode", "GroupName", "Note", "Active", "IsDefault", "IsRoot" }, new object[] { item.Activity, item.Username, item.LanguageID, item.GroupID, item.GroupCode, item.GroupName, item.Note, item.Active, item.IsDefault, item.IsRoot }); if (strError.Equals("")) { SYS_tblActionLogDTO log = new SYS_tblActionLogDTO(); log.Activity = "Insert"; log.Username = item.Username; log.LanguageID = item.LanguageID; log.ActionVN = "Cập Nhật"; log.ActionEN = "Update"; log.FunctionID = "9"; log.DescriptionVN = string.Format("Tài khoản '{0}' vừa cập nhật thành công nhóm người dùng có mã '{1}'.", item.Username, item.GroupCode); log.DescriptionEN = string.Format("Account '{0}' has updated group user successfully with group code is '{1}'.", item.Username, item.GroupCode); strError = this.InsertActionLog(log); } return strError; }
public string UpdateGroupUser(SYS_tblGroupUserDTO item) { return daoGroupUser.UpdateGroupUser(item); }
public string InsertGroupUser(SYS_tblGroupUserDTO item) { return daoGroupUser.InsertGroupUser(item); }