示例#1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WechatBuilder.Model.wx_purchase_base GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,activityName,activitySummary,activityTimebegin,email,emailPwd,smtp,shopsPwd,activeDescription,specialRemind,activityEndtitle,endExplanation,shopstel,address,introduction,goodName,costPrice,limitCount,groupPrice,totalCount,groupPerson,virtualPerson,copyrightSetup,activityTimeend,createtime,wid,imageUrl,imageUrlend,txtLatXPoint,txtLngYPoint from wx_purchase_base ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

            WechatBuilder.Model.wx_purchase_base model = new WechatBuilder.Model.wx_purchase_base();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WechatBuilder.Model.wx_purchase_base DataRowToModel(DataRow row)
 {
     WechatBuilder.Model.wx_purchase_base model = new WechatBuilder.Model.wx_purchase_base();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["activityName"] != null)
         {
             model.activityName = row["activityName"].ToString();
         }
         if (row["activitySummary"] != null)
         {
             model.activitySummary = row["activitySummary"].ToString();
         }
         if (row["activityTimebegin"] != null && row["activityTimebegin"].ToString() != "")
         {
             model.activityTimebegin = DateTime.Parse(row["activityTimebegin"].ToString());
         }
         if (row["email"] != null)
         {
             model.email = row["email"].ToString();
         }
         if (row["emailPwd"] != null)
         {
             model.emailPwd = row["emailPwd"].ToString();
         }
         if (row["smtp"] != null)
         {
             model.smtp = row["smtp"].ToString();
         }
         if (row["shopsPwd"] != null)
         {
             model.shopsPwd = row["shopsPwd"].ToString();
         }
         if (row["activeDescription"] != null)
         {
             model.activeDescription = row["activeDescription"].ToString();
         }
         if (row["specialRemind"] != null)
         {
             model.specialRemind = row["specialRemind"].ToString();
         }
         if (row["activityEndtitle"] != null)
         {
             model.activityEndtitle = row["activityEndtitle"].ToString();
         }
         if (row["endExplanation"] != null)
         {
             model.endExplanation = row["endExplanation"].ToString();
         }
         if (row["shopstel"] != null)
         {
             model.shopstel = row["shopstel"].ToString();
         }
         if (row["address"] != null)
         {
             model.address = row["address"].ToString();
         }
         if (row["introduction"] != null)
         {
             model.introduction = row["introduction"].ToString();
         }
         if (row["goodName"] != null)
         {
             model.goodName = row["goodName"].ToString();
         }
         if (row["costPrice"] != null && row["costPrice"].ToString() != "")
         {
             model.costPrice = decimal.Parse(row["costPrice"].ToString());
         }
         if (row["limitCount"] != null && row["limitCount"].ToString() != "")
         {
             model.limitCount = int.Parse(row["limitCount"].ToString());
         }
         if (row["groupPrice"] != null && row["groupPrice"].ToString() != "")
         {
             model.groupPrice = decimal.Parse(row["groupPrice"].ToString());
         }
         if (row["totalCount"] != null && row["totalCount"].ToString() != "")
         {
             model.totalCount = int.Parse(row["totalCount"].ToString());
         }
         if (row["groupPerson"] != null && row["groupPerson"].ToString() != "")
         {
             model.groupPerson = int.Parse(row["groupPerson"].ToString());
         }
         if (row["virtualPerson"] != null && row["virtualPerson"].ToString() != "")
         {
             model.virtualPerson = int.Parse(row["virtualPerson"].ToString());
         }
         if (row["copyrightSetup"] != null)
         {
             model.copyrightSetup = row["copyrightSetup"].ToString();
         }
         if (row["activityTimeend"] != null && row["activityTimeend"].ToString() != "")
         {
             model.activityTimeend = DateTime.Parse(row["activityTimeend"].ToString());
         }
         if (row["createtime"] != null && row["createtime"].ToString() != "")
         {
             model.createtime = DateTime.Parse(row["createtime"].ToString());
         }
         if (row["wid"] != null && row["wid"].ToString() != "")
         {
             model.wid = int.Parse(row["wid"].ToString());
         }
         if (row["imageUrl"] != null)
         {
             model.imageUrl = row["imageUrl"].ToString();
         }
         if (row["imageUrlend"] != null)
         {
             model.imageUrlend = row["imageUrlend"].ToString();
         }
         if (row["txtLatXPoint"] != null && row["txtLatXPoint"].ToString() != "")
         {
             model.txtLatXPoint = decimal.Parse(row["txtLatXPoint"].ToString());
         }
         if (row["txtLngYPoint"] != null && row["txtLngYPoint"].ToString() != "")
         {
             model.txtLngYPoint = decimal.Parse(row["txtLngYPoint"].ToString());
         }
     }
     return model;
 }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WechatBuilder.Model.wx_purchase_base GetModel(int Id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 Id,activityName,activitySummary,activityTimebegin,email,emailPwd,smtp,shopsPwd,activeDescription,specialRemind,activityEndtitle,endExplanation,shopstel,address,introduction,goodName,costPrice,limitCount,groupPrice,totalCount,groupPerson,virtualPerson,copyrightSetup,activityTimeend,createtime,wid,imageUrl,imageUrlend,txtLatXPoint,txtLngYPoint from wx_purchase_base ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.Int,4)
			};
            parameters[0].Value = Id;

            WechatBuilder.Model.wx_purchase_base model = new WechatBuilder.Model.wx_purchase_base();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
