Example #1
0
    static public bool DeleteProject(DdProjectExt item, RevisionInfo revisionInfo)
    {
      DaProject da = new DaProject(DataStore.DbConnection);
      bool ok = da.DeleteById(item.Id);
      if (ok) AddChangeLog(da.TableName, item.Id, item.Timestamp, revisionInfo); //delete
	  return ok;
    }
    static public bool DeleteTaskHeadingRole(DdTaskHeadingRoleExt item, RevisionInfo revisionInfo)
    {
      DaTaskHeadingRole da = new DaTaskHeadingRole(DataStore.DbConnection);
      bool ok = da.DeleteById(item.Id);
      if (ok) AddChangeLog(da.TableName, item.Id, item.Timestamp, revisionInfo); //delete
	  return ok;
    }
 static public bool AddChangeLog(
   string targetTableName, int targetTableREF, byte[] targetTableTimestamp,
   RevisionInfo revisionInfo)
 {
   return AddChangeLog(
     targetTableName, targetTableREF, targetTableTimestamp,
     revisionInfo.Function, revisionInfo.Reference, revisionInfo.Comments);
 }
Example #4
0
 static public bool AddClient(ref DdClientExt item, RevisionInfo revisionInfo)
 {
   DaClient da = new DaClient(DataStore.DbConnection);
   da.Clear();
   da.ClientID = item.ClientID;
   da.Comment = item.Comment;
   da.FullName = item.FullName;
   da.Modified = item.Modified;
   da.ModifiedBy = item.ModifiedBy;
   bool ok = da.Insert();
   if (ok) AddChangeLog(da.TableName, da.Id, da.Timestamp, revisionInfo); //add
   if (ok) item = new DdClientExt(da.GetBuffer());
   return ok;
 }
 static public bool AddTaskHeadingRole(ref DdTaskHeadingRoleExt item, RevisionInfo revisionInfo)
 {
   DaTaskHeadingRole da = new DaTaskHeadingRole(DataStore.DbConnection);
   da.Clear();
   da.Modified = item.Modified;
   da.ModifiedBy = item.ModifiedBy;
   da.PersonREF = item.PersonREF;
   da.TaskHeadingREF = item.TaskHeadingREF;
   da.TaskRoleREF = item.TaskRoleREF;
   bool ok = da.Insert();
   if (ok) AddChangeLog(da.TableName, da.Id, da.Timestamp, revisionInfo); //add
   if (ok) item = new DdTaskHeadingRoleExt(da.GetBuffer());
   return ok;
 }
 static public bool AddChangeRequest(ref DdChangeRequestExt item, RevisionInfo revisionInfo)
 {
   DaChangeRequest da = new DaChangeRequest(DataStore.DbConnection);
   da.Clear();
   da.ApplicationREF = item.ApplicationREF;
   da.Comment = item.Comment;
   da.Modified = item.Modified;
   da.ModifiedBy = item.ModifiedBy;
   da.RequestID = item.RequestID;
   da.Title = item.Title;
   bool ok = da.Insert();
   if (ok) AddChangeLog(da.TableName, da.Id, da.Timestamp, revisionInfo); //add
   if (ok) item = new DdChangeRequestExt(da.GetBuffer());
   return ok;
 }
Example #7
0
 static public bool AddTaskRole(ref DdTaskRoleExt item, RevisionInfo revisionInfo)
 {
   DaTaskRole da = new DaTaskRole(DataStore.DbConnection);
   da.Clear();
   da.Description = item.Description;
   da.Modified = item.Modified;
   da.ModifiedBy = item.ModifiedBy;
   da.OnlyOne = item.OnlyOne;
   da.ProjectLevel = item.ProjectLevel;
   da.TaskRoleID = item.TaskRoleID;
   da.Title = item.Title;
   bool ok = da.Insert();
   if (ok) AddChangeLog(da.TableName, da.Id, da.Timestamp, revisionInfo); //add
   if (ok) item = new DdTaskRoleExt(da.GetBuffer());
   return ok;
 }
Example #8
0
 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;
 }
