static public DdCalendarExt GetCalendarInfo(int calendarREF) { DaCalendar da = new DaCalendar(DataStore.DbConnection); if (da.GetById(calendarREF)) return new DdCalendarExt(da.GetBuffer()); else return null; }
static public bool AddCalendar(ref DdCalendarExt item, RevisionInfo revisionInfo) { DaCalendar da = new DaCalendar(DataStore.DbConnection); da.Clear(); da.DayDate = item.DayDate; da.DayNumber = item.DayNumber; da.EndOfPeriod = item.EndOfPeriod; da.InvoiceDue = item.InvoiceDue; da.Modified = item.Modified; da.ModifiedBy = item.ModifiedBy; da.PeriodNumber = item.PeriodNumber; bool ok = da.Insert(); if (ok) AddChangeLog(da.TableName, da.Id, da.Timestamp, revisionInfo); //add if (ok) item = new DdCalendarExt(da.GetBuffer()); return ok; }
static public bool SaveCalendar(ref DdCalendarExt item, RevisionInfo revisionInfo) { DaCalendar da = new DaCalendar(DataStore.DbConnection); if (!da.GetById(item.Id)) return false; da.DayDate = item.DayDate; da.DayNumber = item.DayNumber; da.EndOfPeriod = item.EndOfPeriod; da.InvoiceDue = item.InvoiceDue; da.PeriodNumber = item.PeriodNumber; bool ok = true; if (da._IsModified) { da.Modified = DateTime.Now; da.ModifiedBy = Environment.UserName; ok = da.Save(); if (ok) AddChangeLog(da.TableName, da.Id, da.Timestamp, revisionInfo); if (ok) item = new DdCalendarExt(da.GetBuffer()); } return ok; }