示例#4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WechatBuilder.Model.wx_purchase_base model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_purchase_base(");
            strSql.Append("activityName,activitySummary,activityTimebegin,email,emailPwd,smtp,shopsPwd,activeDescription,specialRemind,activityEndtitle,endExplanation,shopstel,address,introduction,goodName,costPrice,limitCount,groupPrice,totalCount,groupPerson,virtualPerson,copyrightSetup,activityTimeend,createtime,wid,imageUrl,imageUrlend,txtLatXPoint,txtLngYPoint)");
            strSql.Append(" values (");
            strSql.Append("@activityName,@activitySummary,@activityTimebegin,@email,@emailPwd,@smtp,@shopsPwd,@activeDescription,@specialRemind,@activityEndtitle,@endExplanation,@shopstel,@address,@introduction,@goodName,@costPrice,@limitCount,@groupPrice,@totalCount,@groupPerson,@virtualPerson,@copyrightSetup,@activityTimeend,@createtime,@wid,@imageUrl,@imageUrlend,@txtLatXPoint,@txtLngYPoint)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@activityName",      SqlDbType.VarChar,    100),
                new SqlParameter("@activitySummary",   SqlDbType.VarChar,    500),
                new SqlParameter("@activityTimebegin", SqlDbType.DateTime),
                new SqlParameter("@email",             SqlDbType.VarChar,    100),
                new SqlParameter("@emailPwd",          SqlDbType.VarChar,    100),
                new SqlParameter("@smtp",              SqlDbType.VarChar,    100),
                new SqlParameter("@shopsPwd",          SqlDbType.VarChar,    100),
                new SqlParameter("@activeDescription", SqlDbType.VarChar,   2000),
                new SqlParameter("@specialRemind",     SqlDbType.VarChar,   1000),
                new SqlParameter("@activityEndtitle",  SqlDbType.VarChar,    100),
                new SqlParameter("@endExplanation",    SqlDbType.VarChar,   2000),
                new SqlParameter("@shopstel",          SqlDbType.VarChar,    100),
                new SqlParameter("@address",           SqlDbType.VarChar,    500),
                new SqlParameter("@introduction",      SqlDbType.VarChar,   2000),
                new SqlParameter("@goodName",          SqlDbType.VarChar,    100),
                new SqlParameter("@costPrice",         SqlDbType.Float,        8),
                new SqlParameter("@limitCount",        SqlDbType.Int,          4),
                new SqlParameter("@groupPrice",        SqlDbType.Float,        8),
                new SqlParameter("@totalCount",        SqlDbType.Int,          4),
                new SqlParameter("@groupPerson",       SqlDbType.Int,          4),
                new SqlParameter("@virtualPerson",     SqlDbType.Int,          4),
                new SqlParameter("@copyrightSetup",    SqlDbType.VarChar,    200),
                new SqlParameter("@activityTimeend",   SqlDbType.DateTime),
                new SqlParameter("@createtime",        SqlDbType.DateTime),
                new SqlParameter("@wid",               SqlDbType.Int,          4),
                new SqlParameter("@imageUrl",          SqlDbType.NVarChar,   200),
                new SqlParameter("@imageUrlend",       SqlDbType.NVarChar,   200),
                new SqlParameter("@txtLatXPoint",      SqlDbType.Float,        8),
                new SqlParameter("@txtLngYPoint",      SqlDbType.Float, 8)
            };
            parameters[0].Value  = model.activityName;
            parameters[1].Value  = model.activitySummary;
            parameters[2].Value  = model.activityTimebegin;
            parameters[3].Value  = model.email;
            parameters[4].Value  = model.emailPwd;
            parameters[5].Value  = model.smtp;
            parameters[6].Value  = model.shopsPwd;
            parameters[7].Value  = model.activeDescription;
            parameters[8].Value  = model.specialRemind;
            parameters[9].Value  = model.activityEndtitle;
            parameters[10].Value = model.endExplanation;
            parameters[11].Value = model.shopstel;
            parameters[12].Value = model.address;
            parameters[13].Value = model.introduction;
            parameters[14].Value = model.goodName;
            parameters[15].Value = model.costPrice;
            parameters[16].Value = model.limitCount;
            parameters[17].Value = model.groupPrice;
            parameters[18].Value = model.totalCount;
            parameters[19].Value = model.groupPerson;
            parameters[20].Value = model.virtualPerson;
            parameters[21].Value = model.copyrightSetup;
            parameters[22].Value = model.activityTimeend;
            parameters[23].Value = model.createtime;
            parameters[24].Value = model.wid;
            parameters[25].Value = model.imageUrl;
            parameters[26].Value = model.imageUrlend;
            parameters[27].Value = model.txtLatXPoint;
            parameters[28].Value = model.txtLngYPoint;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
