Пример #1
0
 static public DdRequestStatusExt GetRequestStatuInfo(int requestStatuREF)
 {
   DaRequestStatus da = new DaRequestStatus(DataStore.DbConnection);
   if (da.GetById(requestStatuREF))
     return new DdRequestStatusExt(da.GetBuffer());
   else
     return null;
 }
Пример #2
0
 static public bool SaveRequestStatu(ref DdRequestStatusExt item, RevisionInfo revisionInfo)
 {
   DaRequestStatus da = new DaRequestStatus(DataStore.DbConnection);
   if (!da.GetById(item.Id)) return false;
   da.ChangeRequestREF = item.ChangeRequestREF;
   da.Comment = item.Comment;
   da.EffectiveDate = item.EffectiveDate;
   da.Hours = item.Hours;
   da.PersonREF = item.PersonREF;
   da.StatusID = item.StatusID;
   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 DdRequestStatusExt(da.GetBuffer());
   }
   return ok;
 }
Пример #3
0
 static public void UpdateRequestStatus(BindingSource binding, int changeRequestREF, RevisionInfo revInfo)
 {
   BindingList<DdRequestStatusExt> list = (BindingList<DdRequestStatusExt>)binding.DataSource;
   try
   {
     using (TransactionScope scope = new TransactionScope())
     {
     DaRequestStatus da = new DaRequestStatus(DataStore.CloneDbConnection());
     foreach (DdRequestStatusExt 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 (DdRequestStatusExt item in list)
     {
       if (item.DeleteFlag) continue; // already done above
       //if (item.RequestStatusID == 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.EffectiveDate = item.EffectiveDate;
       da.Hours = item.Hours;
       da.PersonREF = item.PersonREF;
       da.StatusID = item.StatusID;
       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 = GetRequestStatusList(changeRequestREF);
   }
   catch (AppEx)
   {
     throw;
   }
   catch (Exception exc)
   {
     throw new AppEx(exc, "Error updating RequestStatus");
   }
 }