/*******************************************************************************************************************\ * * \*******************************************************************************************************************/ private void do_delete() { bool flag_save = false; DataSet ds = dacTimebook.GetDS(RefWeek, 14); for (int i = 0; i < tlpCrew.RowCount; i++) { ucStat uc = (ucStat)tlpCrew.GetControlFromPosition(0, i); if (uc.EmpChk) { if (uc.IsDirty()) { flag_save = true; } continue; } if (!uc.IsDelete()) { continue; } //DataRow row; DateTime next_date; for (int day = 0; day < 14; day++) { next_date = RefWeek.Date.AddDays(day); dacTimebook.FindDel(new object[] { next_date, uc.EmpID, 0 }); } uc.DeleteReset(); } dacTimebook.DeleteData(); dacCache.PutTimebook(); cmdSave.Text = "Save"; cmdSave.Visible = flag_save; }
private void do_save() { DataSet ds = dacTimebook.GetDS(RefWeek, 14); for (int i = 0; i < tlpCrew.RowCount; i++) { ucStat uc = (ucStat)tlpCrew.GetControlFromPosition(0, i); if (!uc.EmpChk) { continue; } if (uc.IsDelete()) { continue; } if (!uc.IsDirty()) { continue; } //MessageBox.Show(uc.EmpName); //RCD rcd = uc.RcdStat; //for (int j = 0; j <= 13; j++) // if (rcd.toff[j] != null) MessageBox.Show(rcd.toff[j].ToString()); DataRow row; DateTime next_date; for (int day = 0; day < 14; day++) { next_date = RefWeek.Date.AddDays(day); string toff = uc.EmpToff[day]; string vessel = uc.Emp0Vessel[day]; row = ds.Tables[0].NewRow(); row["EmpName"] = uc.EmpName; //row["LogHours"] = uc.EmpHour[day]; //row["LogOver"] = uc.EmpOver[day]; row["LogHours"] = 0; row["LogOver"] = 0; if (toff != null && toff.Length == 0) { row["ToffCode"] = null; } else { row["ToffCode"] = toff; } if (vessel != null && vessel.Length == 0) { row["LogVessel"] = null; } else { row["LogVessel"] = uc.Emp0Vessel[day]; } row["LogShift"] = 0; row["LogNote"] = null; if (uc.Emp0Note[day] != null && uc.Emp0Note[day].Length > 0) { row["LogNote"] = uc.Emp0Note[day]; } dacTimebook.FindAdd(new object[] { next_date, uc.EmpID, 0 }, row); uc.SaveReset(); } } dacTimebook.SaveData(); dacCache.PutTimebook(); cmdSave.Visible = false; }