示例#5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WechatBuilder.Model.wx_purchase_base DataRowToModel(DataRow row)
 {
     WechatBuilder.Model.wx_purchase_base model = new WechatBuilder.Model.wx_purchase_base();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["activityName"] != null)
         {
             model.activityName = row["activityName"].ToString();
         }
         if (row["activitySummary"] != null)
         {
             model.activitySummary = row["activitySummary"].ToString();
         }
         if (row["activityTimebegin"] != null && row["activityTimebegin"].ToString() != "")
         {
             model.activityTimebegin = DateTime.Parse(row["activityTimebegin"].ToString());
         }
         if (row["email"] != null)
         {
             model.email = row["email"].ToString();
         }
         if (row["emailPwd"] != null)
         {
             model.emailPwd = row["emailPwd"].ToString();
         }
         if (row["smtp"] != null)
         {
             model.smtp = row["smtp"].ToString();
         }
         if (row["shopsPwd"] != null)
         {
             model.shopsPwd = row["shopsPwd"].ToString();
         }
         if (row["activeDescription"] != null)
         {
             model.activeDescription = row["activeDescription"].ToString();
         }
         if (row["specialRemind"] != null)
         {
             model.specialRemind = row["specialRemind"].ToString();
         }
         if (row["activityEndtitle"] != null)
         {
             model.activityEndtitle = row["activityEndtitle"].ToString();
         }
         if (row["endExplanation"] != null)
         {
             model.endExplanation = row["endExplanation"].ToString();
         }
         if (row["shopstel"] != null)
         {
             model.shopstel = row["shopstel"].ToString();
         }
         if (row["address"] != null)
         {
             model.address = row["address"].ToString();
         }
         if (row["introduction"] != null)
         {
             model.introduction = row["introduction"].ToString();
         }
         if (row["goodName"] != null)
         {
             model.goodName = row["goodName"].ToString();
         }
         if (row["costPrice"] != null && row["costPrice"].ToString() != "")
         {
             model.costPrice = decimal.Parse(row["costPrice"].ToString());
         }
         if (row["limitCount"] != null && row["limitCount"].ToString() != "")
         {
             model.limitCount = int.Parse(row["limitCount"].ToString());
         }
         if (row["groupPrice"] != null && row["groupPrice"].ToString() != "")
         {
             model.groupPrice = decimal.Parse(row["groupPrice"].ToString());
         }
         if (row["totalCount"] != null && row["totalCount"].ToString() != "")
         {
             model.totalCount = int.Parse(row["totalCount"].ToString());
         }
         if (row["groupPerson"] != null && row["groupPerson"].ToString() != "")
         {
             model.groupPerson = int.Parse(row["groupPerson"].ToString());
         }
         if (row["virtualPerson"] != null && row["virtualPerson"].ToString() != "")
         {
             model.virtualPerson = int.Parse(row["virtualPerson"].ToString());
         }
         if (row["copyrightSetup"] != null)
         {
             model.copyrightSetup = row["copyrightSetup"].ToString();
         }
         if (row["activityTimeend"] != null && row["activityTimeend"].ToString() != "")
         {
             model.activityTimeend = DateTime.Parse(row["activityTimeend"].ToString());
         }
         if (row["createtime"] != null && row["createtime"].ToString() != "")
         {
             model.createtime = DateTime.Parse(row["createtime"].ToString());
         }
         if (row["wid"] != null && row["wid"].ToString() != "")
         {
             model.wid = int.Parse(row["wid"].ToString());
         }
         if (row["imageUrl"] != null)
         {
             model.imageUrl = row["imageUrl"].ToString();
         }
         if (row["imageUrlend"] != null)
         {
             model.imageUrlend = row["imageUrlend"].ToString();
         }
         if (row["txtLatXPoint"] != null && row["txtLatXPoint"].ToString() != "")
         {
             model.txtLatXPoint = decimal.Parse(row["txtLatXPoint"].ToString());
         }
         if (row["txtLngYPoint"] != null && row["txtLngYPoint"].ToString() != "")
         {
             model.txtLngYPoint = decimal.Parse(row["txtLngYPoint"].ToString());
         }
     }
     return(model);
 }