Example #9
0
 static public bool AddProject(ref DdProjectExt item, RevisionInfo revisionInfo)
 {
   DaProject da = new DaProject(DataStore.DbConnection);
   da.Clear();
   da.ClientREF = item.ClientREF;
   da.Description = item.Description;
   da.Modified = item.Modified;
   da.ModifiedBy = item.ModifiedBy;
   da.ProjectID = item.ProjectID;
   da.TaskHeadingREF = item.TaskHeadingREF;
   da.Title = item.Title;
   bool ok = da.Insert();
   if (ok) AddChangeLog(da.TableName, da.Id, da.Timestamp, revisionInfo); //add
   if (ok) item = new DdProjectExt(da.GetBuffer());
   return ok;
 }
 static public bool AddRequestItem(ref DdRequestItemExt item, RevisionInfo revisionInfo)
 {
   DaRequestItem da = new DaRequestItem(DataStore.DbConnection);
   da.Clear();
   da.ChangeRequestREF = item.ChangeRequestREF;
   da.Comment = item.Comment;
   da.Description = item.Description;
   da.EffectiveDate = item.EffectiveDate;
   da.ItemID = item.ItemID;
   da.Modified = item.Modified;
   da.ModifiedBy = item.ModifiedBy;
   bool ok = da.Insert();
   if (ok) AddChangeLog(da.TableName, da.Id, da.Timestamp, revisionInfo); //add
   if (ok) item = new DdRequestItemExt(da.GetBuffer());
   return ok;
 }
Example #11
0
 static public bool AddTask(ref DdTaskExt item, RevisionInfo revisionInfo)
 {
   DaTask da = new DaTask(DataStore.DbConnection);
   da.Clear();
   da.Description = item.Description;
   da.DueDate = item.DueDate;
   da.EstHours = item.EstHours;
   da.Modified = item.Modified;
   da.ModifiedBy = item.ModifiedBy;
   da.TaskHeadingREF = item.TaskHeadingREF;
   da.TaskID = item.TaskID;
   da.Title = item.Title;
   bool ok = da.Insert();
   if (ok) AddChangeLog(da.TableName, da.Id, da.Timestamp, revisionInfo); //add
   if (ok) item = new DdTaskExt(da.GetBuffer());
   return ok;
 }
 static public bool AddTimeReport(ref DdTimeReportExt item, RevisionInfo revisionInfo)
 {
   DaTimeReport da = new DaTimeReport(DataStore.DbConnection);
   da.Clear();
   da.CalendarREF = item.CalendarREF;
   da.Description = item.Description;
   da.EffectiveDate = item.EffectiveDate;
   da.Hours = item.Hours;
   da.Modified = item.Modified;
   da.ModifiedBy = item.ModifiedBy;
   da.PersonREF = item.PersonREF;
   da.TaskChargeCodeREF = item.TaskChargeCodeREF;
   bool ok = da.Insert();
   if (ok) AddChangeLog(da.TableName, da.Id, da.Timestamp, revisionInfo); //add
   if (ok) item = new DdTimeReportExt(da.GetBuffer());
   return ok;
 }
 static public bool AddRequestStatu(ref DdRequestStatusExt item, RevisionInfo revisionInfo)
 {
   DaRequestStatus da = new DaRequestStatus(DataStore.DbConnection);
   da.Clear();
   da.ChangeRequestREF = item.ChangeRequestREF;
   da.Comment = item.Comment;
   da.EffectiveDate = item.EffectiveDate;
   da.Hours = item.Hours;
   da.Modified = item.Modified;
   da.ModifiedBy = item.ModifiedBy;
   da.PersonREF = item.PersonREF;
   da.StatusID = item.StatusID;
   bool ok = da.Insert();
   if (ok) AddChangeLog(da.TableName, da.Id, da.Timestamp, revisionInfo); //add
   if (ok) item = new DdRequestStatusExt(da.GetBuffer());
   return ok;
 }
