public ActionResult EditCoefficientDet(BONDERANNUALENTITLEMENTCOEDET bonderannualentitlementcoedetedited)
        {
            BONDERANNUALENTITLEMENTCOEDET bonderannualentitlementcoedet = new BONDERANNUALENTITLEMENTCOEDET();

            if (ModelState.IsValid)
            {
                try
                {
                    bonderannualentitlementcoedet.AESLNO     = bonderannualentitlementcoedetedited.AESLNO;
                    bonderannualentitlementcoedet.BONDERSLNO = bonderannualentitlementcoedetedited.BONDERSLNO;
                    bonderannualentitlementcoedet.MSLNO      = bonderannualentitlementcoedetedited.MSLNO;
                    bonderannualentitlementcoedet.RMSLNO     = bonderannualentitlementcoedetedited.RMSLNO;

                    bonderannualentitlementcoedet.GROSSQT     = bonderannualentitlementcoedetedited.GROSSQT;
                    bonderannualentitlementcoedet.WASTAGEQT   = bonderannualentitlementcoedetedited.WASTAGEQT;
                    bonderannualentitlementcoedet.SHRINKAGEQT = bonderannualentitlementcoedetedited.SHRINKAGEQT;
                    bonderannualentitlementcoedet.NETQT       = bonderannualentitlementcoedetedited.NETQT;


                    db.Entry(bonderannualentitlementcoedet).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("EditCoefficientMas", new { id = bonderannualentitlementcoedetedited.AESLNO, id2 = bonderannualentitlementcoedetedited.BONDERSLNO, id3 = bonderannualentitlementcoedetedited.MSLNO }));
                }
                catch (Exception e)
                {
                }
            }


            return(View(bonderannualentitlementcoedet));
        }
