Example #1
0
        public JsonResult DeleteCode(FormCollection fm)
        {
            try
            {
                int Id;
                if (!int.TryParse(fm["Id"], out Id))
                {
                    throw new Exception("系统出错:Id格式错误");
                }

                switch (fm["Action"])
                {
                case "XF_SY_NAN":

                    XF_SY_NAN_ChiMaDto dto = XF_SY_NAN_ChiMa.GetOne(T => T.Id == Id);
                    dto.IsDeleted = true;
                    XF_SY_NAN_ChiMa.Update(dto);

                    break;

                case "XF_SY_NU":

                    XF_SY_NU_CodeSizeDto dtonu = XF_SY_NU_ChiMa.GetOne(T => T.Id == Id);
                    dtonu.IsDeleted = true;
                    XF_SY_NU_ChiMa.Update(dtonu);

                    break;

                case "XF_KZ_NAN":
                case "XF_KZ_NU":

                    XF_KZ_CodeSizeDto dtokz = XF_KZ_CodeSizeService.GetOne(T => T.Id == Id);
                    dtokz.IsDeleted = true;
                    XF_KZ_CodeSizeService.Update(dtokz);

                    break;
                }
                return(Json(new { state = 1, msg = "" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { state = -1, msg = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Example #2
0
        public JsonResult UpdateCode(FormCollection fm)
        {
            using (var db = new MySqlServer())
                try
                {
                    switch (fm["Action"])
                    {
                    case "XF_SY_NAN":

                        List <XF_SY_NAN_ChiMaDto> xfnanlist = new List <XF_SY_NAN_ChiMaDto>();
                        int count = fm["Height"].Split(',').Count();
                        for (int i = 0; i < count; i++)
                        {
                            int upid = 0;
                            if (!int.TryParse(fm["ID"].Split(',')[i], out upid))
                            {
                                XF_SY_NAN_ChiMaDto tjdto = new XF_SY_NAN_ChiMaDto();
                                tjdto.Height                = Convert.ToInt32(fm["Height"].Split(',')[i]);
                                tjdto.FrontLength           = fm["FrontLength"].Split(',')[i];
                                tjdto.NetBust               = fm["NetBust"].Split(',')[i];
                                tjdto.FinishedBust          = Convert.ToDecimal(fm["FinishedBust"].Split(',')[i]);
                                tjdto.InWaist               = Convert.ToDecimal(fm["InWaist"].Split(',')[i]);
                                tjdto.FinishedHem_NoFork    = Convert.ToDecimal(fm["FinishedHem_NoFork"].Split(',')[i]);
                                tjdto.FinishedHem_SplitEnds = Convert.ToDecimal(fm["FinishedHem_SplitEnds"].Split(',')[i]);
                                tjdto.ShoulderWidth         = Convert.ToDecimal(fm["ShoulderWidth"].Split(',')[i]);
                                tjdto.Sleecve_Show          = fm["Sleecve_Show"].Split(',')[i];
                                tjdto.Id        = upid;
                                tjdto.Status    = 0;
                                tjdto.Size_Code = fm["Size_Code"];
                                XF_SY_NAN_ChiMa.Update(tjdto);
                            }
                            else
                            {
                                XF_SY_NAN_ChiMaDto xfnan = XF_SY_NAN_ChiMa.GetOne(t => t.Id == upid);
                                xfnan.Height                = Convert.ToInt32(fm["Height"].Split(',')[i]);
                                xfnan.FrontLength           = fm["FrontLength"].Split(',')[i];
                                xfnan.NetBust               = fm["NetBust"].Split(',')[i];
                                xfnan.FinishedBust          = Convert.ToDecimal(fm["FinishedBust"].Split(',')[i]);
                                xfnan.InWaist               = Convert.ToDecimal(fm["InWaist"].Split(',')[i]);
                                xfnan.FinishedHem_NoFork    = Convert.ToDecimal(fm["FinishedHem_NoFork"].Split(',')[i]);
                                xfnan.FinishedHem_SplitEnds = Convert.ToDecimal(fm["FinishedHem_SplitEnds"].Split(',')[i]);
                                xfnan.ShoulderWidth         = Convert.ToDecimal(fm["ShoulderWidth"].Split(',')[i]);
                                xfnan.Sleecve_Show          = fm["Sleecve_Show"].Split(',')[i];
                                xfnan.Id     = upid;
                                xfnan.Status = 1;

                                XF_SY_NAN_ChiMa.Update(xfnan);
                            }
                        }

                        break;

                    case "XF_SY_NU":

                        int count2 = fm["Height"].Split(',').Count();
                        List <XF_SY_NU_CodeSizeDto> synulist = new List <XF_SY_NU_CodeSizeDto>();
                        for (int i = 0; i < count2; i++)
                        {
                            int upid = 0;
                            if (!int.TryParse(fm["ID"].Split(',')[i], out upid))
                            {
                                XF_SY_NU_CodeSizeDto synu = new XF_SY_NU_CodeSizeDto();
                                synu.Height             = Convert.ToDecimal(fm["Height"].Split(',')[i]);
                                synu.FrontLength        = fm["FrontLength"].Split(',')[i];
                                synu.NetBust            = fm["NetBust"].Split(',')[i];
                                synu.FinishedBust       = Convert.ToDecimal(fm["FinishedBust"].Split(',')[i]);
                                synu.InWaist            = Convert.ToDecimal(fm["InWaist"].Split(',')[i]);
                                synu.FinishedHem_NoFork = Convert.ToDecimal(fm["FinishedHem_NoFork"].Split(',')[i]);
                                synu.SleeveWidth        = Convert.ToDecimal(fm["SleeveWidth"].Split(',')[i]);
                                synu.ShoulderWidth      = Convert.ToDecimal(fm["ShoulderWidth"].Split(',')[i]);
                                synu.Sleecve_Show       = fm["FinishedHem_NoFork"].Split(',')[i];
                                synu.Size_Code          = fm["Size_Code"];
                                XF_SY_NU_ChiMa.Add(synu);
                            }
                            else
                            {
                                XF_SY_NU_CodeSizeDto synu = XF_SY_NU_ChiMa.GetOne(T => T.Id == upid);
                                synu.Height             = Convert.ToDecimal(fm["Height"].Split(',')[i]);
                                synu.FrontLength        = fm["FrontLength"].Split(',')[i];
                                synu.NetBust            = fm["NetBust"].Split(',')[i];
                                synu.FinishedBust       = Convert.ToDecimal(fm["FinishedBust"].Split(',')[i]);
                                synu.InWaist            = Convert.ToDecimal(fm["InWaist"].Split(',')[i]);
                                synu.FinishedHem_NoFork = Convert.ToDecimal(fm["FinishedHem_NoFork"].Split(',')[i]);
                                synu.SleeveWidth        = Convert.ToDecimal(fm["SleeveWidth"].Split(',')[i]);
                                synu.ShoulderWidth      = Convert.ToDecimal(fm["ShoulderWidth"].Split(',')[i]);
                                synu.Sleecve_Show       = fm["FinishedHem_NoFork"].Split(',')[i];

                                XF_SY_NU_ChiMa.Update(synu);
                            }
                        }

                        break;

                    case "XF_KZ_NAN":
                    case "XF_KZ_NU":

                        int count4 = fm["DZ_HipLength_CP"].Split(',').Count();
                        List <XF_KZ_CodeSizeDto> xfkznulist = new List <XF_KZ_CodeSizeDto>();

                        for (int i = 0; i < count4; i++)
                        {
                            int upid = 0;
                            if (!int.TryParse(fm["ID"].Split(',')[i], out upid))
                            {
                                XF_KZ_CodeSizeDto xfkz = new XF_KZ_CodeSizeDto();
                                xfkz.Code                    = fm["Code"].Split(',')[i];
                                xfkz.DZ_HipLength_CP         = Convert.ToDecimal(fm["DZ_HipLength_CP"].Split(',')[i]);
                                xfkz.SZ_HipLength_CP         = Convert.ToDecimal(fm["SZ_HipLength_CP"].Split(',')[i]);
                                xfkz.Crosspiece              = Convert.ToDecimal(fm["Crosspiece"].Split(',')[i]);
                                xfkz.LegWidth_UnderTheWaves  = Convert.ToDecimal(fm["LegWidth_UnderTheWaves"].Split(',')[i]);
                                xfkz.FrontRise_EvenWaist     = Convert.ToDecimal(fm["FrontRise_EvenWaist"].Split(',')[i]);
                                xfkz.AfterTheWaves_EvenWaist = Convert.ToDecimal(fm["AfterTheWaves_EvenWaist"].Split(',')[i]);
                                xfkz.NetHip                  = fm["NetHip"].Split(',')[i];
                                xfkz.CP_WaistWidth           = fm["CP_WaistWidth"].Split(',')[i];

                                xfkz.NetWaist  = fm["NetWaist"].Split(',')[i];
                                xfkz.Size_Code = fm["Size_Code"];
                                XF_KZ_Service.Add(xfkz);
                            }
                            else
                            {
                                XF_KZ_CodeSizeDto xfkz = XF_KZ_Service.GetOne(T => T.Id == upid);
                                xfkz.Code                    = fm["Code"].Split(',')[i];
                                xfkz.DZ_HipLength_CP         = Convert.ToDecimal(fm["DZ_HipLength_CP"].Split(',')[i]);
                                xfkz.SZ_HipLength_CP         = Convert.ToDecimal(fm["SZ_HipLength_CP"].Split(',')[i]);
                                xfkz.Crosspiece              = Convert.ToDecimal(fm["Crosspiece"].Split(',')[i]);
                                xfkz.LegWidth_UnderTheWaves  = Convert.ToDecimal(fm["LegWidth_UnderTheWaves"].Split(',')[i]);
                                xfkz.FrontRise_EvenWaist     = Convert.ToDecimal(fm["FrontRise_EvenWaist"].Split(',')[i]);
                                xfkz.AfterTheWaves_EvenWaist = Convert.ToDecimal(fm["AfterTheWaves_EvenWaist"].Split(',')[i]);
                                xfkz.NetHip                  = fm["NetHip"].Split(',')[i];
                                xfkz.CP_WaistWidth           = fm["CP_WaistWidth"].Split(',')[i];

                                xfkz.NetWaist = fm["NetWaist"].Split(',')[i];
                                XF_KZ_Service.Update(xfkz);
                            }
                        }
                        int IsKc = 0;

                        for (int i = 0; i < fm.AllKeys.Length; i++)
                        {
                            if (fm.AllKeys[i] == "HK_Height")
                            {
                                IsKc++;
                            }
                        }
                        if (IsKc > 0)
                        {
                            int hkCount = fm["HK_Height"].Split(',').Count();
                            List <HeightKuChangDto> HKList = new List <HeightKuChangDto>();
                            for (int i = 0; i < hkCount; i++)
                            {
                                HeightKuChangDto dto = new HeightKuChangDto();
                                dto.Id        = Convert.ToInt32(fm["HK_Id"].Split(',')[i]);
                                dto.Height    = Convert.ToDouble(fm["HK_Height"].Split(',')[i]);
                                dto.KuChang   = Convert.ToDouble(fm["HK_KuChang"].Split(',')[i]);
                                dto.Size_Code = fm["Size_Code"];
                                HKList.Add(dto);
                            }
                        }



                        break;

                    default:
                        break;
                    }

                    return(Json(new { state = 1, msg = "" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { state = -1, msg = ex.Message }, JsonRequestBehavior.AllowGet));
                }
        }