protected override string uc_Update() { string str; if (MyRule.Get(MyLogin.RoleId, "bbiDepartment") != "OK") { str = ""; } else if (MyRule.AllowEdit) { // SYS_LOG.Insert("Danh Sách Phòng Ban", "Cập Nhật", this.txtID.Text); base.SetWaitDialogCaption("Đang cập nhật dữ liệu..."); HRM_DEPARTMENT hRMDEPARTMENT = this.InitClass(); string str1 = hRMDEPARTMENT.Update(); if (str1 == "OK") { this.RaiseSuccessEventHander(hRMDEPARTMENT); } if (str1 != "OK") { XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } this.DoHide(); str = str1; } else { MyRule.Notify(); str = ""; } return(str); }
private void frm_Added(object sender, HRM_DEPARTMENT Item) { if (Item.SubsidiaryCode != "") { if (!(Item.BranchCode != "")) { this.DepartmentAdd(Item, this.treeList1.Nodes.FirstNode, Item.SubsidiaryCode); } else { this.DepartmentAdd(Item, this.treeList1.Nodes.FirstNode, Item.BranchCode); } } else if (!(Item.BranchCode != "")) { TreeList treeList = this.treeList1; object[] departmentCode = new object[] { Item.DepartmentCode, string.Concat(Item.DepartmentName, this.StringQuantity(0, 0)), "All", "Department", 0, 0, 3 }; TreeListNode treeListNode = treeList.AppendNode(departmentCode, this.treeList1.Nodes.FirstNode); this.treeList1.SetFocusedNode(treeListNode); } else { this.DepartmentAdd(Item, this.treeList1.Nodes.FirstNode, Item.BranchCode); } }
private void glkEmployeeCode_EditValueChanged(object sender, EventArgs e) { HRM_EMPLOYEE hRMEMPLOYEE = new HRM_EMPLOYEE(); hRMEMPLOYEE.Get(this.glkEmployeeCode.EditValue.ToString()); this.txtEmployeeName.Text = string.Concat(hRMEMPLOYEE.FirstName, " ", hRMEMPLOYEE.LastName); this.xdeBirthday.Day = hRMEMPLOYEE.BirthdayDay; this.xdeBirthday.Month = hRMEMPLOYEE.BirthdayMonth; this.xdeBirthday.Year = hRMEMPLOYEE.BirthdayYear; this.txtPosition.Text = hRMEMPLOYEE.Position; this.txtNationality1.Text = hRMEMPLOYEE.Nationality; this.txtIDCard.Text = hRMEMPLOYEE.IDCard; this.dtIDCardDate.DateTime = hRMEMPLOYEE.IDCardDate; this.txtIDCardPlace.Text = hRMEMPLOYEE.IDCardPlace; HRM_BRANCH hRMBRANCH = new HRM_BRANCH(); hRMBRANCH.Get(hRMEMPLOYEE.BranchCode); HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); hRMDEPARTMENT.Get(hRMEMPLOYEE.DepartmentCode); this.txtDepartment.Text = string.Concat(hRMBRANCH.BranchName, " - ", hRMDEPARTMENT.DepartmentName); this.calBasicSalary.EditValue = hRMEMPLOYEE.BasicSalary; foreach (DataRow row in (new HRM_EMPLOYEE_ALLOWANCE()).GetList(hRMEMPLOYEE.EmployeeCode).Rows) { this.txtAllowance.Text = string.Concat(this.txtAllowance.Text, row["AllowanceName"].ToString(), "; "); } if (this.glkEmployeeCode.ErrorText != string.Empty) { this.Err.SetError(this.glkEmployeeCode, string.Empty); } }
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); } }
public override void Change() { if (MyRule.IsAccess("bbiDepartment")) { HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); object focusedRowCellValue = this.gbList.GetFocusedRowCellValue("DepartmentCode"); if (focusedRowCellValue != null) { base.SetWaitDialogCaption("Đang kiểm tra dữ liệu...."); if (!(hRMDEPARTMENT.Get(focusedRowCellValue.ToString()) != "OK")) { this.DoHide(); xfmDepartmentAdd _xfmDepartmentAdd = new xfmDepartmentAdd(Actions.Update, hRMDEPARTMENT); _xfmDepartmentAdd.Updated += new xfmDepartmentAdd.UpdatedEventHander(this.frm_Updated); _xfmDepartmentAdd.Added += new xfmDepartmentAdd.AddedEventHander(this.frm_Added); _xfmDepartmentAdd.ShowDialog(); } else { this.DoHide(); XtraMessageBox.Show("Dữ liệu không tồn tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } }
public void RaiseUpdatedEventHander(HRM_DEPARTMENT Item) { if (this.Updated != null) { this.Updated(this, Item); } }
private void RaiseSuccessEventHander(HRM_DEPARTMENT item) { if (this.Success != null) { this.Success(this, item); } }
private void RaiseItemSelectedEventHander(HRM_DEPARTMENT item) { if (this.ItemSelected != null) { this.ItemSelected(this, item); } }
protected override void Add() { base.Add(); HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); this.txtID.Text = hRMDEPARTMENT.NewID(); this.txtNAME.Focus(); }
public override void Delete() { string str; object rowCellValue; if (MyRule.IsDelete("bbiDepartment")) { 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_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); for (int i = (int)selectedRows.Length; i > 0; i--) { flag = true; rowCellValue = this.gbList.GetRowCellValue(selectedRows[i - 1], "DepartmentCode"); if (rowCellValue != null) { // SYS_LOG.Insert("Danh Sách Phòng Ban", "Xoá", rowCellValue.ToString()); str = hRMDEPARTMENT.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 (hRMDEPARTMENT.GetList().Rows.Count != 0) { rowCellValue = this.gbList.GetFocusedRowCellValue("DepartmentCode"); if (rowCellValue != null) { // SYS_LOG.Insert("Danh Sách Phòng Ban", "Xoá", rowCellValue.ToString()); base.SetWaitDialogCaption("Đang xóa..."); str = hRMDEPARTMENT.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 xfmDepartmentAdd(Actions Action) { this.InitializeComponent(); this.Init(); this.ucAdd.Status = Action; HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); this.ucAdd.SetData(hRMDEPARTMENT.NewID()); this.Text = "Thêm"; }
public override void ReLoad() { base.SetWaitDialogCaption("Đang nạp dữ liệu..."); HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); this.gcList.DataSource = hRMDEPARTMENT.GetList(); base.SetWaitDialogCaption("Đang nạp cấu hình..."); this.gbList.ClearColumnsFilter(); base.SetWaitDialogCaption("Đã xong..."); this.DoHide(); }
private void glkBranch_EditValueChanged(object sender, EventArgs e) { HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); if ((this.glkBranch.EditValue == null ? false : !(this.glkBranch.Text == ""))) { hRMDEPARTMENT.AddGridLookupEdit(this.glkDepartment, this.glkBranch.EditValue.ToString()); } else { this.glkDepartment.Properties.DataSource = hRMDEPARTMENT.GetList(); } }
protected override string uc_Delete() { HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT() { DepartmentCode = this.txtID.Text }; string str = hRMDEPARTMENT.Delete(); if (str == "OK") { this.RaiseSuccessEventHander(hRMDEPARTMENT); } return(str); }
public xfmDepartmentAdd(Actions Action, HRM_DEPARTMENT 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.BranchCode); } }
public xfmDepartmentAdd(Actions Action, string BranchCode) { this.InitializeComponent(); this.Init(); this.ucAdd.Status = Action; if (Action == Actions.Add) { HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); this.ucAdd.SetData(hRMDEPARTMENT.NewID()); if (BranchCode != "") { this.ucAdd.SetBranchCode(BranchCode); } this.Text = "Thêm"; } }
private HRM_DEPARTMENT InitClass() { HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT() { DepartmentCode = this.txtID.Text, SubsidiaryCode = (this.glkSubsidiary.EditValue == null || this.glkSubsidiary.Text == "" ? "" : this.glkSubsidiary.EditValue.ToString()), BranchCode = (this.glkBranch.EditValue == null || this.glkBranch.Text == "" ? "" : this.glkBranch.EditValue.ToString()), DepartmentName = this.txtNAME.Text, Phone = this.txtPhone.Text, Quantity = int.Parse(this.txtQuantity.Text), FactQuantity = int.Parse(this.txtFactQuantity.Text), Description = this.txtDescription.Text }; return(hRMDEPARTMENT); }
private void ucAdd_Success(object sender, HRM_DEPARTMENT 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 void SetData(HRM_DEPARTMENT item) { this.txtID.Text = item.DepartmentCode; // SYS_LOG.Insert("Danh Sách Phòng Ban", "Xem", this.txtID.Text); if (this.m_Status == Actions.Update) { this.txtID.Properties.ReadOnly = true; } this.glkSubsidiary.EditValue = item.SubsidiaryCode; this.glkBranch.EditValue = item.BranchCode; this.txtNAME.Text = item.DepartmentName; this.txtPhone.Text = item.Phone; this.txtQuantity.Text = item.Quantity.ToString(); this.txtFactQuantity.Text = item.FactQuantity.ToString(); this.txtDescription.Text = item.Description; }
private void Init() { MyRule.Check("bbiDepartment"); 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_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); this.gcList.DataSource = hRMDEPARTMENT.GetList(); }
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 DepartmentAdd(HRM_DEPARTMENT Item, DevExpress.XtraTreeList.Nodes.TreeListNode TreeListNode, string Code) { if (TreeListNode.HasChildren) { foreach (DevExpress.XtraTreeList.Nodes.TreeListNode node in TreeListNode.Nodes) { if (!(node.GetValue("ID").ToString() == Code)) { this.DepartmentAdd(Item, node, Code); } else { TreeList treeList = this.treeList1; object[] departmentCode = new object[] { Item.DepartmentCode, string.Concat(Item.DepartmentName, this.StringQuantity(0, 0)), Code, "Department", 0, 0, 3 }; DevExpress.XtraTreeList.Nodes.TreeListNode treeListNode = treeList.AppendNode(departmentCode, node); this.treeList1.SetFocusedNode(treeListNode); return; } } } }
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(); } } }
private void frm_Updated(object sender, HRM_DEPARTMENT Item) { bool flag; TreeListNode focusedNode = this.treeList1.FocusedNode; if ((!(Item.BranchCode == "") || !(Item.SubsidiaryCode == "") || !(focusedNode.GetValue("ParentID").ToString() == "All")) && (!(focusedNode.GetValue("ParentID").ToString() == Item.BranchCode) || !(Item.SubsidiaryCode == "") || !(focusedNode.ParentNode.GetValue("ParentID").ToString() == "All")) && (!(focusedNode.GetValue("ParentID").ToString() == Item.SubsidiaryCode) || !(Item.BranchCode == "") || !(focusedNode.ParentNode.GetValue("ParentID").ToString() == "All"))) { flag = (!(Item.BranchCode != "") || !(Item.SubsidiaryCode != "") || !(focusedNode.GetValue("ParentID").ToString() == Item.BranchCode) ? true : !(focusedNode.ParentNode.GetValue("ParentID").ToString() == Item.SubsidiaryCode)); } else { flag = false; } if (flag) { this.Reload(); } else { focusedNode.SetValue("Name", string.Concat(Item.DepartmentName, this.StringQuantity(int.Parse(focusedNode.GetValue("FactQuantity").ToString()), int.Parse(focusedNode.GetValue("Quantity").ToString())))); } }
public override void SetSearch(CHBK2014_N9.Common.Class.RowClickEventArgs e) { if (this._search) { HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); object rowCellValue = this.gbList.GetRowCellValue(this.MRowClickEventArgs.RowIndex, "DepartmentCode"); if (rowCellValue != null) { base.SetWaitDialogCaption("Đang kiểm tra dữ liệu...."); if (!(hRMDEPARTMENT.Get(rowCellValue.ToString()) != "OK")) { this.DoHide(); this.RaiseItemSelectedEventHander(hRMDEPARTMENT); } else { this.DoHide(); XtraMessageBox.Show("Dữ liệu không tồn tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } }
protected override string uc_Save() { string str; if (MyRule.Get(MyLogin.RoleId, "bbiDepartment") != "OK") { str = ""; } else if (!MyRule.AllowAdd) { MyRule.Notify(); str = ""; } else if (MyLogin.Level <= 2) { // SYS_LOG.Insert("Danh Sách Phòng Ban", "Thêm", this.txtID.Text); base.SetWaitDialogCaption("Đang lưu dữ liệu..."); Cursor.Current = Cursors.WaitCursor; HRM_DEPARTMENT hRMDEPARTMENT = this.InitClass(); string str1 = hRMDEPARTMENT.Insert(); if (str1 == "OK") { this.RaiseSuccessEventHander(hRMDEPARTMENT); } 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("Cấp độ quản lý của bạn không được phép thêm phòng ban!", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); str = ""; } return(str); }
private void xfmDepartmentAdd_Added(object sender, HRM_DEPARTMENT Item) { this.ReLoad(); }
private void glk_ButtonClick(object sender, ButtonPressedEventArgs e) { string name; if (e.Button.Kind == ButtonPredefines.Plus) { name = (sender as GridLookUpEdit).Name; if (name != null) { if (name == "glkSubsidiary") { xfmSubsidiaryAdd _xfmSubsidiaryAdd = new xfmSubsidiaryAdd(Actions.Add); _xfmSubsidiaryAdd.Added += new xfmSubsidiaryAdd.AddedEventHander((object s, HRM_SUBSIDIARY i) => (new HRM_SUBSIDIARY()).AddGridLookupEdit(this.glkSubsidiary)); _xfmSubsidiaryAdd.ShowDialog(); goto Label2; } else if (name == "glkBranch") { xfmBranchAdd _xfmBranchAdd = new xfmBranchAdd(Actions.Add); _xfmBranchAdd.Added += new xfmBranchAdd.AddedEventHander((object s, HRM_BRANCH i) => { HRM_BRANCH hRMBRANCH = new HRM_BRANCH(); if ((this.glkSubsidiary.EditValue == null ? false : !(this.glkSubsidiary.Text == ""))) { this.glkBranch.Properties.DataSource = hRMBRANCH.GetListBySubsidiary(this.glkSubsidiary.EditValue.ToString()); } else { this.glkBranch.Properties.DataSource = hRMBRANCH.GetList(); } }); _xfmBranchAdd.ShowDialog(); goto Label2; } else { if (name != "glkDepartment") { goto Label2; } xfmDepartmentAdd _xfmDepartmentAdd = new xfmDepartmentAdd(Actions.Add); _xfmDepartmentAdd.Added += new xfmDepartmentAdd.AddedEventHander((object s, HRM_DEPARTMENT i) => { HRM_DEPARTMENT hRMDEPARTMENT = new HRM_DEPARTMENT(); if ((this.glkBranch.EditValue == null ? false : !(this.glkBranch.Text == ""))) { hRMDEPARTMENT.AddGridLookupEdit(this.glkDepartment, this.glkBranch.EditValue.ToString()); } else { this.glkDepartment.Properties.DataSource = hRMDEPARTMENT.GetList(); } }); _xfmDepartmentAdd.ShowDialog(); goto Label2; } } Label2 :; } else if (e.Button.Kind == ButtonPredefines.Delete) { name = (sender as GridLookUpEdit).Name; if (name != null) { if (name == "glkSubsidiary") { this.glkSubsidiary.EditValue = null; goto Label0; } else if (name == "glkBranch") { this.glkBranch.EditValue = null; goto Label0; } else { if (name != "glkDepartment") { goto Label0; } this.glkDepartment.EditValue = null; goto Label0; } } Label0 :; } }
private void frm_Updated(object sender, HRM_DEPARTMENT Item) { this.ReLoad(); }
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); } }); }