Example #1
0
        public JsonResult SaveTemplate(DTO.FreightTemplate templateinfo)
        {
            if (templateinfo.SourceAddress == null || templateinfo.SourceAddress.Value == 0)
            {
                return(Json(new { successful = false }));
            }

            templateinfo.ShopID = CurrentSellerManager.ShopId;
            FreightTemplateApplication.AddOrUpdateFreightTemplate(templateinfo);
            return(Json(new { successful = true }));
        }
Example #2
0
        public ActionResult Add(long?id)
        {
            long templateId = id.HasValue ? id.Value : 0;
            var  template   = new DTO.FreightTemplate()
            {
                ShopID = CurrentSellerManager.ShopId
            };

            ViewBag.IsUsed = 0;
            if (id.HasValue)
            {
                template = Himall.Application.FreightTemplateApplication.GetFreightTemplate(templateId, CurrentSellerManager.ShopId);

                //var template = _iFreightTemplateService.GetFreightTemplate(templateId);
                //if (template.ShopID != CurrentSellerManager.ShopId)
                //{
                //    throw new Core.HimallException("该运费模板不存在" + id);
                //}
                //var regionService = _iRegionService;
                //if (template.SourceAddress.HasValue)
                //{
                //    templateExtend.SourceAddressStr = regionService.GetRegionPath(template.SourceAddress.Value);
                //}
                //templateExtend.Id = template.Id;
                //templateExtend.IsFree = template.IsFree;
                //templateExtend.Name = template.Name;
                //templateExtend.ShopID = template.ShopID;
                //templateExtend.SendTime = template.SendTime;
                //templateExtend.SourceAddress = template.SourceAddress;
                //templateExtend.ValuationMethod = template.ValuationMethod;
                //templateExtend.FreightAreaContent = template.Himall_FreightAreaContent.Select(e => new Himall.Web.Areas.SellerAdmin.Models.FreightAreaContentInfoExtend()
                //{
                //    AreaContent = e.AreaContent,
                //    AreaContentCN = regionService.GetRegionByName(e.AreaContent).Name,
                //    AccumulationUnit = e.AccumulationUnit,
                //    AccumulationUnitMoney = e.AccumulationUnitMoney,
                //    FirstUnit = e.FirstUnit,
                //    FirstUnitMonry = e.FirstUnitMonry,
                //    IsDefault = e.IsDefault,
                //    FreightTemplateId = e.FreightTemplateId,
                //    Id = e.Id
                //});
                if (Himall.Application.FreightTemplateApplication.IsProductUseFreightTemp(templateId))
                {
                    ViewBag.IsUsed = 1;
                }
            }
            return(View(template));
        }
Example #3
0
 public JsonResult SaveTemplate(DTO.FreightTemplate templateinfo)
 {
     if (templateinfo.SourceAddress == null || templateinfo.SourceAddress.Value == 0)
     {
         return(Json(new { success = false }));
     }
     if (templateinfo.Name.Length > 20)
     {
         return(Json(new { success = false }));
     }
     foreach (var item in templateinfo.FreightArea)
     {
         item.FirstUnitMonry        = (float)Math.Round(item.FirstUnitMonry.Value, 2);
         item.AccumulationUnitMoney = (float)Math.Round(item.AccumulationUnitMoney.Value, 2);
     }
     templateinfo.ShopID = CurrentSellerManager.ShopId;
     FreightTemplateApplication.AddOrUpdateFreightTemplate(templateinfo);
     return(Json(new { success = true }));
 }