private void DoAddNew(Control button) { Control _temp = button.NamingContainer; string main_key = (_temp.FindControl("textbox_main_key") as TextBox).Text.Trim(); string desc = (_temp.FindControl("textbox_description") as TextBox).Text.Trim(); if (string.IsNullOrEmpty(main_key)) { ScriptHelper.AjaxAlertFocus(this.UpdatePanel1, "please input main_key.", _temp.FindControl("textbox_main_key")); return; } if (string.IsNullOrEmpty(desc)) { ScriptHelper.AjaxAlertFocus(this.UpdatePanel1, "please input description", _temp.FindControl("textbox_description")); return; } SysCodeMaster entity = new SysCodeMaster(); entity.MainKey = main_key; entity.Description = desc; CodeBiz.InsertMaster(entity); this.LoadData(); }
public static void DeleteMaster(SysCodeMaster entity) { SqlConnection conn = new SqlConnection(Config.ConnectionString); conn.Open(); try { SqlTransaction trans = conn.BeginTransaction(); try { SqlHelper.DeleteTable <SysCodeList>(trans, ColumnFilterList.New("main_key", entity.MainKey)); SqlHelper.Delete(trans, entity); trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw ex; } } finally { conn.Close(); } }
private void DoDelete(Control button) { Control _temp = button.NamingContainer; string main_key = (_temp.FindControl("hidden_main_key") as HtmlInputHidden).Value; SysCodeMaster entity = new SysCodeMaster(main_key); CodeBiz.DeleteMaster(entity); this.LoadData(); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { string main_key = Request["main_key"]; if (string.IsNullOrEmpty(main_key)) { this.Response.End(); return; } this.ViewState["main_key"] = main_key; SysCodeMaster master = CodeBiz.GetMaster(main_key); this.label_main_key.Text = main_key; this.label_main_description.Text = master.Description; } this.LoadData(); }
private void DoUpdate(Control button) { Control _temp = button.NamingContainer; string main_key = (_temp.FindControl("hidden_main_key") as HtmlInputHidden).Value.Trim(); string desc = (_temp.FindControl("textbox_description") as TextBox).Text.Trim(); if (string.IsNullOrEmpty(desc)) { ScriptHelper.AjaxAlert(this.UpdatePanel1, "please input description"); return; } SysCodeMaster entity = new SysCodeMaster(main_key); entity.Description = desc; CodeBiz.UpdateMaster(entity); this.LoadData(); this.GridView1.EditIndex = -1; this.GridView1.DataBind(); }
public static void DeleteMaster(SysCodeMaster entity) { CodeDataAccess.DeleteMaster(entity); }
public static void UpdateMaster(SysCodeMaster entity) { CodeDataAccess.UpdateMaster(entity); }
public static void InsertMaster(SysCodeMaster entity) { CodeDataAccess.InsertMaster(entity); }
public static void UpdateMaster(SysCodeMaster entity) { SqlHelper.Update(Config.ConnectionString, entity); }
public static void InsertMaster(SysCodeMaster entity) { SqlHelper.Insert(Config.ConnectionString, entity); }