/*******************************************************************************************************************\ * * \*******************************************************************************************************************/ private void update_timebook(bool show_all) { if (RefWeek == null) { return; } //DataSet ds = dacTimebook.GetDS(RefWeek, 14); //foreach (DataRow row in ds.Tables[0].Rows) foreach (DataRow row in _dt_tb.Rows) { var bookdate_ = row["Bookdate"]; if (bookdate_ == DBNull.Value) { continue; } DateTime bookdate = (DateTime)bookdate_; //if (bookdate.Date < RefWeek.Date) continue; //if (bookdate.Date >= RefWeek.AddDays(14).Date) continue; if (bookdate.Date.CompareTo(RefWeek.Date) == -1) { continue; } if (bookdate.Date.CompareTo(RefWeek.AddDays(14).Date) == 1) { continue; } //ucStat uc = (ucStat)tlpCrew.GetControlFromPosition(0, 0); //if (!_crew.ContainsKey(row["EmpId"].ToString())) // load_crew_from_row(RefWeek, row); try { //if (row["EmpID"].Equals("FS0623")) MessageBox.Show("A"); if (!show_all && !_employee.ContainsKey(row["EmpID"].ToString())) { continue; } // GS180907 - Debug Stop //string eid = row["EmpID"].ToString(); //if (eid.Equals("K1")) MessageBox.Show("Here"); ucSalary uc = _employee[row["EmpID"].ToString()]; string notebug = null; // can't use row["LogNote"].ToString() if (!row["LogNote"].Equals(DBNull.Value)) { notebug = row["LogNote"].ToString(); } Decimal over1 = 0.0M; if (!row["LogOver1"].Equals(DBNull.Value)) { over1 = (Decimal)row["LogOver1"]; } // GS180907 - Handle Incomplete Employee Data if (row["DefPayCode"].Equals(DBNull.Value)) { string msg = string.Format("{0} : Employee : [{1}:{2}] {3}", "WARNING - This employee is not properly setup. The DefPayCode is not valid", row["EmpID"].ToString(), row["EmpName"].ToString(), bookdate ); MessageBox.Show(msg, System.Reflection.MethodBase.GetCurrentMethod().ToString()); continue; } string paycode = (string)row["DefPayCode"]; if (!row["PayCode"].Equals(DBNull.Value)) { paycode = (string)row["PayCode"]; } string toff = string.Empty; if (!row["ToffCode"].Equals(DBNull.Value)) { toff = (string)row["ToffCode"]; } string boat = string.Empty; if (!row["LogVessel"].Equals(DBNull.Value)) { boat = (string)row["LogVessel"]; } uc.RefWeek = RefWeek; uc.RefreshDay(bookdate, toff, Convert.ToDecimal(row["LogHours"]), Convert.ToDecimal(row["LogOver"]), over1, boat, Convert.ToInt32(row["LogShift"]), notebug, paycode); } catch (Exception ex) { string msg = string.Format("Error ({0}) : Employee : [{1}:{2}] {3} => TOFF Code [{4}]", ex.Message, row["EmpID"].ToString(), row["EmpName"].ToString(), bookdate, row["ToffCode"].ToString()); MessageBox.Show(msg, System.Reflection.MethodBase.GetCurrentMethod().ToString()); } } }