public int Update(CostUnit_Info data) { using (var db = new DBExecutor().GetDatabase()) { return(db.Update(data)); } }
public int Update(long CostUnitId, CostUnit_Info data, IEnumerable <string> columns) { using (var db = new DBExecutor().GetDatabase()) { return(db.Update(data, CostUnitId, columns)); } }
private void checkUploadfiles(CostUnit_Info NewData, CostUnit_Info OldData) { if (OldData == null) { OldData = new CostUnit_Info(); } string Prefix = string.Empty; Prefix = "CostUnitImage1"; 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 = "CostUnitImage2"; 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 = "CostUnitImage3"; 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 long Insert(CostUnit_Info data) { 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 long Insert(CostUnit_Info data) { long newID = 0; try { newID = new CostUnit_Repo().Insert(data); } catch (Exception ex) { log.Exception(ex); } return(newID); }
public JsonResult SaveCostUnit(CostUnit_Info data) { ResultBase result = new ResultBase(); result.setMessage("Done"); if (data.IsActive == 1) { //審核專用 var verdata = CostUnitman.GetBySN(data.CostUnitId); verdata.IsActive = 1; verdata.VerifiedDate = DateTime.Now; CostUnitman.Update(verdata); return(Json(result, JsonRequestBehavior.DenyGet)); } else { //一但有任何異動,自動下架 data.IsActive = 0; } //限制只能修改該單元之資料 data.DeptName = getDeptName(sessionData.trading.Dept.Value); data.CostId = sessionData.trading.CostId; if (string.IsNullOrEmpty(data.UnitName)) { result.setErrorMessage("單元名稱不得為空白"); } if (string.IsNullOrEmpty(data.ContentBody) && data.IsHomePage == 0) { result.setErrorMessage("內容不得為空白"); } if (result.JsonReturnCode > -1) { data.LastUpdate = DateTime.Now; data.LastUpdator = sessionData.trading.LoginId; var olddata = CostUnitman.GetBySN(data.CostUnitId); checkUploadfiles(data, olddata); if (data.CostUnitId > 0) { CostUnitman.Update(data); result.setMessage(data.CostUnitId.ToString()); } else { var newId = CostUnitman.Insert(data); result.setMessage(newId.ToString()); } } return(Json(result, JsonRequestBehavior.DenyGet)); }
public bool Update(CostUnit_Info data) { return(new CostUnit_Repo().Update(data) > 0); }
public bool Update(long CostUnitId, CostUnit_Info data, IEnumerable <string> columns) { return(new CostUnit_Repo().Update(CostUnitId, data, columns) > 0); }