Exemplo n.º 1
0
    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();
    }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
    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();
    }
Exemplo n.º 4
0
    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();
    }
Exemplo n.º 5
0
    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();
    }
Exemplo n.º 6
0
 public static void DeleteMaster(SysCodeMaster entity)
 {
     CodeDataAccess.DeleteMaster(entity);
 }
Exemplo n.º 7
0
 public static void UpdateMaster(SysCodeMaster entity)
 {
     CodeDataAccess.UpdateMaster(entity);
 }
Exemplo n.º 8
0
 public static void InsertMaster(SysCodeMaster entity)
 {
     CodeDataAccess.InsertMaster(entity);
 }
Exemplo n.º 9
0
 public static void UpdateMaster(SysCodeMaster entity)
 {
     SqlHelper.Update(Config.ConnectionString, entity);
 }
Exemplo n.º 10
0
 public static void InsertMaster(SysCodeMaster entity)
 {
     SqlHelper.Insert(Config.ConnectionString, entity);
 }