public ActionResult Create(WMS_CustomerModel vm) { IEnumerable <SelectListItem> cuslist = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID).Where(c => c.State && (c.StoreType == 2 || c.StoreType == 3)) .Select(c => new SelectListItem() { Value = c.CustomerID.ToString(), Text = c.CustomerName }); WMS_CustomerService service = new WMS_CustomerService(); vm.StorerID = cuslist; IList <WMS_Customer> customer = new List <WMS_Customer>(); //var segments = new SegmentService().GetSegmentsByCondition(new GetSegmentsByConditionRequest() { Name = "", State = true }).Result; //vm.Segments = segments.Select(s => new SelectListItem() { Value = s.ID.ToString(), Text = s.Name + "------>>详情>>" + s.Description }); //vm.Types = vm.StoreStatus > 0 ? 1 : 0; customer.Add(vm.Convert()); Response <IEnumerable <WMS_Customer> > response = service.AddCustomer(new AddWMS_CustomerRequest() { customers = customer }); { WMS_Customer cus = service.selectCustomer(vm.StorerKey, vm.CustomerID.ToString()); vm.ConvertDesc(cus); if (response.IsSuccess) { //刷新缓存 //ApplicationConfigHelper.RefreshApplicationWMS_Customers(); //ApplicationConfigHelper.RefreshGetApplicationWMS_Customer(); vm.ViewType = 0; ViewBag.Message = "0"; } return(View(vm)); } }
public ActionResult Create(string id, WMS_CustomerModel vm, int?ViewType, long?customerid) { IEnumerable <SelectListItem> cuslist = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID).Where(c => c.State && (c.StoreType == 2 || c.StoreType == 3)) .Select(c => new SelectListItem() { Value = c.CustomerID.ToString(), Text = c.CustomerName }); WMS_CustomerService service = new WMS_CustomerService(); vm.StorerID = cuslist; vm.ViewType = ViewType != null ? (int)ViewType : 2; //vm.StorerKey = "必填"; //vm.City = "必填"; //vm.Company = "必填"; //vm.CompanyCode = "必填"; //vm.UserDef10 = "必填"; //vm.AddressLine1 = "必填"; //vm.Contact1 = "必填"; //vm.PhoneNum1 = "必填"; bool isShowUserDef2 = true; if (id != null) { WMS_CustomerService customer = new WMS_CustomerService(); WMS_Customer cus = customer.selectCustomer(id.ToString(), customerid.ToString()); vm.ConvertDesc(cus); vm.CustomerID = customerid; // vm.ViewType = 0; isShowUserDef2 = false; } ViewBag.isWrite = isShowUserDef2; return(View(vm)); }