Beispiel #1
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        terms       n   = new terms();
        GridViewRow gvr = GridView1.Rows[e.RowIndex];

        n.Term = GridView1.DataKeys[e.RowIndex].Value.ToString();         //获取当前行主键id
        tm.Delete(n);
        gridviewBind();
    }
Beispiel #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        terms n = new terms();

        n.Term    = TextBox1.Text.Trim();
        n.Creater = Session["adminId"].ToString();
        tm.Insert(n);
        gridviewBind();
        ScriptManager.RegisterStartupScript(this, this.GetType(), "updateScript", "alert(\"新增成功\");", true);
    }
Beispiel #3
0
        /// <summary>
        /// 删除学期
        /// </summary>
        /// <param name="n">学期实体类</param>
        /// <returns></returns>
        public bool Delete(terms n)
        {
            bool flag = false;

            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@term", n.Term),
            };
            int res = sqlhelper.ExecuteNonQuery("DELETE FROM terms where term=@term", paras, CommandType.Text);

            if (res > 0)
            {
                flag = true;
            }
            return(flag);
        }
Beispiel #4
0
        /// <summary>
        /// 新增学期
        /// </summary>
        /// <param name="n">学期实体类</param>
        /// <returns></returns>
        public bool Insert(terms n)
        {
            bool flag = false;

            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@term", n.Term),
                new SqlParameter("@creater", n.Creater),
                new SqlParameter("@modifier", n.Creater),
            };
            int res = sqlhelper.ExecuteNonQuery("INSERT INTO terms (term, creater, modifier) VALUES (@term,@creater,@modifier)", paras, CommandType.Text);

            if (res > 0)
            {
                flag = true;
            }
            return(flag);
        }
 /// <summary>
 /// 删除学期
 /// </summary>
 /// <param name="n">学期实体类</param>
 /// <returns></returns>
 public bool Delete(terms n)
 {
     return(ndao.Delete(n));
 }
 /// <summary>
 /// 新增学期
 /// </summary>
 /// <param name="n">学期实体类</param>
 /// <returns></returns>
 public bool Insert(terms n)
 {
     return(ndao.Insert(n));
 }