Exemplo n.º 1
0
 public ReturnType AddPurchaseOrder(PurchaseOrder purchaseorder)
 {
     try
     {
         using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
         {
             alading.AddToPurchaseOrder(purchaseorder);
             if (alading.SaveChanges() == 1)
             {
                 return(ReturnType.Success);
             }
             else
             {
                 return(ReturnType.PropertyExisted);
             }
         }
     }
     catch (SqlException sex)
     {
         return(ReturnType.ConnFailed);
     }
     catch (Exception ex)
     {
         return(ReturnType.OthersError);
     }
 }
Exemplo n.º 2
0
 public ReturnType AddPurchaseOrder(List <PurchaseOrder> purchaseorderList)
 {
     try
     {
         using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
         {
             foreach (PurchaseOrder purchaseorder in purchaseorderList)
             {
                 alading.AddToPurchaseOrder(purchaseorder);
             }
             alading.SaveChanges();
             return(ReturnType.Success);
         }
     }
     catch (SqlException sex)
     {
         return(ReturnType.ConnFailed);
     }
     catch (Exception ex)
     {
         return(ReturnType.OthersError);
     }
 }