private void InitForModify() { SettingCategoryInfo dataById = SettingCategory.GetDataById(base.OpID); this.TextBox1.Text = dataById.CateName; this.TextBox2.Text = dataById.CateDesc; }
protected void btnok_Click(object sender, System.EventArgs e) { if (base.Action.Equals(ActionType.Add.ToString()) && !base.IsAuthorizedOp(ActionType.Add.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else if (base.Action.Equals(ActionType.Modify.ToString()) && !base.IsAuthorizedOp(ActionType.Modify.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else { SettingCategoryInfo settingCategoryInfo = new SettingCategoryInfo(); if (base.IsEdit) { settingCategoryInfo = SettingCategory.GetDataById(base.OpID); } settingCategoryInfo.CateName = WebUtils.GetString(this.TextBox1.Text); settingCategoryInfo.CateDesc = WebUtils.GetString(this.TextBox2.Text); settingCategoryInfo.IsUsing = true; settingCategoryInfo.AutoTimeStamp = System.DateTime.Now; if (string.IsNullOrEmpty(settingCategoryInfo.CateName)) { base.ShowMsg("Tên loại Cấu hình không thể để trống"); } else if (string.IsNullOrEmpty(settingCategoryInfo.CateDesc)) { base.ShowMsg("Tên hiển thị không thể để trống"); } else { if (base.Action.Equals(ActionType.Add.ToString())) { if (SettingCategory.Add(settingCategoryInfo) > 0) { CacheUtils.Del("JsonLeeCMS_CacheForGetSettingCategory"); PageBase.log.AddEvent(base.LoginAccount.AccountName, "Thêm cấu hình tùy chỉnh [" + settingCategoryInfo.CateDesc + "] thành công"); MessageUtils.DialogCloseAndParentReload(this); } else { base.ShowMsg("Thêm cấu hình tùy chỉnh thất bại"); } } if (base.Action.Equals(ActionType.Modify.ToString())) { if (SettingCategory.Update(settingCategoryInfo)) { CacheUtils.Del("JsonLeeCMS_CacheForGetSettingCategory"); PageBase.log.AddEvent(base.LoginAccount.AccountName, "Sửa đổi các cấu hình tùy chỉnh [" + settingCategoryInfo.CateDesc + "] thành công"); MessageUtils.DialogCloseAndParentReload(this); } else { base.ShowMsg("Sửa đổi các cấu hình tùy chỉnh thất bại"); } } } } }
protected void lnk_Delete_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp(ActionType.Delete.ToString())) { base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền"); } else { int @int = WebUtils.GetInt((sender as LinkButton).CommandArgument); SettingCategoryInfo cacheSettingCategory = SettingCategory.GetCacheSettingCategory(@int); if (cacheSettingCategory == null) { base.ShowAjaxMsg(this.UpdatePanel1, "Không tìm thấy dữ liệu, dữ liệu không tồn tại hoặc đã bị xóa "); } else if (SettingCategory.ExistsChildSetting(cacheSettingCategory.AutoID)) { base.ShowAjaxMsg(this.UpdatePanel1, "Không thể bị xóa, bao gồm các thiết lập tùy chỉnh"); } else if (SettingCategory.Delete(cacheSettingCategory.AutoID)) { CacheUtils.Del("JsonLeeCMS_CacheForGetSettingCategory"); this.BindData(); PageBase.log.AddEvent(base.LoginAccount.AccountName, "Xóa các thiết lập tùy chỉnh [" + cacheSettingCategory.CateName + "] thành công"); base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công"); } else { base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại"); } } }
protected void Page_Load(object sender, System.EventArgs e) { this.cate = SettingCategory.GetDataById(WebUtils.GetQueryInt("cateid")); if (!base.IsPostBack) { this.BindData(); } }
protected void Page_Load(object sender, System.EventArgs e) { this.cate = SettingCategory.GetCacheSettingCategory(WebUtils.GetQueryInt("cateid")); if (this.cate == null) { base.ShowMsg("Không tìm thấy cấu hình này, cấu hình không tồn tại hoặc đã bị xóa"); } else if (!base.IsPostBack) { this.BindData(); } }
public static int Add(SettingCategoryInfo entity) { int result; if (entity == null) { result = 0; } else { result = BizBase.dbo.InsertModel <SettingCategoryInfo>(entity); } return(result); }
public static bool Update(SettingCategoryInfo entity) { return(entity != null && BizBase.dbo.UpdateModel <SettingCategoryInfo>(entity)); }