Example #1
0
        private string updatetbBillOfMaterials(HttpContext context)
        {
            try
            {
                using (AMSCM.Models.AMSCM amscm = new AMSCM.Models.AMSCM())
                {
                    AMSCM.Models.tbBillOfMaterials tbBillOfMaterials = amscm.tbBillOfMaterials.Find(context.Request.Form["cnvcPartInvCode"], 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"]);

                    amscm.SaveChanges();
                }
            }
            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, "")));
        }
Example #2
0
 private string removetbBillOfMaterials(HttpContext context)
 {
     try
     {
         using (AMSCM.Models.AMSCM amscm = new AMSCM.Models.AMSCM())
         {
             AMSCM.Models.tbBillOfMaterials tbBillOfMaterials = amscm.tbBillOfMaterials.Find(context.Request.Form["cnvcPartInvCode"], context.Request.Form["cnvcComponentInvCode"]);
             amscm.tbBillOfMaterials.Remove(tbBillOfMaterials);
             amscm.SaveChanges();
         }
     }
     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, "")));
 }
Example #3
0
        private static void getComponent2(List <AMSCM.Models.tbBillOfMaterials> ltbBillOfMaterials, AMSCM.Models.tbBillOfMaterials bom, List <AMSCM.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 (AMSCM.Models.tbBillOfMaterials bom1 in l)
                {
                    getComponent2(ltbBillOfMaterials, bom1, lComponentInv);
                }
            }
        }
Example #4
0
        private static void getComponent(List <AMSCM.Models.tbBillOfMaterials> ltbBillOfMaterials, AMSCM.Models.tbBillOfMaterials bom, List <AMSCM.Models.tbBillOfMaterials> lComponentInv, decimal quantity)
        {
            var l = (from d in ltbBillOfMaterials where d.cnvcPartInvCode == bom.cnvcComponentInvCode select d);

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