Exemple #1
0
 public CorrespondInventoryDim GetCorrespondInventoryDim(Session session, Guid RefId)
 {
     try
     {
         CriteriaOperator       criteria_RowStaus = new BinaryOperator("RowStatus", Constant.ROWSTATUS_ACTIVE, BinaryOperatorType.Equal);
         CriteriaOperator       criteria_RefId    = new BinaryOperator("RefId", RefId, BinaryOperatorType.Equal);
         CriteriaOperator       criteria          = CriteriaOperator.And(criteria_RefId, criteria_RowStaus);
         CorrespondInventoryDim inventoryDim      = session.FindObject <CorrespondInventoryDim>(criteria);
         if (inventoryDim == null)
         {
             return(CreateCorrespondInventoryDim(session, RefId));
         }
         return(inventoryDim);
     }
     catch
     {
         return(null);
     }
 }
Exemple #2
0
 public CorrespondInventoryDim CreateCorrespondInventoryDim(Session session, Guid RefId)
 {
     try
     {
         NAS.DAL.Nomenclature.Inventory.Inventory inventory = session.GetObjectByKey <NAS.DAL.Nomenclature.Inventory.Inventory>(RefId);
         if (inventory == null)
         {
             return(null);
         }
         CorrespondInventoryDim inventoryDim = new CorrespondInventoryDim(session);
         inventoryDim.Code        = inventory.Code;
         inventoryDim.Description = inventory.Description;
         inventoryDim.RefId       = RefId;
         inventoryDim.Name        = inventory.Name;
         inventoryDim.RowStatus   = Constant.ROWSTATUS_ACTIVE;
         inventoryDim.Save();
         return(inventoryDim);
     }
     catch (Exception)
     {
         return(null);
     }
 }