Beispiel #2
0
        public void AddBonderAnnualEntitlementCoE(int?BonderSlno, int id, int[] ProductCoE, string[] ProductWeightCoE, string[] ProductDescriptionCoE, string[] ProductSizeCoE,
                                                  string[] ProductMeasurementCoE, string[] ProductRawmaterialsCoE, int[] ProductMachineCoE, int[] hscodesCoE, int[] RawmaterialProductID,
                                                  int[] measuementoCoE, int[] grossCoEs, int[] wastageCoEs, int[] shrinkageCoEs, int[] netCoEs)
        {
            if (ProductCoE != null)
            {
                int lenth = ProductCoE.Length;

                for (int i = 0; i < lenth; i++)
                {
                    BONDERANNUALENTITLEMENTCOM bonderannualentitlementcom = new BONDERANNUALENTITLEMENTCOM();

                    bonderannualentitlementcom.AESLNO      = (Int16)id;
                    bonderannualentitlementcom.BONDERSLNO  = (Int16)BonderSlno;
                    bonderannualentitlementcom.MSLNO       = (Int16)ProductCoE[i];
                    bonderannualentitlementcom.WEIGHT      = ProductWeightCoE[i];
                    bonderannualentitlementcom.MSIZE       = ProductSizeCoE[i];
                    bonderannualentitlementcom.MEASUREMENT = ProductMeasurementCoE[i];
                    //bonderannualentitlementcom.MDESC = ProductDescriptionCoE[i];
                    bonderannualentitlementcom.MACHINESLNO = (Int16)ProductMachineCoE[i];

                    for (int j = 0; j < hscodesCoE.Length; j++)
                    {
                        BONDERANNUALENTITLEMENTCOEDET bonderannualentitlementcoedet = new BONDERANNUALENTITLEMENTCOEDET();

                        OracleEntitiesConnStr db2 = new OracleEntitiesConnStr();

                        if (ProductCoE[i] == RawmaterialProductID[j])
                        {
                            bonderannualentitlementcoedet.AESLNO      = (Int16)id;
                            bonderannualentitlementcoedet.BONDERSLNO  = (Int16)BonderSlno;
                            bonderannualentitlementcoedet.MSLNO       = (Int16)ProductCoE[i];
                            bonderannualentitlementcoedet.RMSLNO      = (Int16)hscodesCoE[j];
                            bonderannualentitlementcoedet.GROSSQT     = (Int16)grossCoEs[j];
                            bonderannualentitlementcoedet.WASTAGEQT   = (Int16)wastageCoEs[j];
                            bonderannualentitlementcoedet.SHRINKAGEQT = (Int16)shrinkageCoEs[j];
                            bonderannualentitlementcoedet.NETQT       = (Int16)netCoEs[j];

                            db2.BONDERANNUALENTITLEMENTCOEDETs.Add(bonderannualentitlementcoedet);
                        }

                        db2.SaveChanges();
                    }


                    db.BONDERANNUALENTITLEMENTCOMs.Add(bonderannualentitlementcom);
                }

                db.SaveChanges();


                //db.SaveChanges();
            }
        }
        public ActionResult EditCoefficientDet(int?id, int?id2, int?id3, int?id4)
        {
            BONDERANNUALENTITLEMENTCOEDET bonderannualentitlementcoedet = db.BONDERANNUALENTITLEMENTCOEDETs.Where(x => x.AESLNO == id && x.BONDERSLNO == id2 && x.MSLNO == id3 && x.RMSLNO == id4).FirstOrDefault();

            if (bonderannualentitlementcoedet == null)
            {
                return(HttpNotFound());
            }

            //ViewBag.Rawmaterilas = new SelectList(db.MATERIALS.Where(r => r.MTYPE == "R"), "MSLNO", "MHSCODE", annualentlrawmaterial.MSLNO);
            //ViewBag.Unit = new SelectList(db.MEASUREMENTUNITs, "MUSLNO", "MUNAME", bonderannualentitlementcoedet.MUSLNO);

            return(View(bonderannualentitlementcoedet));
        }
        public ActionResult AddCoefficientRawMaterials(BONDERANNUALENTITLEMENTCOEDET bonderannualentitlementcoedetedited, int?aeslno, int?bonderslno, int?mslno, int?Rawmaterilas)
        {
            BONDERANNUALENTITLEMENTCOEDET bonderannualentitlementcoedet = new BONDERANNUALENTITLEMENTCOEDET();

            bonderannualentitlementcoedet.AESLNO      = (Int16)aeslno;
            bonderannualentitlementcoedet.BONDERSLNO  = (Int16)bonderslno;
            bonderannualentitlementcoedet.MSLNO       = (Int16)mslno;
            bonderannualentitlementcoedet.RMSLNO      = (Int16)Rawmaterilas;
            bonderannualentitlementcoedet.GROSSQT     = (Int32)bonderannualentitlementcoedetedited.GROSSQT;
            bonderannualentitlementcoedet.WASTAGEQT   = (Int32)bonderannualentitlementcoedetedited.WASTAGEQT;
            bonderannualentitlementcoedet.SHRINKAGEQT = (Int32)bonderannualentitlementcoedetedited.SHRINKAGEQT;
            bonderannualentitlementcoedet.NETQT       = (Int32)bonderannualentitlementcoedetedited.NETQT;

            db.BONDERANNUALENTITLEMENTCOEDETs.Add(bonderannualentitlementcoedet);
            db.SaveChanges();



            return(RedirectToAction("EditCoefficientMas", new { id = aeslno, id2 = bonderslno, id3 = mslno }));
        }
        public ActionResult AddEntitlementCoefficient(int?aeslno, int?bonderslno, int[] ProductCoE, string[] ProductWeightCoE, string[] ProductDescriptionCoE,
                                                      string[] ProductSizeCoE, string[] ProductMeasurementCoE, string[] ProductRawmaterialsCoE, int[] ProductMachineCoE, int[] hscodesCoE
                                                      , int[] measuementoCoE, int[] grossCoEs, int[] wastageCoEs, int[] shrinkageCoEs, int[] netCoEs, int[] RawmaterialProductID)
        {
            try
            {
                if (ProductCoE != null)
                {
                    int lenth = ProductCoE.Length;

                    for (int i = 0; i < lenth; i++)
                    {
                        BONDERANNUALENTITLEMENTCOM bonderannualentitlementcom = new BONDERANNUALENTITLEMENTCOM();

                        bonderannualentitlementcom.AESLNO      = (Int16)aeslno;
                        bonderannualentitlementcom.BONDERSLNO  = (Int16)bonderslno;
                        bonderannualentitlementcom.MSLNO       = (Int16)ProductCoE[i];
                        bonderannualentitlementcom.WEIGHT      = ProductWeightCoE[i];
                        bonderannualentitlementcom.MSIZE       = ProductSizeCoE[i];
                        bonderannualentitlementcom.MEASUREMENT = ProductMeasurementCoE[i];
                        //bonderannualentitlementcom.MDESC = ProductDescriptionCoE[i];
                        bonderannualentitlementcom.MACHINESLNO = (Int16)ProductMachineCoE[i];

                        for (int j = 0; j < hscodesCoE.Length; j++)
                        {
                            BONDERANNUALENTITLEMENTCOEDET bonderannualentitlementcoedet = new BONDERANNUALENTITLEMENTCOEDET();

                            OracleEntitiesConnStr db2 = new OracleEntitiesConnStr();

                            if (ProductCoE[i] == RawmaterialProductID[j])
                            {
                                bonderannualentitlementcoedet.AESLNO      = (Int16)aeslno;
                                bonderannualentitlementcoedet.BONDERSLNO  = (Int16)bonderslno;
                                bonderannualentitlementcoedet.MSLNO       = (Int16)ProductCoE[i];
                                bonderannualentitlementcoedet.RMSLNO      = (Int16)hscodesCoE[j];
                                bonderannualentitlementcoedet.GROSSQT     = (Int16)grossCoEs[j];
                                bonderannualentitlementcoedet.WASTAGEQT   = (Int16)wastageCoEs[j];
                                bonderannualentitlementcoedet.SHRINKAGEQT = (Int16)shrinkageCoEs[j];
                                bonderannualentitlementcoedet.NETQT       = (Int16)netCoEs[j];

                                db2.BONDERANNUALENTITLEMENTCOEDETs.Add(bonderannualentitlementcoedet);
                            }

                            db2.SaveChanges();
                        }


                        db.BONDERANNUALENTITLEMENTCOMs.Add(bonderannualentitlementcom);
                    }

                    db.SaveChanges();
                }


                return(RedirectToAction("EntitlementDetails", new { ID = aeslno }));
            }


            catch
            {
                ViewBag.MachineList  = new SelectList(db.MACHINEINFORMATIONs, "MACHINESLNO", "MODELNM");
                ViewBag.Products     = new SelectList(db.MATERIALS.Where(p => p.MTYPE == "F"), "MSLNO", "MHSCODE");
                ViewBag.Rawmaterilas = new SelectList(db.MATERIALS.Where(r => r.MTYPE == "r"), "MSLNO", "MHSCODE");
                ViewBag.AeSlno       = aeslno;
                ViewBag.BonderSlno   = bonderslno;

                return(View());
            }
        }