Example #14
0
 static public bool AddPerson(ref DdPersonExt item, RevisionInfo revisionInfo)
 {
   DaPerson da = new DaPerson(DataStore.DbConnection);
   da.Clear();
   da.Comment = item.Comment;
   da.Credentials = item.Credentials;
   da.FullName = item.FullName;
   da.Inactive = item.Inactive;
   da.Modified = item.Modified;
   da.ModifiedBy = item.ModifiedBy;
   da.PersonID = item.PersonID;
   da.Title = item.Title;
   bool ok = da.Insert();
   if (ok) AddChangeLog(da.TableName, da.Id, da.Timestamp, revisionInfo); //add
   if (ok) item = new DdPersonExt(da.GetBuffer());
   return ok;
 }
 static public bool SaveTaskHeadingRole(ref DdTaskHeadingRoleExt item, RevisionInfo revisionInfo)
 {
   DaTaskHeadingRole da = new DaTaskHeadingRole(DataStore.DbConnection);
   if (!da.GetById(item.Id)) return false;
   da.PersonREF = item.PersonREF;
   da.TaskHeadingREF = item.TaskHeadingREF;
   da.TaskRoleREF = item.TaskRoleREF;
   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 DdTaskHeadingRoleExt(da.GetBuffer());
   }
   return ok;
 }
Example #16
0
 static public bool SaveClient(ref DdClientExt item, RevisionInfo revisionInfo)
 {
   DaClient da = new DaClient(DataStore.DbConnection);
   if (!da.GetById(item.Id)) return false;
   da.ClientID = item.ClientID;
   da.Comment = item.Comment;
   da.FullName = item.FullName;
   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 DdClientExt(da.GetBuffer());
   }
   return ok;
 }
 static public bool SaveRequestItem(ref DdRequestItemExt item, RevisionInfo revisionInfo)
 {
   DaRequestItem da = new DaRequestItem(DataStore.DbConnection);
   if (!da.GetById(item.Id)) return false;
   da.ChangeRequestREF = item.ChangeRequestREF;
   da.Comment = item.Comment;
   da.Description = item.Description;
   da.EffectiveDate = item.EffectiveDate;
   da.ItemID = item.ItemID;
   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 DdRequestItemExt(da.GetBuffer());
   }
   return ok;
 }
Example #18
0
 static public bool SaveProject(ref DdProjectExt item, RevisionInfo revisionInfo)
 {
   DaProject da = new DaProject(DataStore.DbConnection);
   if (!da.GetById(item.Id)) return false;
   da.ClientREF = item.ClientREF;
   da.Description = item.Description;
   da.ProjectID = item.ProjectID;
   da.TaskHeadingREF = item.TaskHeadingREF;
   da.Title = item.Title;
   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 DdProjectExt(da.GetBuffer());
   }
   return ok;
 }
Example #19
0
 static public bool SaveTaskRole(ref DdTaskRoleExt item, RevisionInfo revisionInfo)
 {
   DaTaskRole da = new DaTaskRole(DataStore.DbConnection);
   if (!da.GetById(item.Id)) return false;
   da.Description = item.Description;
   da.OnlyOne = item.OnlyOne;
   da.ProjectLevel = item.ProjectLevel;
   da.TaskRoleID = item.TaskRoleID;
   da.Title = item.Title;
   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 DdTaskRoleExt(da.GetBuffer());
   }
   return ok;
 }
Example #20
0
 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;
 }
