public bool UpdateSupplierAccount(Supplier oldSupplier, Supplier newSupplier)
        {
            bool success = false;

            try
            {
                if (1 == SupplierAccessor.UpdateSupplier(oldSupplier, newSupplier))
                {
                    success = true;
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(success);
        }
Beispiel #2
0
 /// <summary>
 /// Reece Maas
 /// Created: 2015/02/18
 /// Updates a Supplier
 /// Throws any exceptions caught by the DAL
 /// </summary>
 /// <remarks>
 /// Matt Lapka
 /// Updated:  2015/03/27
 /// Added supplier cache
 /// </remarks>
 /// <param name="newSupplier">Supplier object containing the new information of the supplier</param>
 /// <param name="oldSupplier">Supplier object containing the current information of the supplier to be matched to salve concurrency problems</param>
 /// <returns>An enumerated result depicting pass or fail</returns>
 public SupplierResult EditSupplier(Supplier oldSupplier, Supplier newSupplier)
 {
     try
     {
         if (SupplierAccessor.UpdateSupplier(newSupplier, oldSupplier) == 1)
         {
             //update cache
             DataCache._currentSupplierList = SupplierAccessor.GetSupplierList();
             DataCache._SupplierListTime    = DateTime.Now;
             return(SupplierResult.Success);
         }
         return(SupplierResult.NotChanged);
     }
     catch (ApplicationException ex)
     {
         return(ex.Message == "Concurrency Violation" ? SupplierResult.ChangedByOtherUser : SupplierResult.DatabaseError);
     }
     catch (Exception)
     {
         return(SupplierResult.DatabaseError);
     }
 }