Пример #1
0
        public int Insert(Model.procate model)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("insert into procate ");

            sql.Append(" values (");

            sql.Append("@catename,@fathercateid");

            sql.Append(")");

            SqlParameter[] par =
            {
                new SqlParameter("@catename",     SqlDbType.VarChar, 50),
                new SqlParameter("@fathercateid", SqlDbType.Int,      4),
            };


            par[0].Value = model.catename;
            par[1].Value = model.fathercateid;



            return(Common.DbHelperSQL.ExecuteSql(sql.ToString(), par));
        }
Пример #2
0
        public int insert(Model.procate model1)
        {
            DAL.procate dal    = new DAL.procate();
            int         result = dal.Insert(model1);

            return(result);
        }
Пример #3
0
        //通过产品类别id获取产品类别
        public Model.procate findProcateById(int _cateid)
        {
            DAL.procate   dal   = new DAL.procate();
            Model.procate pcate = new Model.procate();
            DataTable     da    = dal.findCateById(_cateid);

            if (da.Rows.Count > 0)
            {
                LoadEntity(da.Rows[0], pcate);
            }
            return(pcate);
        }
Пример #4
0
        public int update(Model.procate mym)
        {
            string sql = "update procate set _catename='" + mym.catename + "', _fathercateid=" + mym.fathercateid + " where _cateid=" + mym.cateid + "";

            return(Convert.ToInt32(Common.DB.ExecuteSql(sql)));
        }
Пример #5
0
 //LoadEntity
 private void LoadEntity(DataRow row, Model.procate cate)
 {
     cate.cateid       = Convert.ToInt16(row["_cateid"]);
     cate.catename     = row["_catename"].ToString();
     cate.fathercateid = Convert.ToInt16(row["_fathercateid"]);
 }
Пример #6
0
 public int update(Model.procate mym)
 {
     DAL.procate dal = new DAL.procate();
     return(dal.update(mym));
 }