Ejemplo n.º 1
0
        /// <summary>
        /// 判断当前用户是否有红包
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public bool Exists(string userid)
        {
            StringBuilder ExistStr = new StringBuilder();

            ExistStr.Append("select count(1) from tbl_HongBao  where userid=@userid ");

            DbCommand ExistsCmd = this._db.GetSqlStringCommand(ExistStr.ToString());

            this._db.AddInParameter(ExistsCmd, "userid", System.Data.DbType.String, userid);

            return(DbHelper.Exists(ExistsCmd, this._db));
        }
Ejemplo n.º 2
0
Archivo: User.cs Proyecto: ichoukou/yhq
        /// <summary>
        /// 判断用户名是否存在
        /// </summary>
        /// <param name="UserName">用户名</param>
        /// <returns></returns>
        public bool Exists(string UserName)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from tbl_User");
            strSql.Append(" where UserName=@UserName ");

            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());

            this._db.AddInParameter(cmd, "UserName", System.Data.DbType.String, UserName);

            return(DbHelper.Exists(cmd, this._db));
        }
Ejemplo n.º 3
0
        public bool getOrderExist(string orderid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from tbl_Order");
            strSql.Append(" where  OrderID =@OrderID   and  ConSumState=1");

            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());

            this._db.AddInParameter(cmd, "OrderID", System.Data.DbType.AnsiStringFixedLength, orderid);

            return(DbHelper.Exists(cmd, this._db));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 判断当日用户是否抽奖
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public bool Exists(ChouJiang info)
        {
            StringBuilder ExistStr = new StringBuilder();

            ExistStr.Append("select count(1) from tbl_ChouJiang  where  CONVERT(varchar(20), ChouJiangShiJian, 23)  =@ChouJiangShiJian  AND  CaoZuoRenID=@CaoZuoRenID   and  FangShi=@FangShi ");

            DbCommand ExistsCmd = this._db.GetSqlStringCommand(ExistStr.ToString());

            this._db.AddInParameter(ExistsCmd, "ChouJiangShiJian", System.Data.DbType.String, info.ChouJiangShiJian.ToString("yyyy-MM-dd"));
            this._db.AddInParameter(ExistsCmd, "CaoZuoRenID", System.Data.DbType.String, info.CaoZuoRenID);
            this._db.AddInParameter(ExistsCmd, "FangShi", System.Data.DbType.Byte, info.FangShi);

            return(DbHelper.Exists(ExistsCmd, this._db));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 判断当前用户是否已经领取优惠码
        /// </summary>
        /// <param name="UserName">用户名</param>
        /// <param name="productid">产品编号</param>
        /// <returns></returns>
        public bool Exists(string UserName, string productid, string FavourCode)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from tbl_SendMSG");
            strSql.Append(" where sendNum=@UserName  and ProductID=@productid and FavourCode=@FavourCode");

            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());

            this._db.AddInParameter(cmd, "UserName", System.Data.DbType.String, UserName);
            this._db.AddInParameter(cmd, "productid", System.Data.DbType.String, productid);
            this._db.AddInParameter(cmd, "FavourCode", System.Data.DbType.String, FavourCode);

            return(DbHelper.Exists(cmd, this._db));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool ExistsSysDistrict(Eyousoft_yhq.Model.MSysDistrict model)
        {
            string StrSql = " select count(1) from tbl_SysDistrict WHERE 1=1 ";

            if (model.Id > 0)
            {
                StrSql += " AND Id<>@Id ";
            }
            if (!string.IsNullOrEmpty(model.Name))
            {
                StrSql += " AND Name=@Name ";
            }
            if (!string.IsNullOrEmpty(model.HeaderLetter))
            {
                StrSql += " AND HeaderLetter=@HeaderLetter ";
            }
            if (model.CityId > 0)
            {
                StrSql += " AND CityId = @CityId ";
            }
            if (model.ProvinceId > 0)
            {
                StrSql += " AND ProvinceId = @ProvinceId ";
            }
            DbCommand dc = this._db.GetSqlStringCommand(StrSql);

            if (model.Id > 0)
            {
                this._db.AddInParameter(dc, "Id", DbType.Int32, model.Id);
            }
            if (!string.IsNullOrEmpty(model.Name))
            {
                this._db.AddInParameter(dc, "Name", DbType.String, model.Name);
            }
            if (!string.IsNullOrEmpty(model.HeaderLetter))
            {
                this._db.AddInParameter(dc, "HeaderLetter", DbType.String, model.HeaderLetter);
            }
            if (model.CityId > 0)
            {
                this._db.AddInParameter(dc, "CityId", DbType.Int32, model.CityId);
            }
            if (model.ProvinceId > 0)
            {
                this._db.AddInParameter(dc, "ProvinceId", DbType.Int32, model.ProvinceId);
            }
            return(DbHelper.Exists(dc, _db));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool ExistsSysProvince(Eyousoft_yhq.Model.MSysProvince model)
        {
            string StrSql = " select count(1) from tbl_SysProvince WHERE 1=1 ";

            if (model.ID > 0)
            {
                StrSql += " AND ID<>@ID ";
            }
            if (!string.IsNullOrEmpty(model.Name))
            {
                StrSql += " AND Name=@Name ";
            }
            if (!string.IsNullOrEmpty(model.HeaderLetter))
            {
                StrSql += " AND HeaderLetter=@HeaderLetter ";
            }
            if (model.CountryId > 0)
            {
                StrSql += " AND CountryId = @CountryId ";
            }
            if (model.AreaId > 0)
            {
                StrSql += " AND AreaId = @AreaId ";
            }
            DbCommand dc = this._db.GetSqlStringCommand(StrSql);

            if (model.ID > 0)
            {
                this._db.AddInParameter(dc, "ID", DbType.Int32, model.ID);
            }
            if (!string.IsNullOrEmpty(model.Name))
            {
                this._db.AddInParameter(dc, "Name", DbType.String, model.Name);
            }
            if (!string.IsNullOrEmpty(model.HeaderLetter))
            {
                this._db.AddInParameter(dc, "HeaderLetter", DbType.String, model.HeaderLetter);
            }
            if (model.CountryId > 0)
            {
                this._db.AddInParameter(dc, "CountryId", DbType.Int32, model.CountryId);
            }
            if (model.AreaId > 0)
            {
                this._db.AddInParameter(dc, "AreaId", DbType.Int32, model.AreaId);
            }
            return(DbHelper.Exists(dc, _db));
        }
Ejemplo n.º 8
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.º 9
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="TypeID">产品类型编号</param>
        /// <returns></returns>
        public bool Delete(int[] TypeID)
        {
            StringBuilder Sql = new StringBuilder();

            Sql.AppendFormat("SELECT COUNT(1) FROM dbo.tbl_Product WHERE ProductType IN({0})", Utils.GetSqlIdStrByArray(TypeID));

            DbCommand EXcmd = this._db.GetSqlStringCommand(Sql.ToString());

            bool result = DbHelper.Exists(EXcmd, this._db);

            if (result)
            {
                return(false);
            }

            StringBuilder strSql = new StringBuilder();

            strSql.AppendFormat("  DELETE FROM  tbl_ProductType   WHERE  TypeID in ({0})  ", Utils.GetSqlIdStrByArray(TypeID));

            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());

            return(DbHelper.ExecuteSql(cmd, this._db) > 0 ? true : false);
        }