Beispiel #1
0
        /// <summary>
        ///[To_Post]表添加的方法
        /// </summary>
        public static int addTo_Post(To_Post to_post)
        {
            string sql = "insert into To_Post([postname]) values (@postname)";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@postname", to_post.Postname)
            };
            return(DBHelper.ExecuteCommand(sql, sp));
        }
Beispiel #2
0
        /// <summary>
        ///[To_Post]表修改的方法
        /// </summary>
        public static int updateTo_PostById(To_Post to_post)
        {
            string sql = "update To_Post set postname=@postname where id=@id";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@id", to_post.Id),
                new SqlParameter("@postname", to_post.Postname)
            };
            return(DBHelper.ExecuteCommand(sql, sp));
        }
Beispiel #3
0
        /// <summary>
        ///根据SQL语句获取实体
        /// </summary>
        public static To_Post getTo_PostBySql(string sql)
        {
            To_Post   to_post = null;
            DataTable dt      = DBHelper.GetDataSet(sql);

            if (dt.Rows.Count > 0)
            {
                to_post = new To_Post();
                foreach (DataRow dr in dt.Rows)
                {
                    to_post.Id       = Convert.ToInt32(dr["id"]);
                    to_post.Postname = Convert.ToString(dr["postname"]);
                }
            }
            return(to_post);
        }
Beispiel #4
0
        /// <summary>
        ///根据SQL语句获取集合
        /// </summary>
        public static IList <To_Post> getTo_PostsBySql(string sql)
        {
            IList <To_Post> list = new List <To_Post>();
            DataTable       dt   = DBHelper.GetDataSet(sql);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    To_Post to_post = new To_Post();
                    to_post.Id       = Convert.ToInt32(dr["id"]);
                    to_post.Postname = Convert.ToString(dr["postname"]);
                    list.Add(to_post);
                }
            }
            return(list);
        }
        protected void imgbtnsave_Click(object sender, ImageClickEventArgs e)
        {
            if (tbxTypeName.Text.ToString() == "")
            {
                this.lblTypename.Text = "<span style='Color:red'>岗位名称不能为空!<span>";
            }
            else if (Checktypename(tbxTypeName.Text.ToString()) > 0)
            {
                this.lblTypename.Text = "<span style='Color:red'>岗位名称已存在<span>";
            }
            else
            {
                To_Post post = new To_Post();
                post.Postname = this.tbxTypeName.Text.ToString();

                To_PostManager.addTo_Post(post);
                getAddPost();
                this.tbxTypeName.Text = "";
                this.lblTypename.Text = "";
            }
        }
Beispiel #6
0
        /// <summary>
        ///[To_Post]表查询实体的方法
        /// </summary>
        public static To_Post getTo_PostById(int id)
        {
            To_Post to_post = null;

            string sql = "select * from To_Post where id=@id";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@id", id)
            };
            DataTable dt = DBHelper.GetDataSet(sql, sp);

            if (dt.Rows.Count > 0)
            {
                to_post = new To_Post();
                foreach (DataRow dr in dt.Rows)
                {
                    to_post.Id       = Convert.ToInt32(dr["id"]);
                    to_post.Postname = Convert.ToString(dr["postname"]);
                }
            }

            return(to_post);
        }
Beispiel #7
0
 public static int addTo_Post(To_Post to_post)
 {
     return(To_PostService.addTo_Post(to_post));
 }
Beispiel #8
0
 public static int updateTo_Post(To_Post to_post)
 {
     return(To_PostService.updateTo_PostById(to_post));
 }