示例#1
0
        private string updatetbBillOfMaterials(HttpContext context)
        {
            try
            {
                //using (DXInfo.Models.AMSCM amscm = new DXInfo.Models.AMSCM())
                //{
                DXInfo.Models.tbBillOfMaterials tbBillOfMaterials = Uow.tbBillOfMaterials.GetById(g => g.cnvcPartInvCode == context.Request.Form["cnvcPartInvCode"] && g.cnvcComponentInvCode == context.Request.Form["cnvcComponentInvCode"]);
                tbBillOfMaterials.cnvcPartInvCode      = context.Request.Form["cnvcPartInvCode"];
                tbBillOfMaterials.cnvcComponentInvCode = context.Request.Form["cnvcComponentInvCode"];
                tbBillOfMaterials.cnnBaseQtyN          = Convert.ToDecimal(context.Request.Form["cnnBaseQtyN"]);
                tbBillOfMaterials.cnnBaseQtyD          = Convert.ToDecimal(context.Request.Form["cnnBaseQtyD"]);

                Uow.Commit();
                //}
            }
            catch (NullReferenceException nex)
            {
                ExceptionPolicy.HandleException(nex, ServiceHelper.ExceptionPolicy);
                return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, nex.Message)));
            }
            catch (DbUpdateException dex)
            {
                ExceptionPolicy.HandleException(dex, ServiceHelper.ExceptionPolicy);
                return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, dex.Message)));
            }
            return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(true, "")));
        }
示例#2
0
 private string removetbBillOfMaterials(HttpContext context)
 {
     try
     {
         //using (DXInfo.Models.AMSCM amscm = new DXInfo.Models.AMSCM())
         //{
         DXInfo.Models.tbBillOfMaterials tbBillOfMaterials = Uow.tbBillOfMaterials.GetById(g => g.cnvcPartInvCode == context.Request.Form["cnvcPartInvCode"] && g.cnvcComponentInvCode == context.Request.Form["cnvcComponentInvCode"]);
         Uow.tbBillOfMaterials.Delete(tbBillOfMaterials);
         Uow.Commit();
         //}
     }
     catch (ArgumentNullException aex)
     {
         ExceptionPolicy.HandleException(aex, ServiceHelper.ExceptionPolicy);
         return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, aex.Message)));
     }
     catch (DbUpdateException dex)
     {
         ExceptionPolicy.HandleException(dex, ServiceHelper.ExceptionPolicy);
         return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, dex.Message)));
     }
     return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(true, "")));
 }
示例#3
0
        private static void getComponent2(List <DXInfo.Models.tbBillOfMaterials> ltbBillOfMaterials, DXInfo.Models.tbBillOfMaterials bom, List <DXInfo.Models.tbBillOfMaterials> lComponentInv)
        {
            var l = (from d in ltbBillOfMaterials where d.cnvcPartInvCode == bom.cnvcComponentInvCode select d).ToList();

            if (l.Count > 0)
            {
                lComponentInv.Add(bom);
                foreach (DXInfo.Models.tbBillOfMaterials bom1 in l)
                {
                    getComponent2(ltbBillOfMaterials, bom1, lComponentInv);
                }
            }
        }
示例#4
0
        private static void getComponent(List <DXInfo.Models.tbBillOfMaterials> ltbBillOfMaterials, DXInfo.Models.tbBillOfMaterials bom, List <DXInfo.Models.tbBillOfMaterials> lComponentInv, decimal quantity)
        {
            var l = (from d in ltbBillOfMaterials where d.cnvcPartInvCode == bom.cnvcComponentInvCode select d);

            if (l.Count() > 0)
            {
                foreach (DXInfo.Models.tbBillOfMaterials bom1 in l)
                {
                    bom1.cnnBaseQtyN = bom1.cnnBaseQtyN * quantity;
                    getComponent(ltbBillOfMaterials, bom1, lComponentInv, bom1.cnnBaseQtyN);
                }
            }
            else
            {
                lComponentInv.Add(bom);
            }
        }