public override void Change() { if (!(MyRule.Get(MyLogin.RoleId, "bbiSubsidiary") != "OK")) { if (MyRule.AllowAccess) { HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY(); object cellValue = base.GetCellValue(this.m_RowClickEventArgs.RowIndex, "SubsidiaryCode"); if (cellValue != null) { base.SetWaitDialogCaption("Đang kiểm tra dữ liệu...."); if (!(hRMSUBSIDIARY.Get(cellValue.ToString()) != "OK")) { this.DoHide(); xfmSubsidiaryAdd _xfmSubsidiaryAdd = new xfmSubsidiaryAdd(Actions.Update, hRMSUBSIDIARY); _xfmSubsidiaryAdd.Updated += new xfmSubsidiaryAdd.UpdatedEventHander(this.frm_Updated); _xfmSubsidiaryAdd.Added += new xfmSubsidiaryAdd.AddedEventHander(this.frm_Added); _xfmSubsidiaryAdd.ShowDialog(); } else { this.DoHide(); XtraMessageBox.Show("Dữ liệu không tồn tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } else { MyRule.Notify(); } } }
// /// <summary> /// /// </summary> private void frm_Added(object sender, HRM_SUBSIDIARY Item) { TreeList treeList = this.treeList1; object[] subsidiaryCode = new object[] { Item.SubsidiaryCode, string.Concat(Item.SubsidiaryName, this.StringQuantity(0, 0)), "All", "Subsidiary", 0, 0, 1 }; treeList.AppendNode(subsidiaryCode, this.treeList1.Nodes.FirstNode); }
public void SetData(HRM_SUBSIDIARY item) { this.txtID.Text = item.SubsidiaryCode; // SYS_LOG.Insert("Danh Sách Công Ty Con", "Xem", this.txtID.Text); if (this.m_Status == Actions.Update) { this.txtID.Properties.ReadOnly = true; } this.txtNAME.Text = item.SubsidiaryName; this.txtAddress.Text = item.Address; this.txtPhone.Text = item.Phone; this.txtFax.Text = item.Fax; this.txtWebSite.Text = item.WebSite; this.txtEmail.Text = item.Email; this.txtTax.Text = item.Tax; this.txtBankAccount.Text = item.BankAccount; this.txtOpenedAt.Text = item.OpenedAt; this.txtBankAbbreviationName.Text = item.BankAbbreviationName; this.txtBankBranch.Text = item.BankBranch; // this.imgPhoto.Image = item.Photo; this.calMinimumSalary.EditValue = item.MinimumSalary; this.txtPersonName.Text = item.PersonName; this.txtQuantity.Text = item.Quantity.ToString(); this.txtFactQuantity.Text = item.FactQuantity.ToString(); this.txtDescription.Text = item.Description; }
public HRM_SUBSIDIARY InitClass() { HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY() { SubsidiaryCode = this.txtID.Text, SubsidiaryName = this.txtNAME.Text, Address = this.txtAddress.Text, Phone = this.txtPhone.Text, Fax = this.txtFax.Text, WebSite = this.txtWebSite.Text, Email = this.txtEmail.Text, Tax = this.txtTax.Text, BankAccount = this.txtBankAccount.Text, OpenedAt = this.txtOpenedAt.Text, BankAbbreviationName = this.txtBankAbbreviationName.Text, BankBranch = this.txtBankBranch.Text, MinimumSalary = decimal.Parse(this.calMinimumSalary.EditValue.ToString()), PersonName = this.txtPersonName.Text, Quantity = int.Parse(this.txtQuantity.EditValue.ToString()), FactQuantity = int.Parse(this.txtFactQuantity.EditValue.ToString()), Description = this.txtDescription.Text }; return(hRMSUBSIDIARY); }
private void RaiseSuccessEventHander(HRM_SUBSIDIARY item) { if (this.Success != null) { this.Success(this, item); } }
private void RaiseItemSelectedEventHander(HRM_SUBSIDIARY item) { if (this.ItemSelected != null) { this.ItemSelected(this, item); } }
public void RaiseUpdatedEventHander(HRM_SUBSIDIARY Item) { if (this.Updated != null) { this.Updated(this, Item); } }
protected override void Add() { base.Add(); HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY(); this.txtID.Text = hRMSUBSIDIARY.NewID(); this.txtNAME.Focus(); }
public xfmSubsidiaryAdd(Actions Action) { this.InitializeComponent(); this.Init(); this.ucAdd.Status = Action; HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY(); this.ucAdd.SetData(hRMSUBSIDIARY.NewID()); this.Text = "Thêm"; }
protected override string uc_Delete() { HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY() { SubsidiaryCode = this.txtID.Text }; string str = hRMSUBSIDIARY.Delete(); if (str == "OK") { this.RaiseSuccessEventHander(hRMSUBSIDIARY); } return(str); }
public xfmSubsidiaryAdd(Actions Action, HRM_SUBSIDIARY 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.SubsidiaryCode); } }
private void ucAdd_Success(object sender, HRM_SUBSIDIARY 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(); }
protected override string uc_Save() { string str; if (MyRule.Get(MyLogin.RoleId, "bbiSubsidiary") != "OK") { str = ""; } else if (!MyRule.AllowAdd) { MyRule.Notify(); str = ""; } else if (MyLogin.Level <= 0) { // SYS_LOG.Insert("Danh Sách Công Ty Con", "Thêm", this.txtID.Text); base.SetWaitDialogCaption("Đang lưu dữ liệu..."); Cursor.Current = Cursors.WaitCursor; HRM_SUBSIDIARY hRMSUBSIDIARY = this.InitClass(); string str1 = hRMSUBSIDIARY.Insert(); if (str1 == "OK") { this.RaiseSuccessEventHander(hRMSUBSIDIARY); } Cursor.Current = Cursors.Default; this.DoHide(); if (str1 != "OK") { XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } // str1 = hRMSUBSIDIARY.Update(this.txtID.Text, this.imgPhoto.Image); if (str1 != "OK") { this.DoHide(); } this.DoHide(); str = str1; } else { XtraMessageBox.Show("Cấp độ quản lý của bạn không được phép thêm chi nhánh!", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); 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 UpdateRow(HRM_SUBSIDIARY item, RowClickEventArgs e) { AdvBandedGridView advBandedGridView = this.gbList; int rowIndex = e.RowIndex; advBandedGridView.SetRowCellValue(rowIndex, "SubsidiaryCode", item.SubsidiaryCode); advBandedGridView.SetRowCellValue(rowIndex, "SubsidiaryName", item.SubsidiaryName); advBandedGridView.SetRowCellValue(rowIndex, "Address", item.Address); advBandedGridView.SetRowCellValue(rowIndex, "Phone", item.Phone); advBandedGridView.SetRowCellValue(rowIndex, "Fax", item.Fax); advBandedGridView.SetRowCellValue(rowIndex, "WebSite", item.WebSite); advBandedGridView.SetRowCellValue(rowIndex, "Email", item.Email); advBandedGridView.SetRowCellValue(rowIndex, "Tax", item.Tax); advBandedGridView.SetRowCellValue(rowIndex, "BankAccount", item.BankAccount); advBandedGridView.SetRowCellValue(rowIndex, "OpenedAt", item.OpenedAt); advBandedGridView.SetRowCellValue(rowIndex, "BankAbbreviationName", item.BankAbbreviationName); advBandedGridView.SetRowCellValue(rowIndex, "BankBranch", item.BankBranch); advBandedGridView.SetRowCellValue(rowIndex, "PersonName", item.PersonName); advBandedGridView.SetRowCellValue(rowIndex, "Quantity", item.Quantity); advBandedGridView.SetRowCellValue(rowIndex, "Description", item.Description); advBandedGridView.UpdateCurrentRow(); }
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(); } } }
public override void ReLoad() { base.SetWaitDialogCaption("Đang nạp dữ liệu..."); HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY(); this.gcList.DataSource = hRMSUBSIDIARY.GetList(); base.SetWaitDialogCaption("Đang nạp cấu hình..."); this.List_Init(this.gbList); base.SetWaitDialogCaption("Nạp quyền sử dụng..."); MyRule.Get(MyLogin.RoleId, "bbiSubsidiary"); if (!MyRule.AllowPrint) { this.ucToolBar.bbiPrint.Visibility = BarItemVisibility.Never; } MyRule.Get(MyLogin.RoleId, "bbiSubsidiary"); if (!MyRule.AllowExport) { this.ucToolBar.bbiExport.Visibility = BarItemVisibility.Never; } MyRule.Get(MyLogin.RoleId, "bbiSubsidiary"); if (!MyRule.AllowAdd) { this.ucToolBar.bbiAdd.Visibility = BarItemVisibility.Never; } MyRule.Get(MyLogin.RoleId, "bbiSubsidiary"); if (!MyRule.AllowDelete) { this.ucToolBar.bbiDelete.Visibility = BarItemVisibility.Never; } MyRule.Get(MyLogin.RoleId, "bbiSubsidiary"); if (!MyRule.AllowEdit) { this.ucToolBar.bbiEdit.Visibility = BarItemVisibility.Never; } base.SetWaitDialogCaption("Đã xong..."); this.gbList.OptionsView.ColumnAutoWidth = false; this.DoHide(); }
protected override string uc_Update() { string str; if (MyRule.Get(MyLogin.RoleId, "bbiSubsidiary") != "OK") { str = ""; } else if (MyRule.AllowEdit) { // SYS_LOG.Insert("Danh Sách Công Ty Con", "Cập Nhật", this.txtID.Text); base.SetWaitDialogCaption("Đang cập nhật dữ liệu..."); HRM_SUBSIDIARY hRMSUBSIDIARY = this.InitClass(); string str1 = hRMSUBSIDIARY.Update(); if (str1 == "OK") { this.RaiseSuccessEventHander(hRMSUBSIDIARY); } if (str1 != "OK") { XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } // str1 = hRMSUBSIDIARY.Update(this.txtID.Text, this.imgPhoto.Image); if (str1 != "OK") { this.DoHide(); } this.DoHide(); str = str1; } else { MyRule.Notify(); str = ""; } return(str); }
private void AddRow(HRM_SUBSIDIARY Item) { AdvBandedGridView advBandedGridView = this.gbList; int focusedRowHandle = advBandedGridView.FocusedRowHandle; advBandedGridView.AddNewRow(); focusedRowHandle = advBandedGridView.FocusedRowHandle; advBandedGridView.SetRowCellValue(focusedRowHandle, "SubsidiaryCode", Item.SubsidiaryCode); advBandedGridView.SetRowCellValue(focusedRowHandle, "SubsidiaryName", Item.SubsidiaryName); advBandedGridView.SetRowCellValue(focusedRowHandle, "Address", Item.Address); advBandedGridView.SetRowCellValue(focusedRowHandle, "Phone", Item.Phone); advBandedGridView.SetRowCellValue(focusedRowHandle, "Fax", Item.Fax); advBandedGridView.SetRowCellValue(focusedRowHandle, "WebSite", Item.WebSite); advBandedGridView.SetRowCellValue(focusedRowHandle, "Email", Item.Email); advBandedGridView.SetRowCellValue(focusedRowHandle, "Tax", Item.Tax); advBandedGridView.SetRowCellValue(focusedRowHandle, "BankAccount", Item.BankAccount); advBandedGridView.SetRowCellValue(focusedRowHandle, "OpenedAt", Item.OpenedAt); advBandedGridView.SetRowCellValue(focusedRowHandle, "BankAbbreviationName", Item.BankAbbreviationName); advBandedGridView.SetRowCellValue(focusedRowHandle, "BankBranch", Item.BankBranch); advBandedGridView.SetRowCellValue(focusedRowHandle, "PersonName", Item.PersonName); advBandedGridView.SetRowCellValue(focusedRowHandle, "Quantity", Item.Quantity); advBandedGridView.SetRowCellValue(focusedRowHandle, "Description", Item.Description); advBandedGridView.UpdateCurrentRow(); }
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(); }
private void frm_Updated(object sender, HRM_SUBSIDIARY Item) { this.UpdateRow(Item, this.m_RowClickEventArgs); }
private void frm_Added(object sender, HRM_SUBSIDIARY e) { this.AddRow(e); }
public override void Delete() { object cellValue; if (!(MyRule.Get(MyLogin.RoleId, "bbiSubsidiary") != "OK")) { if (MyRule.AllowDelete) { if (ClsOption.System2.IsQuestion) { if (XtraMessageBox.Show("Bạn có muốn xóa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } base.SetWaitDialogCaption("Đang xóa..."); string str = ""; bool flag = false; AdvBandedGridView advBandedGridView = this.gbList; int[] selectedRows = advBandedGridView.GetSelectedRows(); HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY(); for (int i = (int)selectedRows.Length; i > 0; i--) { flag = true; cellValue = base.GetCellValue(selectedRows[i - 1], "SubsidiaryCode"); if (cellValue != null) { // SYS_LOG.Insert("Danh Sách Công Ty Con", "Xoá", cellValue.ToString()); str = hRMSUBSIDIARY.Delete(cellValue.ToString()); if (str == "OK") { advBandedGridView.DeleteRow(selectedRows[i - 1]); } else if (str != "OK") { MessageBox.Show(string.Concat("Thông tin không được xóa\n", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } } this.DoHide(); if (!flag) { if (advBandedGridView.DataSource != null) { RowClickEventArgs rowClickEventArg = new RowClickEventArgs((advBandedGridView == null ? -1 : advBandedGridView.FocusedRowHandle), (advBandedGridView.FocusedColumn == null ? -1 : advBandedGridView.FocusedColumn.ColumnHandle), (advBandedGridView.FocusedColumn == null ? "" : advBandedGridView.FocusedColumn.FieldName)); this.m_RowClickEventArgs = rowClickEventArg; cellValue = null; cellValue = base.GetCellValue(rowClickEventArg.RowIndex, "SubsidiaryCode"); if (cellValue != null) { // SYS_LOG.Insert("Danh Sách Công Ty Con", "Xoá", cellValue.ToString()); base.SetWaitDialogCaption("Đang xóa..."); str = hRMSUBSIDIARY.Delete(cellValue.ToString()); if (str == "OK") { advBandedGridView.DeleteRow(rowClickEventArg.RowIndex); } else if (str != "OK") { MessageBox.Show(string.Concat("Thông tin không được xóa\n", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); } this.DoHide(); } } } } else { MyRule.Notify(); } } }
private void frm_Updated(object sender, HRM_SUBSIDIARY Item) { TreeListNode focusedNode = this.treeList1.FocusedNode; focusedNode.SetValue("Name", string.Concat(Item.SubsidiaryName, this.StringQuantity(int.Parse(focusedNode.GetValue("FactQuantity").ToString()), int.Parse(focusedNode.GetValue("Quantity").ToString())))); }