Ejemplo n.º 1
0
 public ActionResult FreightTables()
 {
     return(PartialView(SystemCity.GetAdminClientCities()));
 }
Ejemplo n.º 2
0
        public ActionResult AddTemplate(string id)
        {
            ViewData["AllCitys"] = SystemCity.GetAdminClientCities();

            var ps = new DeliveryTemplateFreight
            {
                kuaidi             = new List <PostfareDetail>(),
                ziti               = new List <PostfareDetail>(),
                shangjia           = new List <PostfareDetail>(),
                FareFreeConditions = new List <FareFreeCondition>()
            };

            int templateid;
            var model = new DeliveryTemplate();

            if (int.TryParse(id, out templateid))
            {
                var r =
                    YunClient.Instance.Execute(new GetExpressTemplateRequest
                {
                    Id = templateid
                }, Token);

                model = r.Result;

                if (model.Freight.Any(e => e.DeliveryId == 4 && (e.Cities == null || !e.Cities.Any())))
                {
                    var m = model.Freight.First(e => e.DeliveryId == 4 && (e.Cities == null || !e.Cities.Any()));
                    ps.kuaidi1 = m.BaseQuantity.ToString();
                    ps.kuaidi2 = m.BasePrice.ToString();
                    ps.kuaidi3 = m.AddQuantity.ToString();
                    ps.kuaidi4 = m.AddPrice.ToString();
                }

                foreach (var a in model.Freight.Where(e => e.DeliveryId == 4 && (e.Cities != null && e.Cities.Any())))
                {
                    ps.kuaidi.Add(a);
                }

                if (model.Freight.Any(e => e.DeliveryId == 419 && (e.Cities == null || !e.Cities.Any())))
                {
                    var m = model.Freight.First(e => e.DeliveryId == 419 && (e.Cities == null || !e.Cities.Any()));
                    ps.ziti1 = m.BaseQuantity.ToString();
                    ps.ziti2 = m.BasePrice.ToString();
                    ps.ziti3 = m.AddQuantity.ToString();
                    ps.ziti4 = m.AddPrice.ToString();
                }

                foreach (var a in model.Freight.Where(e => e.DeliveryId == 419 && (e.Cities != null && e.Cities.Any())))
                {
                    ps.ziti.Add(a);
                }

                if (model.Freight.Any(e => e.DeliveryId == 2 && (e.Cities == null || !e.Cities.Any())))
                {
                    var m = model.Freight.First(e => e.DeliveryId == 2 && (e.Cities == null || !e.Cities.Any()));
                    ps.shangjia1 = m.BaseQuantity.ToString();
                    ps.shangjia2 = m.BasePrice.ToString();
                    ps.shangjia3 = m.AddQuantity.ToString();
                    ps.shangjia4 = m.AddPrice.ToString();
                }
                foreach (var a in model.Freight.Where(e => e.DeliveryId == 2 && (e.Cities != null && e.Cities.Any())))
                {
                    ps.shangjia.Add(a);
                }
            }

            ViewBag.Prices = ps;

            return(View(model));
        }