示例#6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WechatBuilder.Model.wx_purchase_base model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_purchase_base set ");
            strSql.Append("activityName=@activityName,");
            strSql.Append("activitySummary=@activitySummary,");
            strSql.Append("activityTimebegin=@activityTimebegin,");
            strSql.Append("email=@email,");
            strSql.Append("emailPwd=@emailPwd,");
            strSql.Append("smtp=@smtp,");
            strSql.Append("shopsPwd=@shopsPwd,");
            strSql.Append("activeDescription=@activeDescription,");
            strSql.Append("specialRemind=@specialRemind,");
            strSql.Append("activityEndtitle=@activityEndtitle,");
            strSql.Append("endExplanation=@endExplanation,");
            strSql.Append("shopstel=@shopstel,");
            strSql.Append("address=@address,");
            strSql.Append("introduction=@introduction,");
            strSql.Append("goodName=@goodName,");
            strSql.Append("costPrice=@costPrice,");
            strSql.Append("limitCount=@limitCount,");
            strSql.Append("groupPrice=@groupPrice,");
            strSql.Append("totalCount=@totalCount,");
            strSql.Append("groupPerson=@groupPerson,");
            strSql.Append("virtualPerson=@virtualPerson,");
            strSql.Append("copyrightSetup=@copyrightSetup,");
            strSql.Append("activityTimeend=@activityTimeend,");
            strSql.Append("createtime=@createtime,");
            strSql.Append("wid=@wid,");
            strSql.Append("imageUrl=@imageUrl,");
            strSql.Append("imageUrlend=@imageUrlend,");
            strSql.Append("txtLatXPoint=@txtLatXPoint,");
            strSql.Append("txtLngYPoint=@txtLngYPoint");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@activityName",      SqlDbType.VarChar,    100),
                new SqlParameter("@activitySummary",   SqlDbType.VarChar,    500),
                new SqlParameter("@activityTimebegin", SqlDbType.DateTime),
                new SqlParameter("@email",             SqlDbType.VarChar,    100),
                new SqlParameter("@emailPwd",          SqlDbType.VarChar,    100),
                new SqlParameter("@smtp",              SqlDbType.VarChar,    100),
                new SqlParameter("@shopsPwd",          SqlDbType.VarChar,    100),
                new SqlParameter("@activeDescription", SqlDbType.VarChar,   2000),
                new SqlParameter("@specialRemind",     SqlDbType.VarChar,   1000),
                new SqlParameter("@activityEndtitle",  SqlDbType.VarChar,    100),
                new SqlParameter("@endExplanation",    SqlDbType.VarChar,   2000),
                new SqlParameter("@shopstel",          SqlDbType.VarChar,    100),
                new SqlParameter("@address",           SqlDbType.VarChar,    500),
                new SqlParameter("@introduction",      SqlDbType.VarChar,   2000),
                new SqlParameter("@goodName",          SqlDbType.VarChar,    100),
                new SqlParameter("@costPrice",         SqlDbType.Float,        8),
                new SqlParameter("@limitCount",        SqlDbType.Int,          4),
                new SqlParameter("@groupPrice",        SqlDbType.Float,        8),
                new SqlParameter("@totalCount",        SqlDbType.Int,          4),
                new SqlParameter("@groupPerson",       SqlDbType.Int,          4),
                new SqlParameter("@virtualPerson",     SqlDbType.Int,          4),
                new SqlParameter("@copyrightSetup",    SqlDbType.VarChar,    200),
                new SqlParameter("@activityTimeend",   SqlDbType.DateTime),
                new SqlParameter("@createtime",        SqlDbType.DateTime),
                new SqlParameter("@wid",               SqlDbType.Int,          4),
                new SqlParameter("@imageUrl",          SqlDbType.NVarChar,   200),
                new SqlParameter("@imageUrlend",       SqlDbType.NVarChar,   200),
                new SqlParameter("@txtLatXPoint",      SqlDbType.Float,        8),
                new SqlParameter("@txtLngYPoint",      SqlDbType.Float,        8),
                new SqlParameter("@Id",                SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.activityName;
            parameters[1].Value  = model.activitySummary;
            parameters[2].Value  = model.activityTimebegin;
            parameters[3].Value  = model.email;
            parameters[4].Value  = model.emailPwd;
            parameters[5].Value  = model.smtp;
            parameters[6].Value  = model.shopsPwd;
            parameters[7].Value  = model.activeDescription;
            parameters[8].Value  = model.specialRemind;
            parameters[9].Value  = model.activityEndtitle;
            parameters[10].Value = model.endExplanation;
            parameters[11].Value = model.shopstel;
            parameters[12].Value = model.address;
            parameters[13].Value = model.introduction;
            parameters[14].Value = model.goodName;
            parameters[15].Value = model.costPrice;
            parameters[16].Value = model.limitCount;
            parameters[17].Value = model.groupPrice;
            parameters[18].Value = model.totalCount;
            parameters[19].Value = model.groupPerson;
            parameters[20].Value = model.virtualPerson;
            parameters[21].Value = model.copyrightSetup;
            parameters[22].Value = model.activityTimeend;
            parameters[23].Value = model.createtime;
            parameters[24].Value = model.wid;
            parameters[25].Value = model.imageUrl;
            parameters[26].Value = model.imageUrlend;
            parameters[27].Value = model.txtLatXPoint;
            parameters[28].Value = model.txtLngYPoint;
            parameters[29].Value = model.Id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }