private void loadDataTables() { m_dtShiftSetting = DBEngine.execReturnDataTable("MD_WorkingShift_List"); if (m_dtShiftSetting != null && m_dtShiftSetting.Rows.Count <= 0) { CRowUtility.addNewRow(m_dtShiftSetting, ShiftCode, ""); } // maxShiftID = CRowUtility.getMaxID(m_dtShiftSetting, "ShiftID"); }
private void grvShiftSetting_Click(object sender, EventArgs e) { string strShiftCode = ""; strShiftCode = grvShiftSetting.GetDataRow(grvShiftSetting.FocusedRowHandle)[ShiftCode].ToString(); // Load Detail shift info dtShiftDetail = DBEngine.execReturnDataTable("sp_Shift_ListDetail", "@ShiftCode", strShiftCode); if (dtShiftDetail != null && dtShiftDetail.Rows.Count <= 0) { CRowUtility.addNewRow(dtShiftDetail, DayOff1, 0); } BidingShiftDetail(); DirtyData = false; txtShiftCode.Focus(); txtShiftCode.SelectAll(); }
public override bool Commit() { try { if (SaveProdureName_TA.Equals(string.Empty)) { return(true); } if (UIMessage.ShowMessage(2, System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == DialogResult.No) { return(false); } // wait-cursor this.Cursor = Cursors.WaitCursor; short a; try { DBEngine.beginTransaction(); CRowUtility.updateDataRow(grvAttendanceList); grvAttendanceList.BeginUpdate(); if (dtAttendanceList != null) { DataTable dtChanges = dtAttendanceList.GetChanges(); foreach (DataRow dr in dtChanges.Rows) { foreach (DataColumn dc in dtChanges.Columns) { if (dr[dc.ColumnName] != dr[dc.ColumnName, DataRowVersion.Original]) { if (Int16.TryParse(dc.ColumnName, out a)) { DBEngine.exec(SaveProdureName_TA, CommonConst.A_LoginID, this.UserID, CommonConst.A_Month, month, CommonConst.A_Year, year, CommonConst.A_EmployeeID, dr[CommonConst.EmployeeID], "@DateName", dc.ColumnName, "@Value", dr[dc.ColumnName]); } } } } } grvAttendanceList.EndUpdate(); dtAttendanceList.AcceptChanges(); DBEngine.commit(); } catch (Exception ex) { grvAttendanceList.EndUpdate(); DBEngine.rollback(); throw (ex); } // restore cursor this.Cursor = Cursors.Default; } catch (Exception e) { // restore cursor this.Cursor = Cursors.Default; // show error HPA.Common.Helper.ShowException(e, this.Name + ".Commit()", null); // unable to commit return(false); } txtEmployeeID_Search.Focus(); txtEmployeeID_Search.SelectAll(); return(true); }