コード例 #1
0
        public void CopyChildEntities(int ParentID)
        {
            string con = ConfigurationHelper.GetsmARTDBContextConnectionString();

            PurchaseOrderItemLibrary poItemLib = new PurchaseOrderItemLibrary();

            poItemLib.Initialize(con);
            IEnumerable <PurchaseOrderItem> poItems = poItemLib.GetAllByParentID(ParentID, new string[] { "PurchaseOrder", "Item" });

            Session["PurchaseOrderItem"] = poItems;

            PurchaseOrderNotesLibrary poNotesLib = new PurchaseOrderNotesLibrary();

            poNotesLib.Initialize(con);
            IEnumerable <PurchaseOrderNotes> poNotess = poNotesLib.GetAllByParentID(ParentID);

            Session["PurchaseOrderNotes"] = poNotess;

            PurchaseOrderAttachmentsLibrary poAttachmentsLib = new PurchaseOrderAttachmentsLibrary();

            poAttachmentsLib.Initialize(con);
            IEnumerable <PurchaseOrderAttachments> poAttachmentss = poAttachmentsLib.GetAllByParentID(ParentID);

            Session["PurchaseOrderAttachments"] = poAttachmentss;
        }
コード例 #2
0
 private void ValidatePOItem(Scale scale, ScaleDetails scaleItem)
 {
     if (scale.Purchase_Order != null && scale.Purchase_Order.ID > 0)
     {
         PurchaseOrderItemLibrary        poItemLib = new PurchaseOrderItemLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
         IEnumerable <PurchaseOrderItem> poItems   = poItemLib.GetAllByParentID(scale.Purchase_Order.ID, new string[] { "Item" });
         var isPOItem = (from i in poItems
                         where i.Item.ID == scaleItem.Item_Received.ID
                         select i).FirstOrDefault();
         if (isPOItem == null)
         {
             ModelState.AddModelError("Item_Received", string.Format("Scale details item {0} mismatch to selected purchase order items.", scaleItem.Item_Received.Short_Name));
         }
     }
 }