Example #21
0
 static public bool SaveStep(ref DdStepExt item, RevisionInfo revisionInfo)
 {
   DaStep da = new DaStep(DataStore.DbConnection);
   if (!da.GetById(item.Id)) return false;
   da.Description = item.Description;
   da.DueDate = item.DueDate;
   da.EstHours = item.EstHours;
   da.StepID = item.StepID;
   da.TaskREF = item.TaskREF;
   da.Title = item.Title;
   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 DdStepExt(da.GetBuffer());
   }
   return ok;
 }
 static public bool SaveTimeReport(ref DdTimeReportExt item, RevisionInfo revisionInfo)
 {
   DaTimeReport da = new DaTimeReport(DataStore.DbConnection);
   if (!da.GetById(item.Id)) return false;
   da.CalendarREF = item.CalendarREF;
   da.Description = item.Description;
   da.EffectiveDate = item.EffectiveDate;
   da.Hours = item.Hours;
   da.PersonREF = item.PersonREF;
   da.TaskChargeCodeREF = item.TaskChargeCodeREF;
   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 DdTimeReportExt(da.GetBuffer());
   }
   return ok;
 }
 static public void UpdateRequestItem(BindingSource binding, int changeRequestREF, RevisionInfo revInfo)
 {
   BindingList<DdRequestItemExt> list = (BindingList<DdRequestItemExt>)binding.DataSource;
   try
   {
     using (TransactionScope scope = new TransactionScope())
     {
     DaRequestItem da = new DaRequestItem(DataStore.CloneDbConnection());
     foreach (DdRequestItemExt item in list)
     {// do deletes first
       bool existing = da.GetById(item.Id);
       if (existing && item.DeleteFlag)
       {// delete here - avoid validation
         da.DeleteById(item.Id);
         AddChangeLog(da.TableName, item.Id, da.Timestamp, revInfo);  
       }
     }
     
     foreach (DdRequestItemExt item in list)
     {
       if (item.DeleteFlag) continue; // already done above
       //if (item.RequestItemID == string.Empty) continue; // already done above
       bool existing = da.GetById(item.Id);
       if (!existing)
       {
         da.Clear();
       }
       da.ChangeRequestREF = item.ChangeRequestREF;
       da.Comment = item.Comment;
       da.Description = item.Description;
       da.EffectiveDate = item.EffectiveDate;
       da.ItemID = item.ItemID;
       if (!existing)
       {
         da.ChangeRequestREF = changeRequestREF;
         da.Insert();
         AddChangeLog(da.TableName, da.Id, da.Timestamp, revInfo); 
       }
       else
       {
         if (!da._IsModified) continue;
         da.Modified = DateTime.Now;
         da.ModifiedBy = Environment.UserName;
         da.Save();
         AddChangeLog(da.TableName, da.Id, da.Timestamp, revInfo);           }
     }
       scope.Complete();
     }
     binding.DataSource = GetRequestItemList(changeRequestREF);
   }
   catch (AppEx)
   {
     throw;
   }
   catch (Exception exc)
   {
     throw new AppEx(exc, "Error updating RequestItem");
   }
 }
