public void RaiseUpdatedEventHander(HRM_GROUP Item) { if (this.Updated != null) { this.Updated(this, Item); } }
private void LoadDepartment() { if (this.m_Level == 0) { this.txtDepartment.Text = ""; } else if (this.m_Level == 1) { HRM_BRANCH hRMBRANCH = new HRM_BRANCH(); hRMBRANCH.Get(this.m_Code); this.txtDepartment.Text = string.Concat("Đơn vị: ", hRMBRANCH.BranchName); } else if (this.m_Level == 2) { HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); hRMDEPARTMENT.Get(this.m_Code); this.txtDepartment.Text = string.Concat("Đơn vị: ", hRMDEPARTMENT.DepartmentName); } else if (this.m_Level == 3) { HRM_GROUP hRMGROUP = new HRM_GROUP(); hRMGROUP.Get(this.m_Code); this.txtDepartment.Text = string.Concat("Đơn vị: ", hRMGROUP.GroupName); } }
private void RaiseSuccessEventHander(HRM_GROUP item) { if (this.Success != null) { this.Success(this, item); } }
public override void Change() { if (MyRule.IsAccess("bbiGroup")) { HRM_GROUP hRMGROUP = new HRM_GROUP(); object focusedRowCellValue = this.gbList.GetFocusedRowCellValue("GroupCode"); if (focusedRowCellValue != null) { base.SetWaitDialogCaption("Đang kiểm tra dữ liệu...."); if (!(hRMGROUP.Get(focusedRowCellValue.ToString()) != "OK")) { this.DoHide(); xfmGroupAdd _xfmGroupAdd = new xfmGroupAdd(Actions.Update, hRMGROUP); _xfmGroupAdd.Updated += new xfmGroupAdd.UpdatedEventHander(this.frm_Updated); _xfmGroupAdd.Added += new xfmGroupAdd.AddedEventHander(this.frm_Added); _xfmGroupAdd.ShowDialog(); } else { this.DoHide(); XtraMessageBox.Show("Dữ liệu không tồn tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } }
private void RaiseItemSelectedEventHander(HRM_GROUP item) { if (this.ItemSelected != null) { this.ItemSelected(this, item); } }
protected override void Add() { base.Add(); HRM_GROUP hRMGROUP = new HRM_GROUP(); this.txtID.Text = hRMGROUP.NewID(); this.txtNAME.Focus(); }
public override void Delete() { string str; object rowCellValue; if (MyRule.IsDelete("bbiGroup")) { bool flag = false; int[] selectedRows = this.gbList.GetSelectedRows(); if (XtraMessageBox.Show("Bạn có muốn xóa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.No) { base.SetWaitDialogCaption("Đang xóa..."); HRM_GROUP hRMGROUP = new HRM_GROUP(); for (int i = (int)selectedRows.Length; i > 0; i--) { flag = true; rowCellValue = this.gbList.GetRowCellValue(selectedRows[i - 1], "GroupCode"); if (rowCellValue != null) { // SYS_LOG.Insert("Danh Sách Tổ Nhóm", "Xoá", rowCellValue.ToString()); str = hRMGROUP.Delete(rowCellValue.ToString()); if (str == "OK") { this.gbList.DeleteRow(selectedRows[i - 1]); } else if (str != "OK") { MessageBox.Show(string.Concat("Thông tin không được xóa\r\n", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } } this.DoHide(); if (!flag) { if (hRMGROUP.GetList().Rows.Count != 0) { rowCellValue = this.gbList.GetFocusedRowCellValue("GroupCode"); if (rowCellValue != null) { // SYS_LOG.Insert("Danh Sách Tổ Nhóm", "Xoá", rowCellValue.ToString()); base.SetWaitDialogCaption("Đang xóa..."); str = hRMGROUP.Delete(rowCellValue.ToString()); if (str == "OK") { this.gbList.DeleteRow(this.gbList.FocusedRowHandle); } else if (str != "OK") { MessageBox.Show(string.Concat("Thông tin không được xóa\r\n", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); } this.DoHide(); } } } } } }
public xfmGroupAdd(Actions Action) { this.InitializeComponent(); this.Init(); this.ucAdd.Status = Action; HRM_GROUP hRMGROUP = new HRM_GROUP(); this.ucAdd.SetData(hRMGROUP.NewID()); this.Text = "Thêm"; }
private void frm_Added(object sender, HRM_GROUP Item) { if (!(Item.DepartmentCode != "")) { this.Reload(); } else { this.GroupAdd(Item, this.treeList1.Nodes.FirstNode); } }
public override void ReLoad() { base.SetWaitDialogCaption("Đang nạp dữ liệu..."); HRM_GROUP hRMGROUP = new HRM_GROUP(); this.gcList.DataSource = hRMGROUP.GetList(); base.SetWaitDialogCaption("Đang nạp cấu hình..."); this.gbList.ClearColumnsFilter(); base.SetWaitDialogCaption("Đã xong..."); this.DoHide(); }
private void frm_Updated(object sender, HRM_GROUP Item) { TreeListNode focusedNode = this.treeList1.FocusedNode; if (!(Item.DepartmentCode != focusedNode.GetValue("ParentID").ToString())) { focusedNode.SetValue("Name", string.Concat(Item.GroupName, this.StringQuantity(int.Parse(focusedNode.GetValue("FactQuantity").ToString()), int.Parse(focusedNode.GetValue("Quantity").ToString())))); } else { this.Reload(); } }
protected override string uc_Delete() { HRM_GROUP hRMGROUP = new HRM_GROUP() { GroupCode = this.txtID.Text }; string str = hRMGROUP.Delete(); if (str == "OK") { this.RaiseSuccessEventHander(hRMGROUP); } return(str); }
public xfmGroupAdd(Actions Action, HRM_GROUP Item) { this.InitializeComponent(); this.Init(); this.ucAdd.Status = Action; if (Action == Actions.Update) { this.ucAdd.SetData(Item); this.Text = "Cập nhật";; } else if (Action == Actions.Delete) { this.ucAdd.SetData(Item.GroupCode); } }
public void SetData(HRM_GROUP item) { this.txtID.Text = item.GroupCode; // SYS_LOG.Insert("Danh Sách Tổ Nhóm", "Xem", this.txtID.Text); if (this.m_Status == Actions.Update) { this.txtID.Properties.ReadOnly = true; } this.txtNAME.Text = item.GroupName; this.txtQuantity.Text = item.Quantity.ToString(); this.txtFactQuantity.Text = item.FactQuantity.ToString(); this.txtDescription.Text = item.Description; this.glkSubsidiary.EditValue = item.SubsidiaryCode; this.glkBranch.EditValue = item.BranchCode; this.glkDepartment.EditValue = item.DepartmentCode; }
private void ucAdd_Success(object sender, HRM_GROUP Item) { if (this.ucAdd.Status == Actions.Add) { this.RaiseAddedEventHander(Item); } else if (this.ucAdd.Status == Actions.Update) { this.RaiseUpdatedEventHander(Item); } if (this.ucAdd.IsClose == CloseOrNew.Close) { base.Close(); } this.ucAdd.Clear(); }
public xfmGroupAdd(Actions Action, string BranchCode, string DepartmentCode) { this.InitializeComponent(); this.Init(); this.ucAdd.Status = Action; if (Action == Actions.Add) { HRM_GROUP hRMGROUP = new HRM_GROUP(); this.ucAdd.SetData(hRMGROUP.NewID()); if ((BranchCode == "" ? false : DepartmentCode != "")) { this.ucAdd.SetData(BranchCode, DepartmentCode); } this.Text = "Thêm"; } }
private void Init() { MyRule.Check("bbiGroup"); this.ucToolBar.bbiPrint.Visibility = MyRule.Printed; this.ucToolBar.bbiExport.Visibility = MyRule.Exported; this.ucToolBar.bbiAdd.Visibility = MyRule.Added; this.ucToolBar.bbiDelete.Visibility = MyRule.Deleted; this.ucToolBar.bbiEdit.Visibility = MyRule.Edited; base.RibbonBar.Add.Visibility = MyRule.Added; base.RibbonBar.Change.Visibility = MyRule.Edited; base.RibbonBar.Delete.Visibility = MyRule.Deleted; base.RibbonBar.Print.Visibility = MyRule.Printed; base.RibbonBar.Export.Visibility = MyRule.Exported; base.RibbonBar.Import.Visibility = MyRule.Imported; HRM_GROUP hRMGROUP = new HRM_GROUP(); this.gcList.DataSource = hRMGROUP.GetList(); }
protected override string uc_Save() { string str; if (MyRule.Get(MyLogin.RoleId, "bbiGroup") != "OK") { str = ""; } else if (!MyRule.AllowAdd) { MyRule.Notify(); str = ""; } else if (MyLogin.Level > 3) { XtraMessageBox.Show("Cấp độ quản lý của bạn không được phép thêm tổ nhóm!", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); str = ""; } else if (this.glkDepartment.EditValue != null) { // SYS_LOG.Insert("Danh Sách Tổ Nhóm", "Thêm", this.txtID.Text); base.SetWaitDialogCaption("Đang lưu dữ liệu..."); Cursor.Current = Cursors.WaitCursor; HRM_GROUP hRMGROUP = new HRM_GROUP(this.txtID.Text, this.glkDepartment.EditValue.ToString(), this.txtNAME.Text, int.Parse(this.txtQuantity.Text), int.Parse(this.txtFactQuantity.Text), this.txtDescription.Text); string str1 = hRMGROUP.Insert(); if (str1 == "OK") { this.RaiseSuccessEventHander(hRMGROUP); } Cursor.Current = Cursors.Default; this.DoHide(); if (str1 != "OK") { XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } str = str1; } else { XtraMessageBox.Show("Vui lòng chọn 1 phòng ban!", "Cảnh Báo"); str = ""; } return(str); }
protected override void txtID_KeyDown(object sender, KeyEventArgs e) { TextEdit textEdit = (TextEdit)sender; if (e.KeyCode == Keys.Return | e.KeyCode == Keys.Tab) { HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY(); HRM_BRANCH hRMBRANCH = new HRM_BRANCH(); HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); HRM_GROUP hRMGROUP = new HRM_GROUP(); if (this.m_Status == Actions.Add) { if ((hRMBRANCH.Exist(textEdit.Text) || hRMSUBSIDIARY.Exist(textEdit.Text) || hRMDEPARTMENT.Exist(textEdit.Text) ? true : hRMGROUP.Exist(textEdit.Text))) { this.Err.SetError(textEdit, "Mã đã tồn tại."); textEdit.Focus(); } } } }
private void GroupAdd(HRM_GROUP Item, DevExpress.XtraTreeList.Nodes.TreeListNode TreeListNode) { if (TreeListNode.HasChildren) { foreach (DevExpress.XtraTreeList.Nodes.TreeListNode node in TreeListNode.Nodes) { if (!(node.GetValue("ID").ToString() == Item.DepartmentCode)) { this.GroupAdd(Item, node); } else { TreeList treeList = this.treeList1; object[] groupCode = new object[] { Item.GroupCode, string.Concat(Item.GroupName, this.StringQuantity(0, 0)), Item.DepartmentCode, "Group", 0, 0, 4 }; DevExpress.XtraTreeList.Nodes.TreeListNode treeListNode = treeList.AppendNode(groupCode, node); this.treeList1.SetFocusedNode(treeListNode); return; } } } }
public override void SetSearch(CHBK2014_N9.Common.Class.RowClickEventArgs e) { if (this._search) { HRM_GROUP hRMGROUP = new HRM_GROUP(); object rowCellValue = this.gbList.GetRowCellValue(this.MRowClickEventArgs.RowIndex, "GroupCode"); if (rowCellValue != null) { base.SetWaitDialogCaption("Đang kiểm tra dữ liệu...."); if (!(hRMGROUP.Get(rowCellValue.ToString()) != "OK")) { this.DoHide(); this.RaiseItemSelectedEventHander(hRMGROUP); } else { this.DoHide(); XtraMessageBox.Show("Dữ liệu không tồn tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } }
private void txtID_EditValueChanged(object sender, EventArgs e) { TextEdit textEdit = (TextEdit)sender; if (textEdit.ErrorText != string.Empty) { this.Err.SetError(textEdit, string.Empty); } HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY(); HRM_BRANCH hRMBRANCH = new HRM_BRANCH(); HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); HRM_GROUP hRMGROUP = new HRM_GROUP(); if (this.m_Status == Actions.Add) { if ((hRMBRANCH.Exist(textEdit.Text) || hRMSUBSIDIARY.Exist(textEdit.Text) || hRMDEPARTMENT.Exist(textEdit.Text) ? true : hRMGROUP.Exist(textEdit.Text))) { this.Err.SetError(textEdit, "Mã đã tồn tại."); textEdit.Focus(); } } }
protected override string uc_Update() { string str; if (MyRule.Get(MyLogin.RoleId, "bbiGroup") != "OK") { str = ""; } else if (!MyRule.AllowEdit) { MyRule.Notify(); str = ""; } else if (this.glkDepartment.EditValue != null) { // SYS_LOG.Insert("Danh Sách Tổ Nhóm", "Cập Nhật", this.txtID.Text); base.SetWaitDialogCaption("Đang cập nhật dữ liệu..."); HRM_GROUP hRMGROUP = new HRM_GROUP(this.txtID.Text, this.glkDepartment.EditValue.ToString(), this.txtNAME.Text, int.Parse(this.txtQuantity.Text), int.Parse(this.txtFactQuantity.Text), this.txtDescription.Text); string str1 = hRMGROUP.Update(); if (str1 == "OK") { this.RaiseSuccessEventHander(hRMGROUP); } if (str1 != "OK") { XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } this.DoHide(); str = str1; } else { XtraMessageBox.Show("Vui lòng chọn 1 phòng ban!", "Cảnh Báo"); str = ""; } return(str); }
private void LoadOrganization() { this.xucListContractEmployee1.LoadData(1); this.xucListContractEmployee1.EmployeeSelected += new xucListContractEmployee.EmployeeSelectedHandler((object s, string e) => { int num = 5; int num1 = num; this.m_Level = num; string str = e; string str1 = str; this.m_Code = str; this.LoadGrid(num1, str1); }); this.xucListContractEmployee1.DepartmentSelected += new xucListContractEmployee.DepartmentSelectedHandler((object s, Organization o) => { int num; string str; HRM_GROUP hRMGROUP = new HRM_GROUP(); HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); HRM_BRANCH hRMBRANCH = new HRM_BRANCH(); if (o.Level == 0) { int num1 = 0; num = num1; this.m_Level = num1; string str1 = ""; str = str1; this.m_Code = str1; this.LoadGrid(num, str); } else if (o.Level == 1) { int num2 = 1; num = num2; this.m_Level = num2; string subsidiaryCode = o.SubsidiaryCode; str = subsidiaryCode; this.m_Code = subsidiaryCode; this.LoadGrid(num, str); } else if (o.Level == 2) { int num3 = 2; num = num3; this.m_Level = num3; string branchCode = o.BranchCode; str = branchCode; this.m_Code = branchCode; this.LoadGrid(num, str); } else if (o.Level == 3) { int num4 = 3; num = num4; this.m_Level = num4; string departmentCode = o.DepartmentCode; str = departmentCode; this.m_Code = departmentCode; this.LoadGrid(num, str); } else if (o.Level == 4) { int num5 = 4; num = num5; this.m_Level = num5; string groupCode = o.GroupCode; str = groupCode; this.m_Code = groupCode; this.LoadGrid(num, str); } }); }
private void frm_Updated(object sender, HRM_GROUP Item) { this.ReLoad(); }
private void xfmGroupAdd_Added(object sender, HRM_GROUP Item) { this.ReLoad(); }
private void LoadTreeList(int Level, string Code) { object[] mCompanyName; //if (MyInfo.GetInfo() == "OK") //{ // this.m_CompanyName = MyInfo.Company; //} this.m_CompanyName = "Công ty ABC"; this.dt = new DataTable(); this.dt.Columns.Add("ID"); this.dt.Columns.Add("Name"); this.dt.Columns.Add("ParentID"); this.dt.Columns.Add("Type"); this.dt.Columns.Add("FactQuantity"); this.dt.Columns.Add("Quantity"); this.dt.Columns.Add("ImageIndex"); if (Level == 0) { DataRowCollection rows = this.dt.Rows; mCompanyName = new object[] { "All", this.m_CompanyName, "", "Company", 0, 0, 0 }; rows.Add(mCompanyName); this.m_CompanyFactQuantity = 0; this.m_CompanyQuantity = 0; this.AddSubsidiaryToDataTable(this.dt); this.AddBranchNullToDataTable(this.dt); this.AddDepartmentNullToDataTable(this.dt); this.dt.Rows[0]["Name"] = string.Concat(this.dt.Rows[0]["Name"].ToString(), this.StringQuantity(this.m_CompanyFactQuantity, this.m_CompanyQuantity)); this.dt.Rows[0]["FactQuantity"] = this.m_CompanyFactQuantity; this.dt.Rows[0]["Quantity"] = this.m_CompanyQuantity; } else if (Level == 1) { HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY(); hRMSUBSIDIARY.Get(Code); DataRowCollection dataRowCollection = this.dt.Rows; mCompanyName = new object[] { hRMSUBSIDIARY.SubsidiaryCode, string.Concat(hRMSUBSIDIARY.SubsidiaryName, this.StringQuantity(hRMSUBSIDIARY.FactQuantity, hRMSUBSIDIARY.Quantity)), "", "Subsidiary", hRMSUBSIDIARY.FactQuantity, hRMSUBSIDIARY.Quantity, 1 }; dataRowCollection.Add(mCompanyName); this.AddBranchToDataTable(hRMSUBSIDIARY.SubsidiaryCode, this.dt); this.AddDepartmentBySubsidiaryNotNullToDataTable(hRMSUBSIDIARY.SubsidiaryCode, this.dt); } else if (Level == 2) { HRM_BRANCH hRMBRANCH = new HRM_BRANCH(); hRMBRANCH.Get(Code); DataRowCollection rows1 = this.dt.Rows; mCompanyName = new object[] { hRMBRANCH.BranchCode, string.Concat(hRMBRANCH.BranchName, this.StringQuantity(hRMBRANCH.FactQuantity, hRMBRANCH.Quantity)), "", "Branch", hRMBRANCH.FactQuantity, hRMBRANCH.Quantity, 2 }; rows1.Add(mCompanyName); this.AddDepartmentByBranchToDataTable(hRMBRANCH.BranchCode, this.dt); } else if (Level == 3) { HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); hRMDEPARTMENT.Get(Code); DataRowCollection dataRowCollection1 = this.dt.Rows; mCompanyName = new object[] { hRMDEPARTMENT.DepartmentCode, string.Concat(hRMDEPARTMENT.DepartmentName, this.StringQuantity(hRMDEPARTMENT.FactQuantity, hRMDEPARTMENT.Quantity)), "", "Department", hRMDEPARTMENT.FactQuantity, hRMDEPARTMENT.Quantity, 3 }; dataRowCollection1.Add(mCompanyName); this.AddGroupToDataTable(hRMDEPARTMENT.DepartmentCode, this.dt); } else if (Level == 4) { HRM_GROUP hRMGROUP = new HRM_GROUP(); hRMGROUP.Get(Code); DataRowCollection rows2 = this.dt.Rows; mCompanyName = new object[] { hRMGROUP.GroupCode, string.Concat(hRMGROUP.GroupName, this.StringQuantity(hRMGROUP.FactQuantity, hRMGROUP.Quantity)), "", "Group", hRMGROUP.FactQuantity, hRMGROUP.Quantity, 4 }; rows2.Add(mCompanyName); } this.treeList1.DataSource = this.dt; this.treeList1.ExpandAll(); }