示例#1
0
文件: RoleDao.cs 项目: pjjwpc/T
        public int Delete(Role Role_Code)
        {
            DBHelper db = new DBHelper();
            DbCommand cmd = db.GetSqlStringCommand("DELETE FROM Role WHERE Role_Code = '" + Role_Code.Role_Code+"'");

            return db.ExecuteNonQuery(cmd);
        }
示例#2
0
文件: BmDao.cs 项目: pjjwpc/T
        public int Delete(Model.BM_COMMON t,Trans trans)
        {
            DBHelper db = new DBHelper();
            DbCommand cmd = db.GetSqlStringCommand("DELETE FROM BM_COMMON WHERE bg_id = " + t.bg_id);

            return db.ExecuteNonQuery(cmd,trans);
        }
示例#3
0
文件: RoleDao.cs 项目: pjjwpc/T
 public Role GetById(object id)
 {
     DBHelper db = new DBHelper();
     DbCommand cmd = db.GetSqlStringCommand("select * from Role where Role_Code='"+id.ToString()+"'");
     DataTable dt = db.ExecuteDataTable(cmd);
     foreach (DataRow dataRow in dt.Rows)
     {
         return this.DataRowToBean(dataRow);
     }
     return null;
 }
示例#4
0
文件: BmDao.cs 项目: pjjwpc/T
 public Model.BM_COMMON GetById(object id)
 {
     string sql = "select * from BM_COMMON where bg_id='"+id.ToString()+"'";
     DBHelper db=new DBHelper();
     DbCommand cmd = db.GetSqlStringCommand(sql);
     DataTable dt = db.ExecuteDataTable(cmd);
     foreach (DataRow row in dt.Rows)
     {
         return this.DataRowToBean(row);
     }
     return null;
 }
示例#5
0
文件: RoleDao.cs 项目: pjjwpc/T
 public IQueryable<Role> GetAll()
 {
     IList<Role> list=new List<Role>();
     DBHelper db = new DBHelper();
     DbCommand cmd = db.GetSqlStringCommand("select * from Role");
     DataTable dt = db.ExecuteDataTable(cmd);
     foreach (DataRow dataRow in dt.Rows)
     {
         list.Add(this.DataRowToBean(dataRow));
     }
     return list.AsQueryable();
 }
示例#6
0
文件: BmDao.cs 项目: pjjwpc/T
 public IQueryable<Model.BM_COMMON> GetAll()
 {
     IList<BM_COMMON> list=new List<BM_COMMON>();
     string sql = "select * from BM_COMMON ";
     DBHelper db = new DBHelper();
     DbCommand cmd = db.GetSqlStringCommand(sql);
     DataTable dt = db.ExecuteDataTable(cmd);
     foreach (DataRow row in dt.Rows)
     {
          list.Add(this.DataRowToBean(row));
     }
     return list.AsQueryable();
 }
示例#7
0
文件: BmDao.cs 项目: pjjwpc/T
        public PageBean<BM_COMMON> GetPageList(int pageIndex, int pageSize, string sqlWhere, string order)
        {
            PageBean<BM_COMMON> pageBean = new PageBean<BM_COMMON>();

            IList<BM_COMMON> list = new List<BM_COMMON>();

            DBHelper db = new DBHelper();
            string strSql = "select * from (select * ,ROW_NUMBER() over(order by " + order + ") num from Message where " + sqlWhere + ") Tabl where num BETWEEN " + (pageIndex - 1) * pageSize + " and " + (pageSize) * (pageIndex);
            DbCommand cmd = db.GetSqlStringCommand(strSql);

            DataTable dt = db.ExecuteDataTable(cmd);
            foreach (DataRow row in dt.Rows)
            {
                BM_COMMON ht = this.DataRowToBean(row);

                list.Add(ht);
            }

            pageBean.rows = list;
            pageBean.total = this.SelectCOMMONBeanPageCount(sqlWhere);

            return pageBean;
        }
