public void AddTimeSheetEntriesForDays(List <day> days, int Resource_id) { foreach (var h in days) { tbl_TimeSheet mytime = new tbl_TimeSheet(); mytime.Resource_ID = Resource_id; mytime.Date = new DateTime(h.Year, h.Month, h.Day); mytime.Hours = (decimal)h.HoursWorked; db.tbl_TimeSheets.InsertOnSubmit(mytime); } }
public void AddTimeSheetEntriesForDays(List<day> days, int Resource_id) { foreach (var h in days) { tbl_TimeSheet mytime = new tbl_TimeSheet(); mytime.Resource_ID = Resource_id; mytime.Date = new DateTime(h.Year, h.Month, h.Day); mytime.Hours = (decimal)h.HoursWorked; db.tbl_TimeSheets.InsertOnSubmit(mytime); } }
public void Add(tbl_TimeSheet ts) { db.tbl_TimeSheets.InsertOnSubmit(ts); }
partial void Deletetbl_TimeSheet(tbl_TimeSheet instance);
partial void Updatetbl_TimeSheet(tbl_TimeSheet instance);
partial void Inserttbl_TimeSheet(tbl_TimeSheet instance);
private void detach_tbl_TimeSheets(tbl_TimeSheet entity) { this.SendPropertyChanging(); entity.tbl_Resource = null; }
private void Update(int resource_id, DateTime myDate, FormCollection coll) { timedb.DeleteTimesheet(resource_id, myDate); List<day> myEntries = new List<day>(); foreach (var item in coll) { if(item.ToString().Contains("r")) { if(coll[item.ToString()] != string.Empty) myEntries.Add(new day { Day = int.Parse(item.ToString().Replace("r", "")), Year = myDate.Year, Month = myDate.Month, HoursWorked = decimal.Parse(coll[item.ToString()].ToString()) }); } } foreach (var h in myEntries) { tbl_TimeSheet mytime = new tbl_TimeSheet(); mytime.Resource_ID = resource_id; mytime.Date = new DateTime(h.Year, h.Month, h.Day); mytime.Hours = (decimal)h.HoursWorked; timedb.Add(mytime); } timedb.Save(); }