Beispiel #1
0
 public static bool SavePO(PurchaseOrder PO)
 {
     if (PO.Id == Guid.Empty)
     {
         Guid newPOId = PurchaseDataManager.CreatePO(POMap.reMapPOData(PO));
         PO.Id = newPOId;
     }
     else
     {
         PurchaseDataManager.UpdatePO(POMap.reMapPOData(PO));
     }
     foreach (PODetail pod in PO.PODetailsList)
     {
         if (pod.Id == Guid.Empty)
         {
             pod.PO = new Reference()
             {
                 Id = PO.Id, Name = PO.PONumber
             };
             Guid newPODId = PurchaseDataManager.CreatePODetail(POMap.reMapPODetailData(pod));
             pod.Id = newPODId;
         }
         else
         {
             PurchaseDataManager.UpdatePODetail(POMap.reMapPODetailData(pod));
         }
     }
     ResetCache();
     return(true);
 }
Beispiel #2
0
 public static bool CreatePO(PurchaseOrder PO)
 {
     try
     {
         Guid poid = PurchaseDataManager.CreatePO(POMap.reMapPOData(PO));
         if (poid != Guid.Empty)
         {
             PO.Id = poid;
             foreach (PODetail pod in PO.PODetailsList)
             {
                 if (pod.Id == Guid.Empty)
                 {
                     pod.PO = new Reference()
                     {
                         Id = PO.Id, Name = PO.PONumber
                     };
                     Guid newPODId = PurchaseDataManager.CreatePODetail(POMap.reMapPODetailData(pod));
                     pod.Id = newPODId;
                 }
                 else
                 {
                     PurchaseDataManager.UpdatePODetail(POMap.reMapPODetailData(pod));
                 }
             }
         }
         ResetCache();
         return(true);
     }
     catch (Exception ex)
     {
         ExceptionHandler.Error("Something went wrong. Details: " + ex.Message, ex);
     }
     return(false);
 }