/// <summary> ///数据 ///wuyf 20150908 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Create(long?id) { SuppliersModel model = new SuppliersModel(); ViewBag.thArea = _thAreaService.GetTHAreaByParentID(ACultureHelper.GetLanguageID, 0).Data; if (id.HasValue) { SalesSuppliersModel smodel = new SalesSuppliersModel(); smodel.SupplierId = id.Value; smodel.PagedIndex = 0; smodel.PagedSize = 100; smodel.Lang = ACultureHelper.GetLanguageID; //查询列表 List <SuppliersModel> List = this._suppliersService.GetSuppliers(smodel).Data; if (List != null && List.Count > 0) { model = List[0]; ViewBag.shiArea = _thAreaService.GetTHAreaByParentID(ACultureHelper.GetLanguageID, model.ShengTHAreaID).Data; ViewBag.xianArea = SelectCommon.GetTHArea_lang(_thAreaService.GetTHAreaByParentID(ACultureHelper.GetLanguageID, model.ShiTHAreaID).Data as List <HKTHMall.Domain.Models.THArea_lang>);//_thAreaService.GetTHAreaByParentID(CultureHelper.GetLanguageID, model.ShiTHAreaID).Data; //这里是用于修改通过密码验证使用的(修改是不修改密码的) model.PassWord = "******"; } } else { ViewBag.xianArea = SelectCommon.GetTHArea_lang(null); } return(PartialView(model)); }
public ActionResult Create(SuppliersModel model) { ViewBag.thArea = _thAreaService.GetTHAreaByParentID(ACultureHelper.GetLanguageID, 0).Data; ViewBag.xianArea = SelectCommon.GetTHArea_lang(null); if (ModelState.IsValid) { ResultModel resultModel = new ResultModel(); if (model.SupplierId > 0) { model.UpdateBy = UserInfo.CurrentUserName; model.UpdateDT = DateTime.Now; var result = _suppliersService.UpdateSuppliers(model).IsValid; resultModel.Messages = new List <string> { result == true ? " success!" : " failed!" }; var opera = string.Empty; opera = string.Format("修改供应商管理:{0},操作结果:{1}", JsonConverts.ToJson(model), resultModel.Messages); LogPackage.InserAC_OperateLog(opera, "修改供应商管理"); } else { SalesSuppliersModel smodel = new SalesSuppliersModel(); smodel.Mobile = model.Mobile; smodel.PagedIndex = 0; smodel.PagedSize = 2; var bl = Mobile(smodel); if (bl) { model.PassWord = FormsAuthentication.HashPasswordForStoringInConfigFile(model.PassWord.Trim(), "MD5"); model.SupplierId = MemCacheFactory.GetCurrentMemCache().Increment("commonId"); model.CreateBy = UserInfo.CurrentUserName; model.CreateDT = DateTime.Now; model.UpdateBy = UserInfo.CurrentUserName; model.UpdateDT = DateTime.Now; var result = _suppliersService.AddSuppliers(model).IsValid; resultModel.Messages = new List <string> { result == true ? " success!" : " failed!" }; var opera = string.Empty; opera = string.Format("添加供应商管理:{0},操作结果:{1}", JsonConverts.ToJson(model), resultModel.Messages); LogPackage.InserAC_OperateLog(opera, "添加供应商管理"); } else { resultModel.IsValid = false; resultModel.Messages = new List <string> { " Mobile phone number already exists!" }; } } return(Json(resultModel, JsonRequestBehavior.AllowGet)); } return(PartialView(model)); }