protected void gvTagCategory_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     M_TagCategory model = new M_TagCategory();
     int tagCategoryId = (int)gvTagCategory.DataKeys[e.RowIndex].Value;
     TextBox txtName = gvTagCategory.Rows[e.RowIndex].FindControl("txtName") as TextBox;
     string name = txtName.Text.Trim();
     TextBox txtDesc = gvTagCategory.Rows[e.RowIndex].FindControl("txtDesc") as TextBox;
     string desc = txtDesc.Text.Trim();
     if(name.Length==0||name.Length>20)
     {
         LitMsg.Text = "<script type='text/javascript'>alert('Tag类别名称必须填写');</script>";
         return;
     }
     if(desc.Length>100)
     {
         LitMsg.Text = "<script type='text/javascript'>alert('Tag类别描述不能超过100个字');</script>";
         return;
     }
     model.TagCategoryId = tagCategoryId;
     model.Name = name;
     model.Desc = desc;
     Bll.Update(model);
     gvTagCategory.EditIndex = -1;
     Bind();
 }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        M_TagCategory model = new M_TagCategory();
        int tagCategoryId = 0;
        string name = txtName.Text.Trim();
        string desc = txtDesc.Text.Trim();
        if (name.Length == 0 || name.Length > 20)
        {
            LitMsg.Text = "<script type='text/javascript'>alert('Tag类别名称必须填写');</script>";
            return;
        }
        if (desc.Length > 100)
        {
            LitMsg.Text = "<script type='text/javascript'>alert('Tag类别描述不能超过100个字');</script>";
            return;
        }
        model.TagCategoryId = tagCategoryId;
        model.Name = name;
        model.Desc = desc;
        Bll.Add(model);

        txtName.Text = "";
        txtDesc.Text = "";
        gvTagCategory.EditIndex = -1;
        Bind();
    }
Exemple #3
0
 public void Update(M_TagCategory model)
 {
     if (model.TagCategoryId > 0)
     {
         this.dal.Update(model);
     }
 }
Exemple #4
0
 public void Update(M_TagCategory model)
 {
     this.Add(model);
 }
Exemple #5
0
 public void Add(M_TagCategory model)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@TagCategoryId", model.TagCategoryId), new SqlParameter("@Name", model.Name), new SqlParameter("@Desc", model.Desc) };
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_TagCategory_Set", commandParameters);
 }
Exemple #6
0
 public void Add(M_TagCategory model)
 {
     this.dal.Add(model);
 }