示例#8
0
文件: BmDao.cs 项目: pjjwpc/T
        public int Update(Model.BM_COMMON t,Trans trans)
        {
            DBHelper db = new DBHelper();
            DbCommand cmd = db.GetStoredProcCommand("p_BM_COMMON_update");
            db.AddInParameter(cmd, "@bg_id", DbType.Int32, t.bg_id);
            db.AddInParameter(cmd, "@bg_lx", DbType.String, t.bg_lx);
            db.AddInParameter(cmd, "@bg_lxmc", DbType.String, t.bg_lxmc);
            db.AddInParameter(cmd, "@bg_bm", DbType.String, t.bg_bm);
            db.AddInParameter(cmd, "@bg_mc", DbType.String, t.bg_mc);
            db.AddInParameter(cmd, "@bg_pysx", DbType.String, t.bg_pysx);
            db.AddInParameter(cmd, "@bg_xh", DbType.Int32, t.bg_xh);
            db.AddInParameter(cmd, "@bg_bz", DbType.String, t.bg_bz);

            return db.ExecuteNonQuery(cmd,trans);
        }
示例#9
0
文件: BmDao.cs 项目: pjjwpc/T
        public int SelectCOMMONBeanPageCount(string searchCondition)
        {
            DBHelper db = new DBHelper();
            DbCommand cmd = db.GetSqlStringCommand("select count(*) from BM_COMMON where " + searchCondition);

            return Convert.ToInt32(db.ExecuteScalar(cmd));
        }
示例#10
0
文件: BmDao.cs 项目: pjjwpc/T
        public IQueryable<BM_COMMON> SearchFor(string sqlWhere)
        {
            IList<BM_COMMON> list = new List<BM_COMMON>();
            DBHelper db = new DBHelper();
            DbCommand cmd = db.GetSqlStringCommand("SELECT * FROM BM_COMMON where 1=1 and " + sqlWhere);
            DataTable dt = db.ExecuteDataTable(cmd);
            foreach (DataRow row in dt.Rows)
            {
                list.Add(this.DataRowToBean(row));
            }

            return list.AsQueryable();
        }
示例#11
0
文件: BmDao.cs 项目: pjjwpc/T
        public int Save(Model.BM_COMMON t,Trans trans)
        {
            DBHelper db = new DBHelper();
            DbCommand cmd = db.GetStoredProcCommand("p_BM_COMMON_insert");//返回主键
            db.AddInParameter(cmd, "@bg_lx", DbType.String, t.bg_lx);
            db.AddInParameter(cmd, "@bg_lxmc", DbType.String, t.bg_lxmc);
            db.AddInParameter(cmd, "@bg_bm", DbType.String, t.bg_bm);
            db.AddInParameter(cmd, "@bg_mc", DbType.String, t.bg_mc);
            db.AddInParameter(cmd, "@bg_pysx", DbType.String, t.bg_pysx);
            db.AddInParameter(cmd, "@bg_xh", DbType.Int32, t.bg_xh);
            db.AddInParameter(cmd, "@bg_bz", DbType.String, t.bg_bz);

            object res = db.ExecuteScalar(cmd,trans);

            return res == null ? -1 : Convert.ToInt32(res);
        }
示例#12
0
文件: RoleDao.cs 项目: pjjwpc/T
        public int Update(Role Role)
        {
            DBHelper db = new DBHelper();
            DbCommand cmd = db.GetStoredProcCommand("p_Role_update");
            db.AddInParameter(cmd, "@Role_Code", DbType.Guid, Role.Role_Code);
            db.AddInParameter(cmd, "@Role_Name", DbType.String, Role.Role_Name);
            db.AddInParameter(cmd, "@DES", DbType.String, Role.DES);

            return db.ExecuteNonQuery(cmd);
        }
示例#13
0
文件: RoleDao.cs 项目: pjjwpc/T
        public Role SelectRole(string Role_Code)
        {
            DBHelper db = new DBHelper();
            DbCommand cmd = db.GetSqlStringCommand("SELECT * FROM Role WHERE Role_Code = " + Role_Code);
            DataTable dt = db.ExecuteDataTable(cmd);
            foreach (DataRow row in dt.Rows)
            {
                return this.DataRowToBean(row);
            }

            return null;
        }
示例#14
0
文件: RoleDao.cs 项目: pjjwpc/T
        public int Save(Role Role)
        {
            DBHelper db = new DBHelper();
            DbCommand cmd = db.GetStoredProcCommand("p_Role_insert");//返回主键
            db.AddInParameter(cmd, "@Role_Name", DbType.String, Role.Role_Name);
            db.AddInParameter(cmd, "@DES", DbType.String, Role.DES);

            object res = db.ExecuteScalar(cmd);

            return res == null ? -1 :1;
        }