Ejemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool AddSysCountry(Eyousoft_yhq.Model.MSysCountry model)
        {
            string    StrSql = "INSERT INTO tbl_SysCountry(EnName,Zones,CnName) VALUES(@EnName,@Zones,@CnName)";
            DbCommand dc     = this._db.GetSqlStringCommand(StrSql);

            this._db.AddInParameter(dc, "EnName", DbType.String, model.EnName);
            this._db.AddInParameter(dc, "CnName", DbType.String, model.CnName);
            this._db.AddInParameter(dc, "Zones", DbType.Int32, model.Zones);
            return(DbHelper.ExecuteSql(dc, this._db) > 0 ? true : false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateSysCountry(Eyousoft_yhq.Model.MSysCountry model)
        {
            string    StrSql = "UPDATE tbl_SysCountry SET EnName = @EnName,Zones = @Zones,CnName = @CnName WHERE Id=@Id";
            DbCommand dc     = this._db.GetSqlStringCommand(StrSql);

            this._db.AddInParameter(dc, "EnName", DbType.String, model.EnName);
            this._db.AddInParameter(dc, "CnName", DbType.String, model.CnName);
            this._db.AddInParameter(dc, "Zones", DbType.Int32, model.Zones);
            this._db.AddInParameter(dc, "Id", DbType.Int32, model.Id);
            return(DbHelper.ExecuteSql(dc, this._db) > 0 ? true : false);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool UpdateSysCountry(Eyousoft_yhq.Model.MSysCountry model)
 {
     if (model != null && model.Id > 0 && !string.IsNullOrEmpty(model.CnName))
     {
         return(dal.UpdateSysCountry(model));
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 获得数据列表集合,分页
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="recordCount"></param>
        /// <param name="chaXun"></param>
        /// <returns></returns>
        public IList <Eyousoft_yhq.Model.MSysCountry> GetSysCountryList(int pageSize, int pageIndex, ref int recordCount, Eyousoft_yhq.Model.MSysCountry chaXun)
        {
            IList <Eyousoft_yhq.Model.MSysCountry> ResultList = null;
            string tableName          = "tbl_SysCountry";
            string identityColumnName = "Id";
            string fields             = "Id, EnName,Zones,CnName";
            string query = " 1=1 ";

            if (chaXun != null)
            {
                if (chaXun.Zones > 0)
                {
                    query = query + string.Format(" AND Zones={0} ", chaXun.Zones);
                }
                if (!string.IsNullOrEmpty(chaXun.EnName))
                {
                    query = query + string.Format(" AND EnName like '%{0}%'", chaXun.EnName);
                }
                if (!string.IsNullOrEmpty(chaXun.CnName))
                {
                    query = query + string.Format(" AND CnName like '%{0}%'", chaXun.CnName);
                }
            }
            string orderByString = " ID ASC";

            using (IDataReader dr = DbHelper.ExecuteReader1(_db, pageSize, pageIndex, ref recordCount, tableName, identityColumnName, fields, query, orderByString))
            {
                ResultList = new List <Eyousoft_yhq.Model.MSysCountry>();
                while (dr.Read())
                {
                    Eyousoft_yhq.Model.MSysCountry model = new Eyousoft_yhq.Model.MSysCountry()
                    {
                        Id     = dr.GetInt32(dr.GetOrdinal("Id")),
                        EnName = dr.IsDBNull(dr.GetOrdinal("EnName")) ? "" : dr.GetString(dr.GetOrdinal("EnName")),
                        Zones  = dr.GetInt32(dr.GetOrdinal("Zones")),
                        CnName = dr.IsDBNull(dr.GetOrdinal("CnName")) ? "" : dr.GetString(dr.GetOrdinal("CnName"))
                    };
                    ResultList.Add(model);
                    model = null;
                }
            };
            return(ResultList);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获得前几行数据集合
        /// </summary>
        /// <param name="Top">0:所有</param>
        /// <param name="chaXun"></param>
        /// <param name="filedOrder"></param>
        /// <returns></returns>
        public IList <Eyousoft_yhq.Model.MSysCountry> GetSysCountryList(int Top, Eyousoft_yhq.Model.MSysCountry chaXun, string filedOrder)
        {
            IList <Eyousoft_yhq.Model.MSysCountry> ResultList = null;
            string StrSql = string.Format("SELECT {0} Id, EnName,Zones,CnName FROM tbl_SysCountry WHERE 1=1 ", (Top > 0 ? " TOP " + Top + " " : ""));

            if (chaXun != null)
            {
                if (chaXun.Zones > 0)
                {
                    StrSql = StrSql + string.Format(" AND Zones={0} ", chaXun.Zones);
                }
                if (!string.IsNullOrEmpty(chaXun.EnName))
                {
                    StrSql = StrSql + string.Format(" AND EnName like '%{0}%'", chaXun.EnName);
                }
                if (!string.IsNullOrEmpty(chaXun.CnName))
                {
                    StrSql = StrSql + string.Format(" AND CnName like '%{0}%'", chaXun.CnName);
                }
            }
            StrSql = StrSql + (string.IsNullOrEmpty(filedOrder) ? "" : " ORDER BY " + filedOrder + " ASC ");
            DbCommand dc = this._db.GetSqlStringCommand(StrSql.ToString());

            using (IDataReader dr = DbHelper.ExecuteReader(dc, this._db))
            {
                ResultList = new List <Eyousoft_yhq.Model.MSysCountry>();
                while (dr.Read())
                {
                    Eyousoft_yhq.Model.MSysCountry model = new Eyousoft_yhq.Model.MSysCountry()
                    {
                        Id     = dr.GetInt32(dr.GetOrdinal("Id")),
                        EnName = dr.IsDBNull(dr.GetOrdinal("EnName")) ? "" : dr.GetString(dr.GetOrdinal("EnName")),
                        Zones  = dr.GetInt32(dr.GetOrdinal("Zones")),
                        CnName = dr.IsDBNull(dr.GetOrdinal("CnName")) ? "" : dr.GetString(dr.GetOrdinal("CnName"))
                    };
                    ResultList.Add(model);
                    model = null;
                }
            }
            return(ResultList);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool ExistsSysCountry(Eyousoft_yhq.Model.MSysCountry model)
        {
            string StrSql = " select count(1) from tbl_SysCountry WHERE 1=1 ";

            if (model.Id > 0)
            {
                StrSql += " AND Id<>@Id ";
            }
            if (!string.IsNullOrEmpty(model.EnName))
            {
                StrSql += " AND EnName=@EnName ";
            }
            if (!string.IsNullOrEmpty(model.CnName))
            {
                StrSql += " AND CnName=@CnName ";
            }
            if (model.Zones > 0)
            {
                StrSql += " AND Zones = @Zones ";
            }
            DbCommand dc = this._db.GetSqlStringCommand(StrSql);

            if (model.Id > 0)
            {
                this._db.AddInParameter(dc, "Id", DbType.Int32, model.Id);
            }
            if (!string.IsNullOrEmpty(model.EnName))
            {
                this._db.AddInParameter(dc, "EnName", DbType.String, model.EnName);
            }
            if (!string.IsNullOrEmpty(model.CnName))
            {
                this._db.AddInParameter(dc, "CnName", DbType.String, model.CnName);
            }
            if (model.Zones > 0)
            {
                this._db.AddInParameter(dc, "Zones", DbType.Int32, model.Zones);
            }
            return(DbHelper.Exists(dc, _db));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Eyousoft_yhq.Model.MSysCountry GetSysCountryModel(int ID)
        {
            Eyousoft_yhq.Model.MSysCountry model = null;
            string    StrSql = "SELECT Id, EnName,Zones,CnName FROM tbl_SysCountry WHERE Id=@Id";
            DbCommand dc     = this._db.GetSqlStringCommand(StrSql.ToString());

            this._db.AddInParameter(dc, "Id", DbType.Int32, ID);
            using (IDataReader dr = DbHelper.ExecuteReader(dc, this._db))
            {
                if (dr.Read())
                {
                    model = new Eyousoft_yhq.Model.MSysCountry()
                    {
                        Id     = dr.GetInt32(dr.GetOrdinal("Id")),
                        EnName = dr.IsDBNull(dr.GetOrdinal("EnName")) ? "" : dr.GetString(dr.GetOrdinal("EnName")),
                        Zones  = dr.GetInt32(dr.GetOrdinal("Zones")),
                        CnName = dr.IsDBNull(dr.GetOrdinal("CnName")) ? "" : dr.GetString(dr.GetOrdinal("CnName"))
                    };
                }
            };
            return(model);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Eyousoft_yhq.Model.MSysCountry GetSysCountryModel(int ID)
 {
     Eyousoft_yhq.Model.MSysCountry model = null;
     string StrSql = "SELECT Id, EnName,Zones,CnName FROM tbl_SysCountry WHERE Id=@Id";
     DbCommand dc = this._db.GetSqlStringCommand(StrSql.ToString());
     this._db.AddInParameter(dc, "Id", DbType.Int32, ID);
     using (IDataReader dr = DbHelper.ExecuteReader(dc, this._db))
     {
         if (dr.Read())
         {
             model = new Eyousoft_yhq.Model.MSysCountry()
             {
                 Id = dr.GetInt32(dr.GetOrdinal("Id")),
                 EnName = dr.IsDBNull(dr.GetOrdinal("EnName")) ? "" : dr.GetString(dr.GetOrdinal("EnName")),
                 Zones = dr.GetInt32(dr.GetOrdinal("Zones")),
                 CnName = dr.IsDBNull(dr.GetOrdinal("CnName")) ? "" : dr.GetString(dr.GetOrdinal("CnName"))
             };
         }
     };
     return model;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 获得前几行数据集合
        /// </summary>
        /// <param name="Top">0:所有</param>
        /// <param name="chaXun"></param>
        /// <param name="filedOrder"></param>
        /// <returns></returns>
        public IList<Eyousoft_yhq.Model.MSysCountry> GetSysCountryList(int Top, Eyousoft_yhq.Model.MSysCountry chaXun, string filedOrder)
        {
            IList<Eyousoft_yhq.Model.MSysCountry> ResultList = null;
            string StrSql = string.Format("SELECT {0} Id, EnName,Zones,CnName FROM tbl_SysCountry WHERE 1=1 ", (Top > 0 ? " TOP " + Top + " " : ""));
            if (chaXun != null)
            {
                if (chaXun.Zones > 0)
                {
                    StrSql = StrSql + string.Format(" AND Zones={0} ", chaXun.Zones);
                }
                if (!string.IsNullOrEmpty(chaXun.EnName))
                {
                    StrSql = StrSql + string.Format(" AND EnName like '%{0}%'", chaXun.EnName);
                }
                if (!string.IsNullOrEmpty(chaXun.CnName))
                {
                    StrSql = StrSql + string.Format(" AND CnName like '%{0}%'", chaXun.CnName);
                }
            }
            StrSql = StrSql + (string.IsNullOrEmpty(filedOrder) ? "" : " ORDER BY " + filedOrder + " ASC ");
            DbCommand dc = this._db.GetSqlStringCommand(StrSql.ToString());
            using (IDataReader dr = DbHelper.ExecuteReader(dc, this._db))
            {
                ResultList = new List<Eyousoft_yhq.Model.MSysCountry>();
                while (dr.Read())
                {
                    Eyousoft_yhq.Model.MSysCountry model = new Eyousoft_yhq.Model.MSysCountry()
                    {
                        Id = dr.GetInt32(dr.GetOrdinal("Id")),
                        EnName = dr.IsDBNull(dr.GetOrdinal("EnName")) ? "" : dr.GetString(dr.GetOrdinal("EnName")),
                        Zones = dr.GetInt32(dr.GetOrdinal("Zones")),
                        CnName = dr.IsDBNull(dr.GetOrdinal("CnName")) ? "" : dr.GetString(dr.GetOrdinal("CnName"))
                    };
                    ResultList.Add(model);
                    model = null;
                }

            }
            return ResultList;
        }
Ejemplo n.º 10
0
 /// <summary>
 /// 获得数据列表集合,分页
 /// </summary>
 /// <param name="pageSize"></param>
 /// <param name="pageIndex"></param>
 /// <param name="recordCount"></param>
 /// <param name="chaXun"></param>
 /// <returns></returns>
 public IList<Eyousoft_yhq.Model.MSysCountry> GetSysCountryList(int pageSize, int pageIndex, ref int recordCount, Eyousoft_yhq.Model.MSysCountry chaXun)
 {
     IList<Eyousoft_yhq.Model.MSysCountry> ResultList = null;
     string tableName = "tbl_SysCountry";
     string identityColumnName = "Id";
     string fields = "Id, EnName,Zones,CnName";
     string query = " 1=1 ";
     if (chaXun != null)
     {
         if (chaXun.Zones > 0)
         {
             query = query + string.Format(" AND Zones={0} ", chaXun.Zones);
         }
         if (!string.IsNullOrEmpty(chaXun.EnName))
         {
             query = query + string.Format(" AND EnName like '%{0}%'", chaXun.EnName);
         }
         if (!string.IsNullOrEmpty(chaXun.CnName))
         {
             query = query + string.Format(" AND CnName like '%{0}%'", chaXun.CnName);
         }
     }
     string orderByString = " ID ASC";
     using (IDataReader dr = DbHelper.ExecuteReader1(_db, pageSize, pageIndex, ref recordCount, tableName, identityColumnName, fields, query, orderByString))
     {
         ResultList = new List<Eyousoft_yhq.Model.MSysCountry>();
         while (dr.Read())
         {
             Eyousoft_yhq.Model.MSysCountry model = new Eyousoft_yhq.Model.MSysCountry()
             {
                 Id = dr.GetInt32(dr.GetOrdinal("Id")),
                 EnName = dr.IsDBNull(dr.GetOrdinal("EnName")) ? "" : dr.GetString(dr.GetOrdinal("EnName")),
                 Zones = dr.GetInt32(dr.GetOrdinal("Zones")),
                 CnName = dr.IsDBNull(dr.GetOrdinal("CnName")) ? "" : dr.GetString(dr.GetOrdinal("CnName"))
             };
             ResultList.Add(model);
             model = null;
         }
     };
     return ResultList;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 是否存在该记录
 /// </summary>
 public bool ExistsSysCountry(Eyousoft_yhq.Model.MSysCountry model)
 {
     return(dal.ExistsSysCountry(model));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 获得前几行数据集合
 /// </summary>
 /// <param name="Top">0:所有</param>
 /// <param name="chaXun"></param>
 /// <returns></returns>
 public IList <Eyousoft_yhq.Model.MSysCountry> GetSysCountryList(int Top, Eyousoft_yhq.Model.MSysCountry chaXun)
 {
     return(dal.GetSysCountryList((Top < 0 ? 0 : Top), chaXun, ""));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 获得数据列表集合,分页
 /// </summary>
 /// <param name="pageSize"></param>
 /// <param name="pageIndex"></param>
 /// <param name="recordCount"></param>
 /// <param name="chaXun"></param>
 /// <returns></returns>
 public IList <Eyousoft_yhq.Model.MSysCountry> GetSysCountryList(int pageSize, int pageIndex, ref int recordCount, Eyousoft_yhq.Model.MSysCountry chaXun)
 {
     if (!Utils.ValidPaging(pageSize, pageIndex))
     {
         return(null);
     }
     return(dal.GetSysCountryList(pageSize, pageIndex, ref recordCount, chaXun));
 }