Exemplo n.º 1
0
        public JsonResult UpdateOrders(PZ_PlanZakaz pZ_PlanZakaz, int[] Orders)
        {
            string login = HttpContext.User.Identity.Name;

            if (Orders == null)
            {
                return(Json(1, JsonRequestBehavior.AllowGet));
            }
            for (int i = 0; i < Orders.Length; i++)
            {
                PZ_PlanZakaz editPZ = db.PZ_PlanZakaz.Find(Orders[i]);
                if (pZ_PlanZakaz.Manager != null)
                {
                    editPZ.Manager = pZ_PlanZakaz.Manager;
                }
                if (pZ_PlanZakaz.Client != 0)
                {
                    editPZ.Client = pZ_PlanZakaz.Client;
                }
                if (pZ_PlanZakaz.id_PZ_OperatorDogovora != 0)
                {
                    editPZ.id_PZ_OperatorDogovora = pZ_PlanZakaz.id_PZ_OperatorDogovora;
                }
                if (pZ_PlanZakaz.id_PZ_FIO != 0)
                {
                    editPZ.id_PZ_FIO = pZ_PlanZakaz.id_PZ_FIO;
                }
                if (pZ_PlanZakaz.Name != null)
                {
                    if (editPZ.Name.Replace(" ", "") != pZ_PlanZakaz.Name.Replace(" ", ""))
                    {
                        EmailRename emailRename = new EmailRename(editPZ.PlanZakaz.ToString(), editPZ.Name, pZ_PlanZakaz.Name, login, false);
                        emailRename.SendEmail();
                        editPZ.Name = pZ_PlanZakaz.Name;
                    }
                }
                if (pZ_PlanZakaz.Description != null)
                {
                    editPZ.Description = pZ_PlanZakaz.Description;
                }
                if (pZ_PlanZakaz.MTR != null)
                {
                    editPZ.MTR = pZ_PlanZakaz.MTR;
                }
                if (pZ_PlanZakaz.nomenklaturNumber != null)
                {
                    editPZ.nomenklaturNumber = pZ_PlanZakaz.nomenklaturNumber;
                }
                if (pZ_PlanZakaz.timeContract != null)
                {
                    editPZ.timeContract = pZ_PlanZakaz.timeContract;
                }
                if (pZ_PlanZakaz.timeContractDate != null && pZ_PlanZakaz.timeContractDate.Value.Year > 2000)
                {
                    editPZ.timeContractDate = pZ_PlanZakaz.timeContractDate;
                }
                if (pZ_PlanZakaz.timeArr != null)
                {
                    editPZ.timeArr = pZ_PlanZakaz.timeArr;
                }
                if (pZ_PlanZakaz.timeArrDate != null && pZ_PlanZakaz.timeArrDate.Value.Year > 2000)
                {
                    editPZ.timeArrDate = pZ_PlanZakaz.timeArrDate;
                }
                if (pZ_PlanZakaz.DateShipping != null && pZ_PlanZakaz.DateShipping.Year > 2000)
                {
                    editPZ.DateShipping = pZ_PlanZakaz.DateShipping;
                }
                if (pZ_PlanZakaz.DateSupply != null && pZ_PlanZakaz.DateSupply.Year > 2000)
                {
                    editPZ.DateSupply = pZ_PlanZakaz.DateSupply;
                }
                if (pZ_PlanZakaz.Dostavka != 0)
                {
                    editPZ.Dostavka = pZ_PlanZakaz.Dostavka;
                }
                if (pZ_PlanZakaz.Cost != 0)
                {
                    editPZ.Cost = pZ_PlanZakaz.Cost;
                }
                if (pZ_PlanZakaz.costSMR != 0)
                {
                    editPZ.costSMR = pZ_PlanZakaz.costSMR;
                }
                if (pZ_PlanZakaz.costPNR != 0)
                {
                    editPZ.costPNR = pZ_PlanZakaz.costPNR;
                }
                if (pZ_PlanZakaz.ProductType != 0)
                {
                    editPZ.ProductType = pZ_PlanZakaz.ProductType;
                }
                if (pZ_PlanZakaz.OL != null)
                {
                    editPZ.OL = pZ_PlanZakaz.OL;
                }
                if (pZ_PlanZakaz.Zapros != 0)
                {
                    editPZ.Zapros = pZ_PlanZakaz.Zapros;
                }
                if (pZ_PlanZakaz.numZakupki != null)
                {
                    editPZ.numZakupki = pZ_PlanZakaz.numZakupki;
                }
                if (pZ_PlanZakaz.numLota != null)
                {
                    editPZ.numLota = pZ_PlanZakaz.numLota;
                }
                if (pZ_PlanZakaz.TypeShip != 0)
                {
                    editPZ.TypeShip = pZ_PlanZakaz.TypeShip;
                }
                if (pZ_PlanZakaz.criticalDateShip != null && pZ_PlanZakaz.criticalDateShip.Value.Year > 2000)
                {
                    editPZ.criticalDateShip = pZ_PlanZakaz.criticalDateShip;
                }
                if (pZ_PlanZakaz.PowerST != null)
                {
                    editPZ.PowerST = pZ_PlanZakaz.PowerST;
                }
                if (pZ_PlanZakaz.VN_NN != null)
                {
                    editPZ.VN_NN = pZ_PlanZakaz.VN_NN;
                }
                if (pZ_PlanZakaz.Modul != null)
                {
                    editPZ.Modul = pZ_PlanZakaz.Modul;
                }
                if (pZ_PlanZakaz.Gruzopoluchatel != null)
                {
                    editPZ.Gruzopoluchatel = pZ_PlanZakaz.Gruzopoluchatel;
                }
                if (pZ_PlanZakaz.PostAdresGruzopoluchatel != null)
                {
                    editPZ.PostAdresGruzopoluchatel = pZ_PlanZakaz.PostAdresGruzopoluchatel;
                }
                if (pZ_PlanZakaz.INNGruzopoluchatel != null)
                {
                    editPZ.INNGruzopoluchatel = pZ_PlanZakaz.INNGruzopoluchatel;
                }
                if (pZ_PlanZakaz.OKPOGruzopoluchatelya != null)
                {
                    editPZ.OKPOGruzopoluchatelya = pZ_PlanZakaz.OKPOGruzopoluchatelya;
                }
                if (pZ_PlanZakaz.KodGruzopoluchatela != null)
                {
                    editPZ.KodGruzopoluchatela = pZ_PlanZakaz.KodGruzopoluchatela;
                }
                if (pZ_PlanZakaz.StantionGruzopoluchatel != null)
                {
                    editPZ.StantionGruzopoluchatel = pZ_PlanZakaz.StantionGruzopoluchatel;
                }
                if (pZ_PlanZakaz.KodStanciiGruzopoluchatelya != null)
                {
                    editPZ.KodStanciiGruzopoluchatelya = pZ_PlanZakaz.KodStanciiGruzopoluchatelya;
                }
                if (pZ_PlanZakaz.OsobieOtmetkiGruzopoluchatelya != null)
                {
                    editPZ.OsobieOtmetkiGruzopoluchatelya = pZ_PlanZakaz.OsobieOtmetkiGruzopoluchatelya;
                }
                if (pZ_PlanZakaz.DescriptionGruzopoluchatel != null)
                {
                    editPZ.DescriptionGruzopoluchatel = pZ_PlanZakaz.DescriptionGruzopoluchatel;
                }
                CorrectPlanZakaz correctPlanZakaz = new CorrectPlanZakaz(editPZ);
                editPZ = correctPlanZakaz.PZ_PlanZakaz;
                db.Entry(editPZ).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            return(Json(1, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public JsonResult Update(PZ_PlanZakaz pZ_PlanZakaz)
        {
            string       login  = HttpContext.User.Identity.Name;
            PZ_PlanZakaz editPZ = db.PZ_PlanZakaz.First(d => d.PlanZakaz == pZ_PlanZakaz.PlanZakaz);

            if (editPZ.Manager != pZ_PlanZakaz.Manager)
            {
                editPZ.Manager = pZ_PlanZakaz.Manager;
            }
            if (editPZ.Client != pZ_PlanZakaz.Client)
            {
                editPZ.Client = pZ_PlanZakaz.Client;
            }
            if (editPZ.id_PZ_OperatorDogovora != pZ_PlanZakaz.id_PZ_OperatorDogovora)
            {
                editPZ.id_PZ_OperatorDogovora = pZ_PlanZakaz.id_PZ_OperatorDogovora;
            }
            if (editPZ.id_PZ_FIO != pZ_PlanZakaz.id_PZ_FIO)
            {
                editPZ.id_PZ_FIO = pZ_PlanZakaz.id_PZ_FIO;
            }
            if (editPZ.Name != pZ_PlanZakaz.Name)
            {
                EmailRename emailRename = new EmailRename(editPZ.PlanZakaz.ToString(), editPZ.Name, pZ_PlanZakaz.Name, login, false);
                emailRename.SendEmail();
                editPZ.Name = pZ_PlanZakaz.Name;
            }
            if (editPZ.Description != pZ_PlanZakaz.Description)
            {
                editPZ.Description = pZ_PlanZakaz.Description;
            }
            if (editPZ.MTR != pZ_PlanZakaz.MTR)
            {
                editPZ.MTR = pZ_PlanZakaz.MTR;
            }
            if (editPZ.nomenklaturNumber != pZ_PlanZakaz.nomenklaturNumber)
            {
                editPZ.nomenklaturNumber = pZ_PlanZakaz.nomenklaturNumber;
            }
            if (editPZ.timeContract != pZ_PlanZakaz.timeContract)
            {
                editPZ.timeContract = pZ_PlanZakaz.timeContract;
            }
            if (editPZ.timeContractDate != pZ_PlanZakaz.timeContractDate)
            {
                editPZ.timeContractDate = pZ_PlanZakaz.timeContractDate;
            }
            if (editPZ.timeArr != pZ_PlanZakaz.timeArr)
            {
                editPZ.timeArr = pZ_PlanZakaz.timeArr;
            }
            if (editPZ.timeArrDate != pZ_PlanZakaz.timeArrDate)
            {
                editPZ.timeArrDate = pZ_PlanZakaz.timeArrDate;
            }
            if (editPZ.DateShipping != pZ_PlanZakaz.DateShipping)
            {
                editPZ.DateShipping = pZ_PlanZakaz.DateShipping;
            }
            if (editPZ.DateSupply != pZ_PlanZakaz.DateSupply)
            {
                editPZ.DateSupply = pZ_PlanZakaz.DateSupply;
            }
            if (editPZ.Dostavka != pZ_PlanZakaz.Dostavka)
            {
                editPZ.Dostavka = pZ_PlanZakaz.Dostavka;
            }
            if (editPZ.Cost != pZ_PlanZakaz.Cost)
            {
                editPZ.Cost = pZ_PlanZakaz.Cost;
            }
            if (editPZ.costSMR != pZ_PlanZakaz.costSMR)
            {
                editPZ.costSMR = pZ_PlanZakaz.costSMR;
            }
            if (editPZ.costPNR != pZ_PlanZakaz.costPNR)
            {
                editPZ.costPNR = pZ_PlanZakaz.costPNR;
            }
            if (editPZ.ProductType != pZ_PlanZakaz.ProductType)
            {
                editPZ.ProductType = pZ_PlanZakaz.ProductType;
            }
            if (editPZ.OL != pZ_PlanZakaz.OL)
            {
                editPZ.OL = pZ_PlanZakaz.OL;
            }
            if (editPZ.Zapros != pZ_PlanZakaz.Zapros)
            {
                editPZ.Zapros = pZ_PlanZakaz.Zapros;
            }
            if (editPZ.numZakupki != pZ_PlanZakaz.numZakupki)
            {
                editPZ.numZakupki = pZ_PlanZakaz.numZakupki;
            }
            if (editPZ.numLota != pZ_PlanZakaz.numLota)
            {
                editPZ.numLota = pZ_PlanZakaz.numLota;
            }
            if (editPZ.TypeShip != pZ_PlanZakaz.TypeShip)
            {
                editPZ.TypeShip = pZ_PlanZakaz.TypeShip;
            }
            if (editPZ.criticalDateShip != pZ_PlanZakaz.criticalDateShip)
            {
                editPZ.criticalDateShip = pZ_PlanZakaz.criticalDateShip;
            }
            if (editPZ.PowerST != pZ_PlanZakaz.PowerST)
            {
                editPZ.PowerST = pZ_PlanZakaz.PowerST;
            }
            if (editPZ.VN_NN != pZ_PlanZakaz.VN_NN)
            {
                editPZ.VN_NN = pZ_PlanZakaz.VN_NN;
            }
            if (editPZ.Modul != pZ_PlanZakaz.Modul)
            {
                editPZ.Modul = pZ_PlanZakaz.Modul;
            }
            if (editPZ.Gruzopoluchatel != pZ_PlanZakaz.Gruzopoluchatel)
            {
                editPZ.Gruzopoluchatel = pZ_PlanZakaz.Gruzopoluchatel;
            }
            if (editPZ.PostAdresGruzopoluchatel != pZ_PlanZakaz.PostAdresGruzopoluchatel)
            {
                editPZ.PostAdresGruzopoluchatel = pZ_PlanZakaz.PostAdresGruzopoluchatel;
            }
            if (editPZ.INNGruzopoluchatel != pZ_PlanZakaz.INNGruzopoluchatel)
            {
                editPZ.INNGruzopoluchatel = pZ_PlanZakaz.INNGruzopoluchatel;
            }
            if (editPZ.OKPOGruzopoluchatelya != pZ_PlanZakaz.OKPOGruzopoluchatelya)
            {
                editPZ.OKPOGruzopoluchatelya = pZ_PlanZakaz.OKPOGruzopoluchatelya;
            }
            if (editPZ.KodGruzopoluchatela != pZ_PlanZakaz.KodGruzopoluchatela)
            {
                editPZ.KodGruzopoluchatela = pZ_PlanZakaz.KodGruzopoluchatela;
            }
            if (editPZ.StantionGruzopoluchatel != pZ_PlanZakaz.StantionGruzopoluchatel)
            {
                editPZ.StantionGruzopoluchatel = pZ_PlanZakaz.StantionGruzopoluchatel;
            }
            if (editPZ.KodStanciiGruzopoluchatelya != pZ_PlanZakaz.KodStanciiGruzopoluchatelya)
            {
                editPZ.KodStanciiGruzopoluchatelya = pZ_PlanZakaz.KodStanciiGruzopoluchatelya;
            }
            if (editPZ.OsobieOtmetkiGruzopoluchatelya != pZ_PlanZakaz.OsobieOtmetkiGruzopoluchatelya)
            {
                editPZ.OsobieOtmetkiGruzopoluchatelya = pZ_PlanZakaz.OsobieOtmetkiGruzopoluchatelya;
            }
            if (editPZ.DescriptionGruzopoluchatel != pZ_PlanZakaz.DescriptionGruzopoluchatel)
            {
                editPZ.DescriptionGruzopoluchatel = pZ_PlanZakaz.DescriptionGruzopoluchatel;
            }
            CorrectPlanZakaz correctPlanZakaz = new CorrectPlanZakaz(editPZ);

            editPZ = correctPlanZakaz.PZ_PlanZakaz;
            db.Entry(editPZ).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            return(Json(1, JsonRequestBehavior.AllowGet));
        }