public string ImgAlterUpload(SWfsListAlterPic obj, string linkname, int groupId) { SWfsBrandService service = new SWfsBrandService(); obj.CreateDate = DateTime.Now; if (string.IsNullOrEmpty(obj.AlterAddress)) { obj.AlterAddress = ""; } #region 添加图片 if (Request.Files["alter1file"] != null && Request.Files["alter1file"].ContentLength > 0) { obj.LargePicture = SaveImg(Request.Files["alter1file"], "width:690,Height:290,Length:300"); if (rsPic.Keys.Contains("error")) { ViewData["tip"] = new HtmlString("<script>alert('" + rsPic["error"] + "')</script>"); return(rsPic["error"]); } } else { if (string.IsNullOrEmpty(obj.LargePicture)) { obj.LargePicture = ""; } } #endregion if (obj.AlterPicId == 0) { var ser = service.HeavyRow(linkname, groupId); if (ser.Count() > 0) { if (ser.ElementAt(0).AlterPicId != obj.AlterPicId) { return("2"); } } //调用排重方法 var row = service.HeavyRow(linkname, groupId); if (row.Count() > 0) { return("2"); } obj.LinkName = Request.Form["LinkName"]; //添加 return(service.Alterinsert(obj) > 0 ? "1" : "0"); } else { obj.LinkName = Request.Form["LinkName"]; //修改 return(service.AlterUpdate(obj) ? "1" : "0"); } }
//图片修改 public bool AlterUpdate(SWfsListAlterPic obj) { return(DapperUtil.Update <SWfsListAlterPic>(obj)); }
//图片添加 public int Alterinsert(SWfsListAlterPic obj) { return(DapperUtil.Insert <SWfsListAlterPic>(obj, true)); }