private void repFilter_EditValueChanged(object sender, EventArgs e) { HRM_CONTRACT hRMCONTRACT; if (this.m_Filter == "0") { hRMCONTRACT = new HRM_CONTRACT(); this.gcList.DataSource = hRMCONTRACT.GetList(this.m_Level, this.m_Code); } else if (this.m_Filter == "1") { hRMCONTRACT = new HRM_CONTRACT(); this.gcList.DataSource = hRMCONTRACT.GetCurrentList(this.m_Level, this.m_Code); } else if (!(this.m_Filter == "2")) { hRMCONTRACT = new HRM_CONTRACT(); this.gcList.DataSource = hRMCONTRACT.GetListExpiration(this.m_Level, this.m_Code); } else { hRMCONTRACT = new HRM_CONTRACT(); this.gcList.DataSource = hRMCONTRACT.GetListJustExpiration(this.m_Level, this.m_Code); } }
private void RaiseSuccessEventHander(HRM_CONTRACT item) { if (this.Success != null) { this.Success(this, item); } }
public void RaiseUpdatedEventHander(HRM_CONTRACT Item) { if (this.Updated != null) { this.Updated(this, Item); } }
protected override void Add() { base.Add(); HRM_CONTRACT hRMCONTRACT = new HRM_CONTRACT(); this.txtContractCode.Text = hRMCONTRACT.NewID(); }
public xfmContractAdd(Actions Action) { this.InitializeComponent(); this.Init(); this.ucAdd.Status = Action; HRM_CONTRACT hRMCONTRACT = new HRM_CONTRACT(); this.ucAdd.SetData(hRMCONTRACT.NewID()); this.Text = "Thêm"; }
private void LoadGrid(int Level, string Code) { HRM_CONTRACT hRMCONTRACT = new HRM_CONTRACT(); if (!(Level == 0 || Level == 1 || Level == 2 || Level == 3 ? false : Level != 4)) { this.gcList.DataSource = hRMCONTRACT.GetList(Level, Code); } else if (Level == 5) { this.gcList.DataSource = hRMCONTRACT.GetListByEmployee(Code); } }
protected override string uc_Delete() { HRM_CONTRACT hRMCONTRACT = new HRM_CONTRACT() { ContractCode = this.txtContractCode.Text }; string str = hRMCONTRACT.Delete(); if (str == "OK") { this.RaiseSuccessEventHander(hRMCONTRACT); } return(str); }
public xfmContractAdd(Actions Action, HRM_CONTRACT 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.ContractCode); } }
public xfmContractAdd(Actions Action, string EmployeeCode) { this.InitializeComponent(); this.Init(); this.ucAdd.Status = Action; if (Action == Actions.Add) { HRM_CONTRACT hRMCONTRACT = new HRM_CONTRACT(); this.ucAdd.SetDefaultAdd(EmployeeCode); this.ucAdd.SetData(hRMCONTRACT.NewID()); this.Text = "Thêm"; } else if (Action == Actions.Delete) { } }
private void ucAdd_Success(object sender, HRM_CONTRACT 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(); }
private void txtID_KeyDown(object sender, KeyEventArgs e) { TextEdit textEdit = (TextEdit)sender; if (e.KeyCode == Keys.Return | e.KeyCode == Keys.Tab) { HRM_CONTRACT hRMCONTRACT = new HRM_CONTRACT(); if (this.m_Status == Actions.Add) { if (hRMCONTRACT.Exist(textEdit.Text)) { this.Err.SetError(textEdit, "Mã đã tồn tại."); textEdit.Focus(); } } } }
private void UpdateRow(HRM_CONTRACT item) { GridView gridView = this.gbList; int focusedRowHandle = this.gbList.FocusedRowHandle; gridView.SetRowCellValue(focusedRowHandle, "ContractCode", item.ContractCode); gridView.SetRowCellValue(focusedRowHandle, "ContractType", item.ContractType); if (item.ContractType != 1) { gridView.SetRowCellValue(focusedRowHandle, "ContractTime", item.ContractTime); } gridView.SetRowCellValue(focusedRowHandle, "SignDate", item.SignDate); gridView.SetRowCellValue(focusedRowHandle, "FromDate", item.FromDate); if (item.ContractType != 1) { gridView.SetRowCellValue(focusedRowHandle, "ToDate", item.ToDate); } gridView.SetRowCellValue(focusedRowHandle, "Signer", item.Signer); gridView.SetRowCellValue(focusedRowHandle, "SignerPosition", item.SignerPosition); gridView.SetRowCellValue(focusedRowHandle, "Subject", item.Subject); gridView.SetRowCellValue(focusedRowHandle, "Description", item.Description); gridView.UpdateCurrentRow(); }
private void Change() { HRM_CONTRACT hRMCONTRACT = new HRM_CONTRACT(); object focusedRowCellValue = this.gbList.GetFocusedRowCellValue("ContractCode"); if (focusedRowCellValue != null) { base.SetWaitDialogCaption("Đang kiểm tra dữ liệu...."); if (!(hRMCONTRACT.Get(focusedRowCellValue.ToString()) != "OK")) { this.DoHide(); xfmContractAdd _xfmContractAdd = new xfmContractAdd(Actions.Update, hRMCONTRACT); _xfmContractAdd.Updated += new xfmContractAdd.UpdatedEventHander(this.frm_Updated); _xfmContractAdd.Added += new xfmContractAdd.AddedEventHander(this.frm_Added); _xfmContractAdd.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 SetData(HRM_CONTRACT item) { TextEdit textEdit = this.txtContractCode; string contractCode = item.ContractCode; string str = contractCode; this.m_ContractCode = contractCode; textEdit.Text = str; // SYS_LOG.Insert("Hợp Đồng Lao Động", "Xem", this.txtContractCode.Text); if (this.m_Status == Actions.Update) { this.glkEmployeeCode.Properties.ReadOnly = true; } this.glkEmployeeCode.EditValue = item.EmployeeCode; this.cboContractType.SelectedIndex = item.ContractType; this.cboContractTime.Text = item.ContractTime; this.dtSignDate.DateTime = item.SignDate; this.dtFromDate.DateTime = item.FromDate; this.dtToDate.DateTime = item.ToDate; this.calBasicSalary.EditValue = item.BasicSalary; this.cboPayForm.Text = item.PayForm; this.txtPayDate.Text = item.PayDate.ToString(); this.txtAllowance.Text = item.Allowance; this.txtInsurance.Text = item.Insurance; this.txtWorkTime.Text = item.WorkTime; this.calCompensation.EditValue = item.Compensation; this.txtSigner.Text = item.Signer; this.txtSignerPosition.Text = item.SignerPosition; this.txtSignerNationality.Text = item.SignerNationality; this.txtCompany.Text = item.Company; this.txtAddress.Text = item.Address; this.txtTel.Text = item.Tel; this.txtCreatePlace.Text = item.CreatePlace; this.txtSubject.Text = item.Subject; this.txtDescription.Text = item.Description; this.chxIsCurrent.Checked = true; }
private void frm_Updated(object sender, HRM_CONTRACT Item) { this.UpdateRow(Item); }
protected override string uc_Update() { string str; if (MyRule.Get(MyLogin.RoleId, "bbiContract") != "OK") { str = ""; } else if (MyRule.AllowEdit) { // SYS_LOG.Insert("Hợp Đồng Lao Động", "Cập Nhật", this.txtContractCode.Text); base.SetWaitDialogCaption("Đang cập nhật dữ liệu..."); HRM_CONTRACT hRMCONTRACT = new HRM_CONTRACT(); hRMCONTRACT = this.InitClass(); string str1 = hRMCONTRACT.Update(); if (str1 == "OK") { this.RaiseSuccessEventHander(hRMCONTRACT); } if (!(str1 != "OK")) { HRM_EMPLOYEE hRMEMPLOYEE = new HRM_EMPLOYEE(); hRMEMPLOYEE.Get(this.glkEmployeeCode.EditValue.ToString()); if (hRMEMPLOYEE.ContractCode == this.txtContractCode.Text) { hRMEMPLOYEE.ContractCode = this.txtContractCode.Text; hRMEMPLOYEE.ContractType = this.cboContractType.Text; hRMEMPLOYEE.ContractSignDate = this.dtFromDate.DateTime; hRMEMPLOYEE.ContractFromDate = this.dtFromDate.DateTime; if (this.cboContractType.SelectedIndex != 1) { hRMEMPLOYEE.ContractToDate = this.dtToDate.DateTime; } else { SqlDateTime maxValue = SqlDateTime.MaxValue; hRMEMPLOYEE.ContractToDate = Convert.ToDateTime(maxValue.ToString()); } if (hRMEMPLOYEE.PayForm == 1) { hRMEMPLOYEE.PayMoney = decimal.Parse(this.calBasicSalary.EditValue.ToString()); hRMEMPLOYEE.BasicSalary = hRMEMPLOYEE.PayMoney; hRMEMPLOYEE.InsuranceSalary = hRMEMPLOYEE.PayMoney; hRMEMPLOYEE.DateSalary = this.dtSignDate.DateTime; } hRMEMPLOYEE.Update(); } } else { XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } this.DoHide(); str = str1; } else { MyRule.Notify(); str = ""; } return(str); }
private HRM_CONTRACT InitClass() { HRM_CONTRACT hRMCONTRACT; HRM_CONTRACT str = new HRM_CONTRACT() { ContractCode = this.txtContractCode.Text }; if (this.glkEmployeeCode.EditValue == null) { XtraMessageBox.Show("Vui lòng chọn nhân viên cần tạo hợp đồng!"); hRMCONTRACT = null; } else { str.EmployeeCode = this.glkEmployeeCode.EditValue.ToString(); if (!(this.txtContractCode.Text == "")) { str.ContractType = this.cboContractType.SelectedIndex; str.ContractTime = this.cboContractTime.Text; str.SignDate = this.dtSignDate.DateTime; str.FromDate = this.dtFromDate.DateTime; if (this.cboContractType.SelectedIndex != 1) { str.ToDate = this.dtToDate.DateTime; } else { SqlDateTime maxValue = SqlDateTime.MaxValue; str.ToDate = Convert.ToDateTime(maxValue.ToString()); } str.BasicSalary = decimal.Parse(this.calBasicSalary.EditValue.ToString()); str.PayForm = this.cboPayForm.Text; str.PayDate = this.txtPayDate.Text; str.Allowance = this.txtAllowance.Text; str.Insurance = this.txtInsurance.Text; str.WorkTime = this.txtWorkTime.Text; str.Compensation = decimal.Parse(this.calCompensation.EditValue.ToString()); str.Signer = this.txtSigner.Text; str.SignerPosition = this.txtSignerPosition.Text; str.SignerNationality = this.txtSignerNationality.Text; str.Company = this.txtCompany.Text; str.Address = this.txtAddress.Text; str.Tel = this.txtTel.Text; str.CreatePlace = this.txtCreatePlace.Text; str.Subject = this.txtSubject.Text; str.Description = this.txtDescription.Text; if (!this.chxIsCurrent.Checked) { str.IsCurrent = false; } else { str.IsCurrent = true; } hRMCONTRACT = str; } else { XtraMessageBox.Show("Vui lòng nhập mã hợp đồng!"); hRMCONTRACT = null; } } return(hRMCONTRACT); }
private void btnPrint_Click(object sender, EventArgs e) { rptListContract _rptListContract; rptContract _rptContract; xfmReport _xfmReport = new xfmReport("Hợp Đồng Lao Động"); if (this.m_Value == 1) { _rptListContract = new rptListContract(this.m_Level, this.m_Code, "0"); _xfmReport.SetTitle("Danh Sách Tất Cả HĐLĐ Của Nhân Viên"); _xfmReport.ShowPrintPreview(_rptListContract); } else if (this.m_Value == 2) { _rptListContract = new rptListContract(this.m_Level, this.m_Code, "1"); _xfmReport.SetTitle("Danh Sách Nhân Viên Sắp Hết Hạn HĐLĐ"); _xfmReport.ShowPrintPreview(_rptListContract); } else if (this.m_Value == 3) { _rptListContract = new rptListContract(this.m_Level, this.m_Code, "2"); _xfmReport.SetTitle("Danh Sách Nhân Viên Đã Hết Hạn HĐLĐ"); _xfmReport.ShowPrintPreview(_rptListContract); } else if (!(this.m_Value == 5 ? false : this.m_Value != 0)) { _xfmReport.SetTitle("Hợp Đồng Lao Động"); HRM_CONTRACT hRMCONTRACT = new HRM_CONTRACT(); hRMCONTRACT.Get(this.m_ContractCode); clsContractOption _clsContractOption = new clsContractOption(); // HD Xác định thoi hạn if (hRMCONTRACT.ContractType == 0) { if (!(_clsContractOption.FilePath0 == "")) { _rptContract = new rptContract(this.m_ContractCode, this.m_EmployeeCode, _clsContractOption.FilePath0); _xfmReport.ShowPrintPreview(_rptContract); } else { _xfmReport.ShowPrintPreview(new rptContract0(this.m_ContractCode, this.m_EmployeeCode)); } } // khong xác dinh thoi han else if (hRMCONTRACT.ContractType == 1) { if (!(_clsContractOption.FilePath1 == "")) { _rptContract = new rptContract(this.m_ContractCode, this.m_EmployeeCode, _clsContractOption.FilePath1); _xfmReport.ShowPrintPreview(_rptContract); } else { _xfmReport.ShowPrintPreview(new rptContract1(this.m_ContractCode, this.m_EmployeeCode)); } } else if (hRMCONTRACT.ContractType == 2) { if (!(_clsContractOption.FilePath2 == "")) { _rptContract = new rptContract(this.m_ContractCode, this.m_EmployeeCode, _clsContractOption.FilePath2); _xfmReport.ShowPrintPreview(_rptContract); } else { _xfmReport.ShowPrintPreview(new rptContract2(this.m_ContractCode, this.m_EmployeeCode)); } } else if (hRMCONTRACT.ContractType == 3) { if (!(_clsContractOption.FilePath3 == "")) { _rptContract = new rptContract(this.m_ContractCode, this.m_EmployeeCode, _clsContractOption.FilePath3); _xfmReport.ShowPrintPreview(_rptContract); } else { _xfmReport.ShowPrintPreview(new rptContract3(this.m_ContractCode, this.m_EmployeeCode)); } } } else if (this.m_Value == 6) { _rptListContract = new rptListContract(this.m_Level, this.m_Code, "6"); _xfmReport.SetTitle("Danh Sách HĐLĐ Đang Quản Lý"); _xfmReport.ShowPrintPreview(_rptListContract); } }
private void bbiDelete_ItemClick(object sender, ItemClickEventArgs e) { string str; object rowCellValue; HRM_EMPLOYEE hRMEMPLOYEE; if (MyRule.IsDelete("bbiContract")) { 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_CONTRACT hRMCONTRACT = new HRM_CONTRACT(); for (int i = (int)selectedRows.Length; i > 0; i--) { flag = true; rowCellValue = this.gbList.GetRowCellValue(selectedRows[i - 1], "ContractCode"); this.m_EmployeeCode = this.gbList.GetRowCellValue(selectedRows[i - 1], "EmployeeCode").ToString(); if (rowCellValue != null) { // SYS_LOG.Insert("Hợp Đồng Lao Động", "Xoá", rowCellValue.ToString()); str = hRMCONTRACT.Delete(rowCellValue.ToString()); if (str == "OK") { this.gbList.DeleteRow(selectedRows[i - 1]); hRMEMPLOYEE = new HRM_EMPLOYEE(); hRMEMPLOYEE.Get(this.m_EmployeeCode); if (hRMEMPLOYEE.ContractCode == rowCellValue.ToString()) { hRMEMPLOYEE.ContractCode = ""; hRMEMPLOYEE.ContractType = ""; hRMEMPLOYEE.Update(); } } else if (str != "OK") { MessageBox.Show(string.Concat("Thông tin không được xóa", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } } this.DoHide(); if (!flag) { if (hRMCONTRACT.GetList(this.m_Level, this.m_Code).Rows.Count != 0) { rowCellValue = this.gbList.GetFocusedRowCellValue("ContractCode"); this.m_EmployeeCode = this.gbList.GetFocusedRowCellValue("EmployeeCode").ToString(); if (rowCellValue != null) { // SYS_LOG.Insert("Hợp Đồng Lao Động", "Xoá", rowCellValue.ToString()); base.SetWaitDialogCaption("Đang xóa..."); str = hRMCONTRACT.Delete(rowCellValue.ToString()); if (str == "OK") { this.gbList.DeleteRow(this.gbList.FocusedRowHandle); hRMEMPLOYEE = new HRM_EMPLOYEE(); hRMEMPLOYEE.Get(this.m_EmployeeCode); if (hRMEMPLOYEE.ContractCode == rowCellValue.ToString()) { hRMEMPLOYEE.ContractCode = ""; hRMEMPLOYEE.ContractType = ""; hRMEMPLOYEE.Update(); } } else if (str != "OK") { MessageBox.Show(string.Concat("Thông tin không được xóa", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); } this.DoHide(); } } } } } }
protected override string uc_Save() { string str; if (MyRule.Get(MyLogin.RoleId, "bbiContract") != "OK") { str = ""; } else if (!MyRule.AllowAdd) { MyRule.Notify(); str = ""; } else if ((this.txtContractCode.ErrorText != string.Empty ? false : !(this.glkEmployeeCode.ErrorText != string.Empty))) { // SYS_LOG.Insert("Hợp Đồng Lao Động", "Thêm", this.txtContractCode.Text); Cursor.Current = Cursors.WaitCursor; HRM_CONTRACT hRMCONTRACT = new HRM_CONTRACT(); HRM_CONTRACT hRMCONTRACT1 = this.InitClass(); hRMCONTRACT = hRMCONTRACT1; if (hRMCONTRACT1 != null) { base.SetWaitDialogCaption("Đang lưu dữ liệu..."); string str1 = hRMCONTRACT.Insert(); if (str1 == "OK") { this.RaiseSuccessEventHander(hRMCONTRACT); } Cursor.Current = Cursors.Default; if (!(str1 != "OK")) { HRM_EMPLOYEE hRMEMPLOYEE = new HRM_EMPLOYEE(); hRMEMPLOYEE.Get(this.glkEmployeeCode.EditValue.ToString()); HRM_PROCESS_SALARY hRMPROCESSSALARY = new HRM_PROCESS_SALARY() { SalaryID = Guid.NewGuid(), EmployeeCode = hRMEMPLOYEE.EmployeeCode, OldPayForm = hRMEMPLOYEE.PayForm, OldPayMoney = hRMEMPLOYEE.PayMoney, OldRankSalary = hRMEMPLOYEE.RankSalary, OldStepSalary = hRMEMPLOYEE.StepSalary, OldCoefficientSalary = hRMEMPLOYEE.CoefficientSalary, OldMinimumSalary = hRMEMPLOYEE.MinimumSalary, OldBasicSalary = hRMEMPLOYEE.BasicSalary, OldInsuranceSalary = hRMEMPLOYEE.InsuranceSalary, NewPayForm = 1, NewPayMoney = decimal.Parse(this.calBasicSalary.EditValue.ToString()), NewRankSalary = hRMEMPLOYEE.RankSalary, NewStepSalary = hRMEMPLOYEE.StepSalary, NewCoefficientSalary = hRMEMPLOYEE.CoefficientSalary, NewMinimumSalary = hRMEMPLOYEE.MinimumSalary, NewBasicSalary = decimal.Parse(this.calBasicSalary.EditValue.ToString()), NewInsuranceSalary = decimal.Parse(this.calBasicSalary.EditValue.ToString()), Date = this.dtSignDate.DateTime, Reason = "Ký mới hợp đồng lao động", Person = this.txtSigner.Text }; hRMPROCESSSALARY.Insert(); hRMEMPLOYEE.ContractCode = this.txtContractCode.Text; hRMEMPLOYEE.ContractType = this.cboContractType.Text; hRMEMPLOYEE.ContractSignDate = this.dtFromDate.DateTime; hRMEMPLOYEE.ContractFromDate = this.dtFromDate.DateTime; if (this.cboContractType.SelectedIndex != 1) { hRMEMPLOYEE.ContractToDate = this.dtToDate.DateTime; } else { SqlDateTime maxValue = SqlDateTime.MaxValue; hRMEMPLOYEE.ContractToDate = Convert.ToDateTime(maxValue.ToString()); } if (hRMEMPLOYEE.PayForm == 1) { hRMEMPLOYEE.PayMoney = decimal.Parse(this.calBasicSalary.EditValue.ToString()); hRMEMPLOYEE.BasicSalary = hRMEMPLOYEE.PayMoney; hRMEMPLOYEE.InsuranceSalary = hRMEMPLOYEE.PayMoney; hRMEMPLOYEE.DateSalary = this.dtSignDate.DateTime; } hRMEMPLOYEE.Update(); } else { XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } this.DoHide(); str = str1; } else { str = "FALSE"; } } else { MessageBox.Show("Mã hợp đồng hoặc mã nhân viên không được trùng!", "Cảnh Báo"); str = ""; } return(str); }
private void frm_Added(object sender, HRM_CONTRACT Item) { this.Init(); }