public int Update(AboutContent_Info data) { using (var db = new DBExecutor().GetDatabase()) { return(db.Update(data)); } }
private void checkUploadfiles(AboutContent_Info NewData, AboutContent_Info OldData) { string Prefix = string.Empty; Prefix = "ContentImage1"; if (sessionData.trading.UploadFiles.Keys.Contains(Prefix)) { if (string.Compare("DELETE", sessionData.trading.UploadFiles[Prefix], true) == 0) { NewData.Image1 = string.Empty; } else { NewData.Image1 = CopyFile(sessionData.trading.UploadFiles[Prefix]); } } else { NewData.Image1 = OldData.Image1; } Prefix = "ContentImage2"; if (sessionData.trading.UploadFiles.Keys.Contains(Prefix)) { if (string.Compare("DELETE", sessionData.trading.UploadFiles[Prefix], true) == 0) { NewData.Image2 = string.Empty; } else { NewData.Image2 = CopyFile(sessionData.trading.UploadFiles[Prefix]); } } else { NewData.Image2 = OldData.Image2; } Prefix = "ContentImage3"; if (sessionData.trading.UploadFiles.Keys.Contains(Prefix)) { if (string.Compare("DELETE", sessionData.trading.UploadFiles[Prefix], true) == 0) { NewData.Image3 = string.Empty; } else { NewData.Image3 = CopyFile(sessionData.trading.UploadFiles[Prefix]); } } else { NewData.Image3 = OldData.Image3; } }
public int Update(long AboutContentId, AboutContent_Info data, IEnumerable <string> columns) { if (data.AboutCategoryId.Value == 0) { data.AboutCategoryId = null; } using (var db = new DBExecutor().GetDatabase()) { return(db.Update(data, AboutContentId, columns)); } }
public JsonResult SaveAboutContent(AboutContent_Info data) { ResultBase result = new ResultBase(); result.setMessage("Done"); if (data.IsActive == 1) { //審核專用 var verdata = AboutContMan.GetBySN(data.AboutContentId); verdata.IsActive = 1; verdata.VerifiedDate = DateTime.Now; AboutContMan.Update(verdata); return(Json(result, JsonRequestBehavior.DenyGet)); } else { //一但有任何異動,自動下架 data.IsActive = 0; } //check is there are any data under the categoary. if (data.UnitName == null || data.UnitName.Trim().Length == 0) { result.setErrorMessage("單元名稱不得為空白"); } if (data.AboutId == 0) { result.setErrorMessage("類別為必選"); } if (result.JsonReturnCode > -1) { data.LastUpdate = DateTime.Now; data.LastUpdator = sessionData.trading.LoginId; if (data.AboutContentId > 0) { var olddata = AboutContMan.GetBySN(data.AboutContentId); checkUploadfiles(data, olddata); AboutContMan.Update(data); } else { checkUploadfiles(data, new AboutContent_Info() { }); AboutContMan.Insert(data); } } return(Json(result, JsonRequestBehavior.DenyGet)); }
public long Insert(AboutContent_Info data) { long newID = 0; try { newID = new AboutContent_Repo().Insert(data); } catch (Exception ex) { log.Exception(ex); } return(newID); }
public long Insert(AboutContent_Info data) { if (data.AboutCategoryId.HasValue && data.AboutCategoryId.Value == 0) { data.AboutCategoryId = null; } using (var db = new DBExecutor().GetDatabase()) { long NewID = 0; var result = db.Insert(data); if (result != null) { long.TryParse(result.ToString(), out NewID); } return(NewID); } }
public bool Update(AboutContent_Info data) { return(new AboutContent_Repo().Update(data) > 0); }
public bool Update(long AboutContentId, AboutContent_Info data, IEnumerable <string> columns) { return(new AboutContent_Repo().Update(AboutContentId, data, columns) > 0); }