Пример #1
0
 public int Add(AccountingObjectModel accObject)
 {
     HttpContext.Current = null;
     try
     {
         int i = Exists(accObject.InventaryNumber);
         if (i == -1)
         {
             DBItem dbItem = dbList.CreateItem();
             dbItem.SetValue("InventaryNumber", accObject.InventaryNumber);
             dbItem.SetValue("Description", accObject.Description);
             dbItem.SetValue("PostingDate", accObject.PostingDate);
             dbItem.SetValue("DeprecationDate", accObject.DeprecationDate);
             dbItem.SetValue("Owner", GetOwnerID(accObject.Owner));
             dbItem.SetValue("IsDeleted", accObject.Deleted);
             dbItem.Update(); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
             return 1;
         }
         else
         {
             return 4;
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
         //return 3;
     }
 }
Пример #2
0
 public int Update(string OldInventaryNumber, AccountingObjectModel accObject)
 {
     HttpContext.Current = null;
     int i = Exists(OldInventaryNumber);
     if (i == -1)
     {
         if (Add(accObject) == 1)
             return 7;
         else
             return 8;
     }
     else
     {
         try
         {
             dbList.Items[i].SetValue("InventaryNumber", accObject.InventaryNumber);
             dbList.Items[i].SetValue("Description", accObject.Description);
             dbList.Items[i].SetValue("PostingDate", accObject.PostingDate);
             dbList.Items[i].SetValue("DeprecationDate", accObject.DeprecationDate);
             dbList.Items[i].SetValue("Owner", GetOwnerID(accObject.Owner));
             dbList.Items[i].SetValue("IsDeleted", accObject.Deleted);
             dbList.Items[i].Update();
             return 5;
         }
         catch
         {
             return 6;
         }
     }
 }
Пример #3
0
 public void RollbackUpdate(string inventaryNumber, AccountingObjectModel oldAccObject)
 {
     Update(inventaryNumber, oldAccObject);
 }