public bool InsertCategoryValue(CategoryValueModel model) { try { if (model == null) { return(false); } using (var db = new PORTALEntities()) { var item = new SysCategoryValue() { ID = Guid.NewGuid(), Name = model.Name, Dictionary = model.Dictionary, Sequence = model.Sequence, Actived = model.Actived, Category = model.Category, ParentID = model.ParentID, Remark = model.RemarkValue, CreateDate = model.CreateDate, CreateUid = model.CreateUID, SubCode = model.SubCode }; db.SysCategoryValues.Add(item); db.SaveChanges(); return(true); } } catch (Exception ex) { LogHelper.Error("CategoryRepository InsertCategoryValue: " + ex.Message + " Inner exception: " + ex.InnerException.Message); return(false); } }
public bool DeleteCategoryValue(CategoryValueModel model) { try { if (model == null) { return(false); } using (var db = new PORTALEntities()) { var item = (from c in db.SysCategoryValues where c.ID == model.ID select c).FirstOrDefault(); if (item == null) { return(false); } item.IsDelete = true; item.DeleteDate = model.DeleteDate; item.DeleteUid = model.DeleteUID; db.SaveChanges(); return(true); } } catch (Exception ex) { LogHelper.Error("CategoryRepository DeleteCategoryValue: " + ex.Message + " Inner exception: " + ex.InnerException.Message); return(false); } }
public JsonResult UpdateCategoryValue(CategoryValueModel model) { model.ModifyDate = DateTime.Now; model.ModifyUID = User.GetClaimValue(ClaimTypes.Sid); var result = res.UpdateCategoryValue(model); return(Json(result ? new { result = "OK" } : new { result = "Error" })); }
public JsonResult InsertCategoryValue(CategoryValueModel model) { model.CreateDate = DateTime.Now; model.CreateUID = User.GetClaimValue(ClaimTypes.Sid); var result = res.InsertCategoryValue(model); return(Json(result ? new { result = "OK" } : new { result = "Error" })); }
public string CheckExistCateValue(CategoryValueModel model) { if (model == null) { return("Model is null"); } return(res.CheckExistCateValue(model.Category.ToString(), model.Name) ? "Name is exists!" : "OK"); }
public ActionResult ShowModalCreateCategoryValue(string id) { var model = new CategoryValueModel() { Category = new Guid(id) }; return(PartialView("CreateCategoryValue", model)); }
public JsonResult DeleteCategoryValue(string id) { var model = new CategoryValueModel { ID = new Guid(id), DeleteDate = DateTime.Now, DeleteUID = User.GetClaimValue(ClaimTypes.Sid) }; var result = res.DeleteCategoryValue(model); return(Json(result ? new { result = "OK" } : new { result = "Error" })); }
public static List <CategoryValueModel> GetCategoryValue(string catId) { List <CategoryValueModel> result = new List <CategoryValueModel>(); CategoryAccess access = new CategoryAccess(); DataTable dtResult = access.SP_CATEGORY_VALUE_QRY(catId); foreach (DataRow dtr in dtResult.Rows) { CategoryValueModel item = new CategoryValueModel { CAT_VALUE_ID = dtr["CAT_VALUE_ID"].ToString(), CAT_CODE = dtr["CAT_CODE"].ToString(), CAT_VALUE = dtr["CAT_VALUE"].ToString(), CATEGORY_ID = dtr["CATEGORY_ID"].ToString(), SEQ = dtr["SEQ"].ToString(), DICTIONARY_ID = dtr["DICTIONARY_ID"].ToString(), MOTHER_ID = dtr["MOTHER_ID"].ToString(), MOTHER_NAME = dtr["MOTHER_NAME"].ToString(), IS_ACTIVE = dtr["IS_ACTIVE"].ToString() == "1", ORDERINDEX = dtr["ORDERINDEX"].ToString(), ISEDIT = dtr["ISEDIT"].ToString() == "1", CREATE_UID = dtr["CREATE_UID"].ToString(), UPDATE_UID = dtr["UPDATE_UID"].ToString(), SUBCODE = dtr["SUBCODE"].ToString(), IS_ACTIVE2 = dtr["IS_ACTIVE2"].ToString(), DICTIONARY_ID2 = dtr["DICTIONARY_ID2"].ToString(), }; if (!string.IsNullOrEmpty(dtr["CREATE_DT"].ToString())) { item.CREATE_DT = DateTime.Parse(dtr["CREATE_DT"].ToString()); } if (!string.IsNullOrEmpty(dtr["UPDATE_DT"].ToString())) { item.UPDATE_DT = DateTime.Parse(dtr["UPDATE_DT"].ToString()); } result.Add(item); } return(result); }
public bool UpdateCategoryValue(CategoryValueModel model) { try { if (model == null) { return(false); } using (var db = new PORTALEntities()) { var item = (from c in db.SysCategoryValues where c.ID == model.ID select c).FirstOrDefault(); if (item == null) { return(false); } item.Name = model.Name; item.Dictionary = model.Dictionary; item.Sequence = model.Sequence; item.Actived = model.Actived; item.Category = model.Category; item.ParentID = model.ParentID; item.Remark = model.RemarkValue; item.UpdateDate = model.ModifyDate; item.UpdateUid = model.ModifyUID; item.SubCode = model.SubCode; db.SaveChanges(); return(true); } } catch (Exception ex) { LogHelper.Error("CategoryRepository UpdateCategoryValue: " + ex.Message + " Inner exception: " + ex.InnerException.Message); return(false); } }