public ActionResult uploadimg(OpenShopViewModel moudel) { string viewname = ""; if (moudel.Id != 0) { viewname = "OpenShop_add3"; var fileBLSName = UploadImgUtility.UploadImage(Request.Files["BLSfile"], Server.MapPath(CommonContorllers.FileUploadOpenShopBLSImgPath)); if (!string.IsNullOrEmpty(fileBLSName)) { moudel.BLS = CommonContorllers.FileUploadOpenShopBLSImgPath + fileBLSName; } var fileCICName = UploadImgUtility.UploadImage(Request.Files["CICfile"], Server.MapPath(CommonContorllers.FileUploadOpenShopCICImgPath)); if (!string.IsNullOrEmpty(fileCICName)) { moudel.CIC = CommonContorllers.FileUploadOpenShopCICImgPath + fileCICName; } } else { YG.SC.DataAccess.OpenShop model = new DataAccess.OpenShop(); var attrsTypes = this._iShopAttributesService.GetListByAttributeId(OpenShopAttrId); var typelist = (from m in attrsTypes select new SelectListItem { Text = m.ValueStr, Value = m.Id.ToString() }).ToList(); ViewBag.shopType = typelist; CategorySearchCriteria SearchCriteria = new CategorySearchCriteria(); SearchCriteria.ParentId = -1; var rangelist = this._objectService.SearchCategory(SearchCriteria).Item1; var range = (from m in rangelist select new SelectListItem { Text = m.Name, Value = m.Id.ToString() }).ToList(); ViewBag.range = range; var Districtlist = this._hotareaService.GetByParentId(1); var District = (from m in Districtlist select new SelectListItem { Text = m.name, Value = m.id.ToString() }).ToList(); ViewBag.District = District; var fileLogoName = UploadImgUtility.UploadImage(Request.Files["Logofile"], Server.MapPath(CommonContorllers.FileUploadOpenShopLogoImgPath)); if (!string.IsNullOrEmpty(fileLogoName)) { moudel.Logo = CommonContorllers.FileUploadOpenShopLogoImgPath + fileLogoName; } var fileQRcodeName = UploadImgUtility.UploadImage(Request.Files["QRcodefile"], Server.MapPath(CommonContorllers.FileUploadOpenShopQRCodeImgPath)); if (!string.IsNullOrEmpty(fileQRcodeName)) { moudel.QRcode = CommonContorllers.FileUploadOpenShopQRCodeImgPath + fileQRcodeName; } ViewBag.quyu = Request.Form["District"]; viewname = "OpenShop_add1"; } return(View(viewname, moudel)); }
public ActionResult OpenShop_add1(OpenShopViewModel openShop) { var attrsTypes = this._iShopAttributesService.GetListByAttributeId(OpenShopAttrId); var typelist = (from m in attrsTypes select new SelectListItem { Text = m.ValueStr, Value = m.Id.ToString() }).ToList(); ViewBag.shopType = typelist; CategorySearchCriteria SearchCriteria = new CategorySearchCriteria(); SearchCriteria.ParentId = -1; var rangelist = this._objectService.SearchCategory(SearchCriteria).Item1; var range = (from m in rangelist select new SelectListItem { Text = m.Name, Value = m.Id.ToString() }).ToList(); ViewBag.range = range; var Districtlist = this._hotareaService.GetByParentId(1); var District = (from m in Districtlist select new SelectListItem { Text = m.name, Value = m.id.ToString() }).ToList(); ViewBag.District = District; DataAccess.OpenShop moudel = new DataAccess.OpenShop(); moudel.CreateTime = DateTime.Now; moudel.Recsts = 1; moudel.Name = openShop.Name; moudel.Abbreviation = openShop.Abbreviation; moudel.Type = openShop.Type != null ? openShop.Type.Value : 0; moudel.Url = openShop.Url; moudel.Address = openShop.Address; moudel.Introduction = openShop.Introduction; moudel.Logo = openShop.Logo; moudel.QRcode = openShop.QRcode; moudel.Districtid = openShop.Districtid; moudel.Rangeid = openShop.Rangeid; this._iOpenShopService.Insert(moudel); Customer customer = new Customer(); customer.Name = openShop.Customer; customer.LoginName = openShop.Name; customer.Mobile = openShop.Mobile; customer.Password = openShop.Password.Trim(); customer.Property = true; customer.registertime = DateTime.Now; customer.GroupId = (int)CommonEnum.GroupOfCustomer.OpenShop; customer.Online = true; customer.Companyid = moudel.Id; _openShopId = moudel.Id; this._iCustomerService.Insert(customer); WriteUserSession(customer, ""); return(RedirectToAction("OpenShop_add2/" + moudel.Id)); }