public void RaiseUpdatedEventHander(HRM_PROCESS_ADVANCE Item) { if (this.Updated != null) { this.Updated(this, Item); } }
protected override void Change() { base.Change(); if (MyRule.IsAccess("bbiProcessAdvance")) { HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE(); object focusedRowCellValue = this.gbList.GetFocusedRowCellValue("AdvanceID"); if (focusedRowCellValue != null) { base.SetWaitDialogCaption("Đang kiểm tra dữ liệu...."); if (!(hRMPROCESSADVANCE.Get(new Guid(focusedRowCellValue.ToString())) != "OK")) { this.DoHide(); xfmAdvanceAdd _xfmAdvanceAdd = new xfmAdvanceAdd(Actions.Update, hRMPROCESSADVANCE); _xfmAdvanceAdd.Updated += new xfmAdvanceAdd.UpdatedEventHander(this.frm_Updated); _xfmAdvanceAdd.Added += new xfmAdvanceAdd.AddedEventHander(this.frm_Added); _xfmAdvanceAdd.ShowDialog(); } else { this.DoHide(); XtraMessageBox.Show("Dữ liệu không tồn tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } }
protected override void LoadGrid() { base.LoadGrid(); HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE(); this.gcList.DataSource = hRMPROCESSADVANCE.GetAllListByDays(this.m_FromDate, this.m_ToDate); }
private void RaiseSuccessEventHander(HRM_PROCESS_ADVANCE item) { if (this.Success != null) { this.Success(this, item); } }
protected override void Import(DataTable ExcelContentTable) { object[] employeeCode; int num = 0; foreach (DataRow row in ExcelContentTable.Rows) { if (num != 0) { HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE(); try { hRMPROCESSADVANCE.AdvanceID = Guid.NewGuid(); hRMPROCESSADVANCE.EmployeeCode = row[this.ParamNameIndex[0]].ToString(); hRMPROCESSADVANCE.Reason = row[this.ParamNameIndex[3]].ToString(); try { hRMPROCESSADVANCE.Money = decimal.Parse(row[this.ParamNameIndex[4]].ToString()); } catch { hRMPROCESSADVANCE.Money = new decimal(0); } try { Perfect.Utils.MyDateTime.GetValueFromString(row[this.ParamNameIndex[5]].ToString()); hRMPROCESSADVANCE.Date = new DateTime(Perfect.Utils.MyDateTime.Year, Perfect.Utils.MyDateTime.Month, Perfect.Utils.MyDateTime.Day); } catch { hRMPROCESSADVANCE.Date = DateTime.Now; } hRMPROCESSADVANCE.Person = row[this.ParamNameIndex[6]].ToString(); if (!(hRMPROCESSADVANCE.Insert() == "OK")) { employeeCode = new object[] { "Dòng thứ ", num, " => ", hRMPROCESSADVANCE.EmployeeCode, ": Trùng mã nhân viên" }; base.ErrorRow(string.Concat(employeeCode)); } else { base.SuccessRow(); } } catch (Exception exception1) { Exception exception = exception1; employeeCode = new object[] { "Dòng thứ ", num, " => ", hRMPROCESSADVANCE.EmployeeCode, exception.ToString() }; base.ErrorRow(string.Concat(employeeCode)); } base.ProgressRow(string.Concat("Đang nạp dữ liệu... ", hRMPROCESSADVANCE.EmployeeCode, "...")); num++; } else { num++; } } }
public xfmAdvanceAdd(Actions Action) { this.InitializeComponent(); this.Init(); this.ucAdd.Status = Action; HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE(); this.ucAdd.SetData(hRMPROCESSADVANCE.NewID()); this.Text = "Thêm "; }
protected override void Delete() { string str; object rowCellValue; if (MyRule.IsDelete("bbiProcessAdvance")) { 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_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE(); for (int i = (int)selectedRows.Length; i > 0; i--) { flag = true; rowCellValue = this.gbList.GetRowCellValue(selectedRows[i - 1], "AdvanceID"); if (rowCellValue != null) { // SYS_LOG.Insert("Tạm Ứng", "Xoá", rowCellValue.ToString()); str = hRMPROCESSADVANCE.Delete(new Guid(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", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } } this.DoHide(); if (!flag) { rowCellValue = this.gbList.GetFocusedRowCellValue("AdvanceID"); if (rowCellValue != null) { // SYS_LOG.Insert("Tạm Ứng", "Xoá", rowCellValue.ToString()); base.SetWaitDialogCaption("Đang xóa..."); str = hRMPROCESSADVANCE.Delete(new Guid(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 void SetData(HRM_PROCESS_ADVANCE item) { this.m_AdvanceID = item.AdvanceID; // SYS_LOG.Insert("Quá Trình Tạm Ứng", "Xem", this.m_AdvanceID.ToString()); this.m_EmployeeCode = item.EmployeeCode; this.glkEmployeeCode.EditValue = this.m_EmployeeCode; this.glkEmployeeCode.Enabled = false; this.txtReason.Text = item.Reason; this.dtDate.DateTime = item.Date; this.calMoney.Text = item.Money.ToString(); this.cboPerson.Text = item.Person; this.LoadEmployeeInformation(); }
protected override string uc_Delete() { HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE() { AdvanceID = this.m_AdvanceID }; string str = hRMPROCESSADVANCE.Delete(); if (str == "OK") { this.RaiseSuccessEventHander(hRMPROCESSADVANCE); } return(str); }
public xfmAdvanceAdd(Actions Action, HRM_PROCESS_ADVANCE 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.SetDataByGuid(Item.AdvanceID); } }
private void ucAdd_Success(object sender, HRM_PROCESS_ADVANCE 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, "bbiProcessAdvance") != "OK") { str = ""; } else if (!MyRule.AllowAdd) { MyRule.Notify(); str = ""; } else if (!(this.m_EmployeeCode == "")) { // SYS_LOG.Insert("Quá Trình Tạm Ứng", "Thêm", this.m_AdvanceID.ToString()); base.SetWaitDialogCaption("Đang lưu dữ liệu..."); Cursor.Current = Cursors.WaitCursor; HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE() { AdvanceID = Guid.NewGuid(), EmployeeCode = this.m_EmployeeCode, Reason = this.txtReason.Text, Date = this.dtDate.DateTime, Money = decimal.Parse(this.calMoney.Text.ToString()), Person = this.cboPerson.Text }; string str1 = hRMPROCESSADVANCE.Insert(); if (str1 == "OK") { this.RaiseSuccessEventHander(hRMPROCESSADVANCE); } 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 nhân viên để lưu dữ liệu!", "Thông Báo", MessageBoxButtons.OK); str = ""; } return(str); }
public void Init(string EmployeeCode, int Month, int Year) { this.barManager1.SetPopupContextMenu(this.gcList, this.ppMenu); HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE(); string employeeCode = EmployeeCode; string str = employeeCode; this.m_EmployeeCode = employeeCode; int month = Month; int num = month; this.m_Month = month; int num1 = num; int year = Year; num = year; this.m_Year = year; this.gcList.DataSource = hRMPROCESSADVANCE.GetListByMonth(str, num1, num); }
public void Save() { HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE(); hRMPROCESSADVANCE.DeleteByMonth(this.m_EmployeeCode, this.m_Month, this.m_Year); try { foreach (DataRow row in (this.gcList.DataSource as DataTable).Rows) { Guid guid = Guid.NewGuid(); hRMPROCESSADVANCE.Insert(guid, this.m_EmployeeCode, row["Reason"].ToString(), DateTime.Parse(row["Date"].ToString()), decimal.Parse(row["Money"].ToString()), row["Person"].ToString()); } this.UpdateEmployeeSalary(); this.RaiseSavedHander(); } catch { } }
private void UpdateRow(HRM_PROCESS_ADVANCE item) { GridView gridView = this.gbList; int focusedRowHandle = this.gbList.FocusedRowHandle; gridView.SetRowCellValue(focusedRowHandle, "AdvanceID", item.AdvanceID); gridView.SetRowCellValue(focusedRowHandle, "EmployeeCode", item.EmployeeCode); HRM_EMPLOYEE hRMEMPLOYEE = new HRM_EMPLOYEE(); hRMEMPLOYEE.Get(item.EmployeeCode); gridView.SetRowCellValue(focusedRowHandle, "DepartmentName", hRMEMPLOYEE.DepartmentName); gridView.SetRowCellValue(focusedRowHandle, "GroupName", hRMEMPLOYEE.GroupName); gridView.SetRowCellValue(focusedRowHandle, "FirstName", hRMEMPLOYEE.FirstName); gridView.SetRowCellValue(focusedRowHandle, "LastName", hRMEMPLOYEE.LastName); gridView.SetRowCellValue(focusedRowHandle, "Reason", item.Reason); gridView.SetRowCellValue(focusedRowHandle, "Date", item.Date); gridView.SetRowCellValue(focusedRowHandle, "Money", item.Money); gridView.SetRowCellValue(focusedRowHandle, "Person", item.Person); gridView.UpdateCurrentRow(); }
protected override string uc_Update() { string str; if (MyRule.Get(MyLogin.RoleId, "bbiProcessAdvance") != "OK") { str = ""; } else if (MyRule.AllowEdit) { // SYS_LOG.Insert("Quá Trình Tạm Ứng", "Cập Nhật", this.m_AdvanceID.ToString()); base.SetWaitDialogCaption("Đang cập nhật dữ liệu..."); HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE() { AdvanceID = this.m_AdvanceID, EmployeeCode = this.m_EmployeeCode, Reason = this.txtReason.Text, Date = this.dtDate.DateTime, Money = decimal.Parse(this.calMoney.Text.ToString()), Person = this.cboPerson.Text }; string str1 = hRMPROCESSADVANCE.Update(); if (str1 == "OK") { this.RaiseSuccessEventHander(hRMPROCESSADVANCE); } if (str1 != "OK") { XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } this.DoHide(); str = str1; } else { MyRule.Notify(); str = ""; } return(str); }
protected override void Add() { base.Add(); HRM_PROCESS_ADVANCE hRMPROCESSADVANCE = new HRM_PROCESS_ADVANCE(); }
private void frm_Added(object sender, HRM_PROCESS_ADVANCE Item) { this.AddRow(Item); }
private void frm_Updated(object sender, HRM_PROCESS_ADVANCE Item) { this.UpdateRow(Item); }