Example #24
0
 static public void UpdateCalendar(BindingSource binding, RevisionInfo revInfo)
 {
   BindingList<DdCalendarExt> list = (BindingList<DdCalendarExt>)binding.DataSource;
   try
   {
     using (TransactionScope scope = new TransactionScope())
     {
     DaCalendar da = new DaCalendar(DataStore.CloneDbConnection());
     foreach (DdCalendarExt item in list)
     {// do deletes first
       bool existing = da.GetById(item.Id);
       if (existing && item.DeleteFlag)
       {// delete here - avoid validation
         da.DeleteById(item.Id);
         AddChangeLog(da.TableName, item.Id, da.Timestamp, revInfo);  
       }
     }
     
     foreach (DdCalendarExt item in list)
     {
       if (item.DeleteFlag) continue; // already done above
       //if (item.DayDate == string.Empty) continue; // already done above
       bool existing = da.GetById(item.Id);
       if (!existing)
       {
         da.Clear();
       }
       da.DayDate = item.DayDate;
       da.DayNumber = item.DayNumber;
       da.EndOfPeriod = item.EndOfPeriod;
       da.InvoiceDue = item.InvoiceDue;
       da.PeriodNumber = item.PeriodNumber;
       if (!existing)
       {
         da.Insert();
         AddChangeLog(da.TableName, da.Id, da.Timestamp, revInfo); 
       }
       else
       {
         if (!da._IsModified) continue;
         da.Modified = DateTime.Now;
         da.ModifiedBy = Environment.UserName;
         da.Save();
         AddChangeLog(da.TableName, da.Id, da.Timestamp, revInfo);           }
     }
       scope.Complete();
     }
     binding.DataSource = GetCalendarList();
   }
   catch (AppEx)
   {
     throw;
   }
   catch (Exception exc)
   {
     throw new AppEx(exc, "Error updating Calendar");
   }
 }
 static public void UpdateTaskHeadingRole(BindingSource binding, int taskHeadingREF, RevisionInfo revInfo)
 {
   BindingList<DdTaskHeadingRoleExt> list = (BindingList<DdTaskHeadingRoleExt>)binding.DataSource;
   try
   {
     using (TransactionScope scope = new TransactionScope())
     {
     DaTaskHeadingRole da = new DaTaskHeadingRole(DataStore.CloneDbConnection());
     foreach (DdTaskHeadingRoleExt item in list)
     {// do deletes first
       bool existing = da.GetById(item.Id);
       if (existing && item.DeleteFlag)
       {// delete here - avoid validation
         da.DeleteById(item.Id);
         AddChangeLog(da.TableName, item.Id, da.Timestamp, revInfo);  
       }
     }
     
     foreach (DdTaskHeadingRoleExt item in list)
     {
       if (item.DeleteFlag) continue; // already done above
       //if (item.Id == string.Empty) continue; // already done above
       bool existing = da.GetById(item.Id);
       if (!existing)
       {
         da.Clear();
       }
       da.PersonREF = item.PersonREF;
       da.TaskHeadingREF = item.TaskHeadingREF;
       da.TaskRoleREF = item.TaskRoleREF;
       if (!existing)
       {
         da.TaskHeadingREF = taskHeadingREF;
         da.Insert();
         AddChangeLog(da.TableName, da.Id, da.Timestamp, revInfo); 
       }
       else
       {
         if (!da._IsModified) continue;
         da.Modified = DateTime.Now;
         da.ModifiedBy = Environment.UserName;
         da.Save();
         AddChangeLog(da.TableName, da.Id, da.Timestamp, revInfo);           }
     }
       scope.Complete();
     }
     binding.DataSource = GetTaskHeadingRoleList(taskHeadingREF);
   }
   catch (AppEx)
   {
     throw;
   }
   catch (Exception exc)
   {
     throw new AppEx(exc, "Error updating TaskHeadingRole");
   }
 }
 static public void UpdateUser(BindingSource binding, RevisionInfo revInfo)
 {
   BindingList<DdUserExt> list = (BindingList<DdUserExt>)binding.DataSource;
   try
   {
     using (TransactionScope scope = new TransactionScope())
     {
     DaUser da = new DaUser(DataStore.CloneDbConnection());
     foreach (DdUserExt item in list)
     {// do deletes first
       bool existing = da.GetById(item.Id);
       if (existing && item.DeleteFlag)
       {// delete here - avoid validation
         da.DeleteById(item.Id);
         AddChangeLog(da.TableName, item.Id, da.Timestamp, revInfo);  
       }
     }
     
     foreach (DdUserExt item in list)
     {
       if (item.DeleteFlag) continue; // already done above
       //if (item.UserID == string.Empty) continue; // already done above
       bool existing = da.GetById(item.Id);
       if (!existing)
       {
         da.Clear();
       }
       da.Comment = item.Comment;
       da.Credentials = item.Credentials;
       da.FullName = item.FullName;
       da.Inactive = item.Inactive;
       da.UserID = item.UserID;
       da.Title = item.Title;
       if (!existing)
       {
         da.Insert();
         AddChangeLog(da.TableName, da.Id, da.Timestamp, revInfo); 
       }
       else
       {
         if (!da._IsModified) continue;
         da.Modified = DateTime.Now;
         da.ModifiedBy = Environment.UserName;
         da.Save();
         AddChangeLog(da.TableName, da.Id, da.Timestamp, revInfo);           }
     }
       scope.Complete();
     }
     binding.DataSource = GetUserList();
   }
   catch (AppEx)
   {
     throw;
   }
   catch (Exception exc)
   {
     throw new AppEx(exc, "Error updating User");
   }
 }