protected override string uc_Update() { string str; // SYSYS_LOGS_LOG.Insert("Giờ Làm Việc", "Cập Nhật", this.m_EmployeeCode.ToString()); long num = DateAndTime.DateDiff(DateInterval.Hour, Convert.ToDateTime(this.teTimeIn.EditValue.ToString()), Convert.ToDateTime(this.teTimeOut.EditValue.ToString()), FirstDayOfWeek.System, FirstWeekOfYear.System); if ((num < (long)0 ? false : num <= (long)24)) { base.SetWaitDialogCaption("Đang cập nhật dữ liệu..."); HRM_TIMEKEEPER hRMTIMEKEEPER = new HRM_TIMEKEEPER(); hRMTIMEKEEPER = this.InitClass(); string str1 = hRMTIMEKEEPER.Update(); if (str1 == "OK") { this.RaiseSuccessEventHander(hRMTIMEKEEPER); } if (str1 != "OK") { XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } this.DoHide(); str = str1; } else { XtraMessageBox.Show("Số giờ không được bé hơn 0 hoặc lớn hơn 24!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); str = ""; } return(str); }
private void RaiseSuccessEventHander(HRM_TIMEKEEPER item) { if (this.Success != null) { this.Success(this, item); } }
private void repPopup_Popup(object sender, EventArgs e) { this.m_EmployeeCode = this.gbList.GetFocusedRowCellValue(this.colEmployeeCode).ToString(); this.m_ShiftCode = this.gbList.GetFocusedRowCellValue(this.colShiftCode).ToString(); HRM_TIMEKEEPER hRMTIMEKEEPER = new HRM_TIMEKEEPER(); DataTable listByShift = hRMTIMEKEEPER.GetListByShift(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date); this.xucTimekeepingAdd.SetData(listByShift); this.xucTimekeepingAdd.Status = Actions.Update; }
protected override string uc_Delete() { HRM_TIMEKEEPER hRMTIMEKEEPER = this.InitClass(); string str = hRMTIMEKEEPER.Delete(); if (str == "OK") { this.RaiseSuccessEventHander(hRMTIMEKEEPER); } return(str); }
private void CalculateHour() { HRM_TIMEKEEPER hRMTIMEKEEPER = new HRM_TIMEKEEPER(); hRMTIMEKEEPER.Get(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Symbol, this.m_Date, Convert.ToDateTime(this.teTimeIn.EditValue.ToString()), Convert.ToDateTime(this.teTimeOut.EditValue.ToString()), this.m_Sorted, this.m_Length); this.calHour.EditValue = hRMTIMEKEEPER.Hour; this.calDayHour.EditValue = hRMTIMEKEEPER.DayHour; this.calNightHour.EditValue = hRMTIMEKEEPER.NightHour; this.calLateMinute.EditValue = hRMTIMEKEEPER.LateMinute; this.calEarlyMinute.EditValue = hRMTIMEKEEPER.EarlyMinute; }
private void spButton_Click(object sender, EventArgs e) { try { HRM_TIMEKEEPER hRMTIMEKEEPER = new HRM_TIMEKEEPER(); hRMTIMEKEEPER.Get(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date, (sender as SimpleButton).Text); this.SetData(hRMTIMEKEEPER); } catch { } }
public void SetData(Guid TimeKeeperTableListID, string EmployeeCode, DateTime Date) { DataTable listByShift; HRM_TIMEKEEPER hRMTIMEKEEPER = new HRM_TIMEKEEPER(); this.dt_Shift = hRMTIMEKEEPER.GetListByDate1(EmployeeCode, Date); if (this.dt_Shift.Rows.Count > 1) { this.btShiftBack.Enabled = true; this.btShiftNext.Enabled = true; this.bbiTimekeepingBreak.Enabled = true; this.btnSave.Enabled = true; } else if (this.dt_Shift.Rows.Count != 1) { if (this.dt_Shift.Rows.Count >= 1) { this.m_ShiftIndex = 1; this.m_ShiftTotal = this.dt_Shift.Rows.Count; listByShift = hRMTIMEKEEPER.GetListByShift(TimeKeeperTableListID, EmployeeCode, this.dt_Shift.Rows[this.m_ShiftIndex - 1]["ShiftCode"].ToString(), Date); this.SetData(listByShift); return; } this.btShiftBack.Enabled = false; this.btShiftNext.Enabled = false; this.bbiTimekeepingBreak.Enabled = false; this.btnSave.Enabled = false; this.txtShift.Text = ""; this.dtDate.DateTime = DateTime.Now; this.teTimeIn.EditValue = DateTime.Now; this.teTimeOut.EditValue = DateTime.Now; this.calHour.EditValue = 0; this.calNightHour.EditValue = 0; this.calDayHour.EditValue = 0; this.txtSymbol.Text = ""; this.calLateMinute.EditValue = 0; this.calEarlyMinute.EditValue = ""; this.txtDescription.Text = ""; return; } else { this.btShiftBack.Enabled = false; this.btShiftNext.Enabled = false; this.bbiTimekeepingBreak.Enabled = true; this.btnSave.Enabled = true; } this.m_ShiftIndex = 1; this.m_ShiftTotal = this.dt_Shift.Rows.Count; listByShift = hRMTIMEKEEPER.GetListByShift(TimeKeeperTableListID, EmployeeCode, this.dt_Shift.Rows[this.m_ShiftIndex - 1]["ShiftCode"].ToString(), Date); this.SetData(listByShift); }
private void btShiftBack_Click(object sender, EventArgs e) { HRM_TIMEKEEPER hRMTIMEKEEPER = new HRM_TIMEKEEPER(); if (this.m_ShiftIndex - 1 >= 1) { this.m_ShiftIndex--; } else { this.m_ShiftIndex = this.m_ShiftTotal; } DataTable listByShift = hRMTIMEKEEPER.GetListByShift(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.dt_Shift.Rows[this.m_ShiftIndex - 1]["ShiftCode"].ToString(), this.m_Date); this.SetData(listByShift); }
public bool SaveData() { bool flag; HRM_TIMEKEEPER hRMTIMEKEEPER = new HRM_TIMEKEEPER(); foreach (DataRow row in this.dt_Timekeeper.Rows) { if (hRMTIMEKEEPER.Update(this.m_TimeKeeperTableListID, row["EmployeeCode"].ToString(), row["ShiftCode"].ToString(), Convert.ToDateTime(row["Date"].ToString()), row["Symbol"].ToString(), Convert.ToDateTime(row["TimeIn"].ToString()), Convert.ToDateTime(row["TimeOut"].ToString()), Convert.ToDouble(row["Hour"].ToString()), Convert.ToDouble(row["DayHour"].ToString()), Convert.ToDouble(row["NightHour"].ToString()), Convert.ToDouble(row["PrivateHour"].ToString()), Convert.ToInt32(row["LateMinute"].ToString()), Convert.ToInt32(row["EarlyMinute"].ToString()), Convert.ToBoolean(row["IsOvertime"].ToString()), Convert.ToBoolean(row["IsWork"].ToString()), Convert.ToInt32(row["Sorted"].ToString()), row["Description"].ToString()) != "OK") { flag = false; return(flag); } } this.dt_Timekeeper.Clear(); flag = true; return(flag); }
public void SetData(DataRow dr) { this.m_TimeKeeperTableListID = new Guid(dr["TimeKeeperTableListID"].ToString()); this.m_EmployeeCode = dr["EmployeeCode"].ToString(); HRM_EMPLOYEE hRMEMPLOYEE = new HRM_EMPLOYEE(); hRMEMPLOYEE.Get(this.m_EmployeeCode); GroupControl groupControl = this.groupControl1; string[] firstName = new string[] { "Thông Tin Ra/Vào - ", hRMEMPLOYEE.FirstName, " ", hRMEMPLOYEE.LastName, " (", hRMEMPLOYEE.EmployeeCode, ") - ", dr["Symbol"].ToString() }; groupControl.Text = string.Concat(firstName); this.m_ShiftCode = dr["ShiftCode"].ToString(); this.m_Date = Convert.ToDateTime(dr["Date"].ToString()); this.m_Symbol = dr["Symbol"].ToString(); HRM_TIMEKEEPER hRMTIMEKEEPER = new HRM_TIMEKEEPER(); hRMTIMEKEEPER.Get(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date, this.m_Symbol); this.SetData(hRMTIMEKEEPER); }
protected override string uc_Save() { string str; // SYS_LOG.Insert("Giờ Làm Việc Làm Việc", "Thêm", ""); long num = DateAndTime.DateDiff(DateInterval.Hour, Convert.ToDateTime(this.teTimeIn.EditValue.ToString()), Convert.ToDateTime(this.teTimeOut.EditValue.ToString()), FirstDayOfWeek.System, FirstWeekOfYear.System); if ((num < (long)0 ? false : num <= (long)24)) { HRM_TIMEKEEPER hRMTIMEKEEPER = new HRM_TIMEKEEPER(); HRM_TIMEKEEPER hRMTIMEKEEPER1 = this.InitClass(); hRMTIMEKEEPER = hRMTIMEKEEPER1; if (hRMTIMEKEEPER1 != null) { base.SetWaitDialogCaption("Đang lưu dữ liệu..."); string str1 = hRMTIMEKEEPER.Insert(); if (str1 == "OK") { this.RaiseSuccessEventHander(hRMTIMEKEEPER); (new HRM_TIMEKEEPER_TOTAL()).Get(this.m_TimeKeeperTableListID, this.m_EmployeeCode); } Cursor.Current = Cursors.Default; if (str1 != "OK") { XtraMessageBox.Show(str1, "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } this.DoHide(); str = str1; } else { str = "FALSE"; } } else { XtraMessageBox.Show("Số giờ không được bé hơn 0 hoặc lớn hơn 24!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); str = ""; } return(str); }
private HRM_TIMEKEEPER InitClass() { HRM_TIMEKEEPER hRMTIMEKEEPER = new HRM_TIMEKEEPER() { TimeKeeperTableListID = this.m_TimeKeeperTableListID, EmployeeCode = this.m_EmployeeCode, ShiftCode = this.m_ShiftCode, Date = this.m_Date, Symbol = this.m_Symbol, TimeIn = Convert.ToDateTime(this.teTimeIn.EditValue.ToString()), TimeOut = Convert.ToDateTime(this.teTimeOut.EditValue.ToString()), Hour = Convert.ToDouble(this.calHour.EditValue.ToString()), DayHour = Convert.ToDouble(this.calDayHour.EditValue.ToString()), NightHour = Convert.ToDouble(this.calNightHour.EditValue.ToString()), LateMinute = Convert.ToInt32(this.calLateMinute.EditValue.ToString()), EarlyMinute = Convert.ToInt32(this.calEarlyMinute.EditValue.ToString()), IsOverTime = this.m_IsOverTime, IsWork = this.m_IsWork, Sorted = this.m_Sorted, Description = this.txtDescription.Text }; return(hRMTIMEKEEPER); }
public void SetData(HRM_TIMEKEEPER item) { // SYS_LOG.Insert("Giờ Làm Việc", "Xem", item.ShiftCode.ToString()); this.m_TimeKeeperTableListID = item.TimeKeeperTableListID; this.m_EmployeeCode = item.EmployeeCode; HRM_EMPLOYEE hRMEMPLOYEE = new HRM_EMPLOYEE(); hRMEMPLOYEE.Get(this.m_EmployeeCode); GroupControl groupControl = this.groupControl1; string[] firstName = new string[] { "Thông Tin Ra/Vào - ", hRMEMPLOYEE.FirstName, " ", hRMEMPLOYEE.LastName, " (", hRMEMPLOYEE.EmployeeCode, ") - ", item.Symbol }; groupControl.Text = string.Concat(firstName); this.m_ShiftCode = item.ShiftCode; this.m_Date = item.Date; this.m_Symbol = item.Symbol; DIC_SHIFT dICSHIFT = new DIC_SHIFT(); dICSHIFT.Get(this.m_ShiftCode); this.txtShift.Text = dICSHIFT.ShiftName; this.dtDate.DateTime = item.Date; this.txtSymbol.Text = item.Symbol; this.m_IsFirstLoad = true; this.teTimeIn.EditValue = item.TimeIn; this.m_IsFirstLoad = true; this.teTimeOut.EditValue = item.TimeOut; this.calHour.EditValue = item.Hour; this.calDayHour.EditValue = item.DayHour; this.calNightHour.EditValue = item.NightHour; this.calLateMinute.EditValue = item.LateMinute; this.calEarlyMinute.EditValue = item.EarlyMinute; this.m_IsOverTime = item.IsOverTime; this.m_IsWork = item.IsWork; this.m_Sorted = item.Sorted; this.txtDescription.Text = item.Description; HRM_TIMEKEEPER_BREAK hRMTIMEKEEPERBREAK = new HRM_TIMEKEEPER_BREAK(); double num = hRMTIMEKEEPERBREAK.TotalBreakHour(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date); this.bbiTimekeepingBreak.Text = string.Concat("(", num.ToString(), "h)"); if (num <= 0) { this.bbiTimekeepingBreak.ButtonStyle = BorderStyles.Simple; } else { this.bbiTimekeepingBreak.ButtonStyle = BorderStyles.Office2003; HRM_TIMEKEEPER_EXTRA hRMTIMEKEEPEREXTRA = new HRM_TIMEKEEPER_EXTRA(); double num1 = hRMTIMEKEEPEREXTRA.TotalExtraHour(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date); this.bbiTimekeepingExtra.Text = string.Concat("(", num1.ToString(), "h)"); if (num1 <= 0) { this.bbiTimekeepingExtra.ButtonStyle = BorderStyles.Simple; } else { this.bbiTimekeepingExtra.ButtonStyle = BorderStyles.Office2003; } HRM_TIMEKEEPER_PRIVATE hRMTIMEKEEPERPRIVATE = new HRM_TIMEKEEPER_PRIVATE(); double num2 = hRMTIMEKEEPERPRIVATE.TotalPrivateHour(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date); this.bbiTimekeepingPrivate.Text = string.Concat("(", num2.ToString(), "h)"); if (num2 <= 0) { this.bbiTimekeepingPrivate.ButtonStyle = BorderStyles.Simple; } else { this.bbiTimekeepingPrivate.ButtonStyle = BorderStyles.Office2003; } } }
private void gbList_CellValueChanged(object sender, CellValueChangedEventArgs e) { if (e.Column != this.colTotalHour) { this.m_EmployeeCode = this.gbList.GetFocusedRowCellValue(this.colEmployeeCode).ToString(); this.m_ShiftCode = this.gbList.GetFocusedRowCellValue(this.colShiftCode).ToString(); if (this.m_IsEditValueChanged) { try { this.m_Hour = Convert.ToDouble(e.Value.ToString()); } catch { this.m_Hour = 0; this.gbList.SetFocusedValue(0); } if (this.m_Hour > 24) { XtraMessageBox.Show("Dữ liệu bạn nhập vào quá lớn!"); this.m_Hour = 0; this.gbList.SetFocusedValue(0); } if (this.m_Hour < 0) { this.m_Hour = 0; this.gbList.SetFocusedValue(0); } this.m_Symbol = "+"; this.m_IsWork = HRM_TIMEKEEPER_SHIFT.IsWork(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date.Day); double mHour = this.m_Hour * 60; int num = int.Parse(mHour.ToString()); DIC_SHIFT dICSHIFT = new DIC_SHIFT(); dICSHIFT.Get(this.m_ShiftCode); int year = this.m_Date.Year; int month = this.m_Date.Month; int day = this.m_Date.Day; int hour = dICSHIFT.BeginTime.Hour; int minute = dICSHIFT.BeginTime.Minute; DateTime beginTime = dICSHIFT.BeginTime; DateTime dateTime = new DateTime(year, month, day, hour, minute, beginTime.Second); int year1 = this.m_Date.Year; int month1 = this.m_Date.Month; int day1 = this.m_Date.Day; int hour1 = dICSHIFT.EndTime.Hour; int minute1 = dICSHIFT.EndTime.Minute; beginTime = dICSHIFT.EndTime; DateTime dateTime1 = new DateTime(year1, month1, day1, hour1, minute1, beginTime.Second); this.m_TimeIn = dateTime; HRM_TIMEKEEPER_BREAK hRMTIMEKEEPERBREAK = new HRM_TIMEKEEPER_BREAK(); double num1 = hRMTIMEKEEPERBREAK.TotalBreakHour(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date); mHour = num1 * 60; this.m_TimeOut = MyDateTime.AddMinute(this.m_TimeIn, num + int.Parse(mHour.ToString())); HRM_TIMEKEEPER hRMTIMEKEEPER = new HRM_TIMEKEEPER(); hRMTIMEKEEPER.Get(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Symbol, this.m_Date, this.m_TimeIn, this.m_TimeOut); this.m_TimeIn = hRMTIMEKEEPER.TimeIn; this.m_TimeOut = hRMTIMEKEEPER.TimeOut; this.m_Hour = hRMTIMEKEEPER.Hour; this.m_DayHour = hRMTIMEKEEPER.DayHour; this.m_NightHour = hRMTIMEKEEPER.NightHour; this.m_LateMinute = hRMTIMEKEEPER.LateMinute; this.m_EarlyMinute = hRMTIMEKEEPER.EarlyMinute; DataRowCollection rows = this.dt_Timekeeper.Rows; object[] mTimeKeeperTableListID = new object[] { this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date, this.m_Symbol, this.m_TimeIn, this.m_TimeOut, this.m_Hour, this.m_DayHour, this.m_NightHour, 0, this.m_LateMinute, this.m_EarlyMinute, this.m_IsOvertime, this.m_IsWork, 0, "" }; rows.Add(mTimeKeeperTableListID); this.SaveData(); if (this.m_IsSetRowCellValue) { this.SetRowCellValue(e.RowHandle, this.m_EmployeeCode); } else { this.m_IsSetRowCellValue = true; } } else { this.m_IsEditValueChanged = true; this.SetRowCellValue(e.RowHandle, this.m_EmployeeCode); } } }