Пример #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_diancai_shopinfo GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,wid,hotelName,hotelLogo,hoteltimeBegin,hoteltimeEnd,limiteOrder,dcRename,sendPrice,sendCost,freeSendcost,radius,sendArea,tel,address,personLimite,notice,hotelintroduction,email,emailpwd,stmp,css,createDate,kcType,miaoshu,xplace,yplace,hoteltimeBegin1,hoteltimeEnd1,hoteltimeBegin2,hoteltimeEnd2 from wx_diancai_shopinfo ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_diancai_shopinfo GetModel(int id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 id,wid,hotelName,hotelLogo,hoteltimeBegin,hoteltimeEnd,limiteOrder,dcRename,sendPrice,sendCost,freeSendcost,radius,sendArea,tel,address,personLimite,notice,hotelintroduction,email,emailpwd,stmp,css,createDate,kcType,miaoshu,xplace,yplace,hoteltimeBegin1,hoteltimeEnd1,hoteltimeBegin2,hoteltimeEnd2 from wx_diancai_shopinfo ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            MxWeiXinPF.Model.wx_diancai_shopinfo model=new MxWeiXinPF.Model.wx_diancai_shopinfo();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Пример #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_diancai_shopinfo DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_diancai_shopinfo model=new MxWeiXinPF.Model.wx_diancai_shopinfo();
     if (row != null)
     {
         if(row["id"]!=null && row["id"].ToString()!="")
         {
             model.id=int.Parse(row["id"].ToString());
         }
         if(row["wid"]!=null && row["wid"].ToString()!="")
         {
             model.wid=int.Parse(row["wid"].ToString());
         }
         if(row["hotelName"]!=null)
         {
             model.hotelName=row["hotelName"].ToString();
         }
         if(row["hotelLogo"]!=null)
         {
             model.hotelLogo=row["hotelLogo"].ToString();
         }
         if(row["hoteltimeBegin"]!=null && row["hoteltimeBegin"].ToString()!="")
         {
             model.hoteltimeBegin=DateTime.Parse(row["hoteltimeBegin"].ToString());
         }
         if(row["hoteltimeEnd"]!=null && row["hoteltimeEnd"].ToString()!="")
         {
             model.hoteltimeEnd=DateTime.Parse(row["hoteltimeEnd"].ToString());
         }
         if(row["limiteOrder"]!=null && row["limiteOrder"].ToString()!="")
         {
             if((row["limiteOrder"].ToString()=="1")||(row["limiteOrder"].ToString().ToLower()=="true"))
             {
                 model.limiteOrder=true;
             }
             else
             {
                 model.limiteOrder=false;
             }
         }
         if(row["dcRename"]!=null)
         {
             model.dcRename=row["dcRename"].ToString();
         }
         if(row["sendPrice"]!=null && row["sendPrice"].ToString()!="")
         {
             model.sendPrice=decimal.Parse(row["sendPrice"].ToString());
         }
         if(row["sendCost"]!=null && row["sendCost"].ToString()!="")
         {
             model.sendCost=decimal.Parse(row["sendCost"].ToString());
         }
         if(row["freeSendcost"]!=null && row["freeSendcost"].ToString()!="")
         {
             model.freeSendcost=int.Parse(row["freeSendcost"].ToString());
         }
         if(row["radius"]!=null)
         {
             model.radius=row["radius"].ToString();
         }
         if(row["sendArea"]!=null)
         {
             model.sendArea=row["sendArea"].ToString();
         }
         if(row["tel"]!=null)
         {
             model.tel=row["tel"].ToString();
         }
         if(row["address"]!=null)
         {
             model.address=row["address"].ToString();
         }
         if(row["personLimite"]!=null && row["personLimite"].ToString()!="")
         {
             model.personLimite=int.Parse(row["personLimite"].ToString());
         }
         if(row["notice"]!=null)
         {
             model.notice=row["notice"].ToString();
         }
         if(row["hotelintroduction"]!=null)
         {
             model.hotelintroduction=row["hotelintroduction"].ToString();
         }
         if(row["email"]!=null)
         {
             model.email=row["email"].ToString();
         }
         if(row["emailpwd"]!=null)
         {
             model.emailpwd=row["emailpwd"].ToString();
         }
         if(row["stmp"]!=null)
         {
             model.stmp=row["stmp"].ToString();
         }
         if(row["css"]!=null)
         {
             model.css=row["css"].ToString();
         }
         if(row["createDate"]!=null && row["createDate"].ToString()!="")
         {
             model.createDate=DateTime.Parse(row["createDate"].ToString());
         }
         if(row["kcType"]!=null)
         {
             model.kcType=row["kcType"].ToString();
         }
         if(row["miaoshu"]!=null)
         {
             model.miaoshu=row["miaoshu"].ToString();
         }
         if(row["xplace"]!=null && row["xplace"].ToString()!="")
         {
             model.xplace=decimal.Parse(row["xplace"].ToString());
         }
         if(row["yplace"]!=null && row["yplace"].ToString()!="")
         {
             model.yplace=decimal.Parse(row["yplace"].ToString());
         }
         if(row["hoteltimeBegin1"]!=null && row["hoteltimeBegin1"].ToString()!="")
         {
             model.hoteltimeBegin1=DateTime.Parse(row["hoteltimeBegin1"].ToString());
         }
         if(row["hoteltimeEnd1"]!=null && row["hoteltimeEnd1"].ToString()!="")
         {
             model.hoteltimeEnd1=DateTime.Parse(row["hoteltimeEnd1"].ToString());
         }
         if(row["hoteltimeBegin2"]!=null && row["hoteltimeBegin2"].ToString()!="")
         {
             model.hoteltimeBegin2=DateTime.Parse(row["hoteltimeBegin2"].ToString());
         }
         if(row["hoteltimeEnd2"]!=null && row["hoteltimeEnd2"].ToString()!="")
         {
             model.hoteltimeEnd2=DateTime.Parse(row["hoteltimeEnd2"].ToString());
         }
     }
     return model;
 }
Пример #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(MxWeiXinPF.Model.wx_diancai_shopinfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_diancai_shopinfo(");
            strSql.Append("wid,hotelName,hotelLogo,hoteltimeBegin,hoteltimeEnd,limiteOrder,dcRename,sendPrice,sendCost,freeSendcost,radius,sendArea,tel,address,personLimite,notice,hotelintroduction,email,emailpwd,stmp,css,createDate,kcType,miaoshu,xplace,yplace,hoteltimeBegin1,hoteltimeEnd1,hoteltimeBegin2,hoteltimeEnd2)");
            strSql.Append(" values (");
            strSql.Append("@wid,@hotelName,@hotelLogo,@hoteltimeBegin,@hoteltimeEnd,@limiteOrder,@dcRename,@sendPrice,@sendCost,@freeSendcost,@radius,@sendArea,@tel,@address,@personLimite,@notice,@hotelintroduction,@email,@emailpwd,@stmp,@css,@createDate,@kcType,@miaoshu,@xplace,@yplace,@hoteltimeBegin1,@hoteltimeEnd1,@hoteltimeBegin2,@hoteltimeEnd2)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",               SqlDbType.Int,          4),
                new SqlParameter("@hotelName",         SqlDbType.VarChar,    500),
                new SqlParameter("@hotelLogo",         SqlDbType.VarChar,    200),
                new SqlParameter("@hoteltimeBegin",    SqlDbType.DateTime),
                new SqlParameter("@hoteltimeEnd",      SqlDbType.DateTime),
                new SqlParameter("@limiteOrder",       SqlDbType.Bit,          1),
                new SqlParameter("@dcRename",          SqlDbType.VarChar,    200),
                new SqlParameter("@sendPrice",         SqlDbType.Float,        8),
                new SqlParameter("@sendCost",          SqlDbType.Float,        8),
                new SqlParameter("@freeSendcost",      SqlDbType.Int,          4),
                new SqlParameter("@radius",            SqlDbType.VarChar,    200),
                new SqlParameter("@sendArea",          SqlDbType.VarChar,    200),
                new SqlParameter("@tel",               SqlDbType.VarChar,    100),
                new SqlParameter("@address",           SqlDbType.VarChar,    200),
                new SqlParameter("@personLimite",      SqlDbType.Int,          4),
                new SqlParameter("@notice",            SqlDbType.VarChar,    300),
                new SqlParameter("@hotelintroduction", SqlDbType.VarChar,    500),
                new SqlParameter("@email",             SqlDbType.VarChar,    200),
                new SqlParameter("@emailpwd",          SqlDbType.VarChar,    100),
                new SqlParameter("@stmp",              SqlDbType.VarChar,    100),
                new SqlParameter("@css",               SqlDbType.VarChar,    200),
                new SqlParameter("@createDate",        SqlDbType.DateTime),
                new SqlParameter("@kcType",            SqlDbType.VarChar,   4000),
                new SqlParameter("@miaoshu",           SqlDbType.VarChar,    200),
                new SqlParameter("@xplace",            SqlDbType.Float,        8),
                new SqlParameter("@yplace",            SqlDbType.Float,        8),
                new SqlParameter("@hoteltimeBegin1",   SqlDbType.DateTime),
                new SqlParameter("@hoteltimeEnd1",     SqlDbType.DateTime),
                new SqlParameter("@hoteltimeBegin2",   SqlDbType.DateTime),
                new SqlParameter("@hoteltimeEnd2",     SqlDbType.DateTime)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.hotelName;
            parameters[2].Value  = model.hotelLogo;
            parameters[3].Value  = model.hoteltimeBegin;
            parameters[4].Value  = model.hoteltimeEnd;
            parameters[5].Value  = model.limiteOrder;
            parameters[6].Value  = model.dcRename;
            parameters[7].Value  = model.sendPrice;
            parameters[8].Value  = model.sendCost;
            parameters[9].Value  = model.freeSendcost;
            parameters[10].Value = model.radius;
            parameters[11].Value = model.sendArea;
            parameters[12].Value = model.tel;
            parameters[13].Value = model.address;
            parameters[14].Value = model.personLimite;
            parameters[15].Value = model.notice;
            parameters[16].Value = model.hotelintroduction;
            parameters[17].Value = model.email;
            parameters[18].Value = model.emailpwd;
            parameters[19].Value = model.stmp;
            parameters[20].Value = model.css;
            parameters[21].Value = model.createDate;
            parameters[22].Value = model.kcType;
            parameters[23].Value = model.miaoshu;
            parameters[24].Value = model.xplace;
            parameters[25].Value = model.yplace;
            parameters[26].Value = model.hoteltimeBegin1;
            parameters[27].Value = model.hoteltimeEnd1;
            parameters[28].Value = model.hoteltimeBegin2;
            parameters[29].Value = model.hoteltimeEnd2;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Пример #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_diancai_shopinfo DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_diancai_shopinfo model = new MxWeiXinPF.Model.wx_diancai_shopinfo();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["wid"] != null && row["wid"].ToString() != "")
         {
             model.wid = int.Parse(row["wid"].ToString());
         }
         if (row["hotelName"] != null)
         {
             model.hotelName = row["hotelName"].ToString();
         }
         if (row["hotelLogo"] != null)
         {
             model.hotelLogo = row["hotelLogo"].ToString();
         }
         if (row["hoteltimeBegin"] != null && row["hoteltimeBegin"].ToString() != "")
         {
             model.hoteltimeBegin = DateTime.Parse(row["hoteltimeBegin"].ToString());
         }
         if (row["hoteltimeEnd"] != null && row["hoteltimeEnd"].ToString() != "")
         {
             model.hoteltimeEnd = DateTime.Parse(row["hoteltimeEnd"].ToString());
         }
         if (row["limiteOrder"] != null && row["limiteOrder"].ToString() != "")
         {
             if ((row["limiteOrder"].ToString() == "1") || (row["limiteOrder"].ToString().ToLower() == "true"))
             {
                 model.limiteOrder = true;
             }
             else
             {
                 model.limiteOrder = false;
             }
         }
         if (row["dcRename"] != null)
         {
             model.dcRename = row["dcRename"].ToString();
         }
         if (row["sendPrice"] != null && row["sendPrice"].ToString() != "")
         {
             model.sendPrice = decimal.Parse(row["sendPrice"].ToString());
         }
         if (row["sendCost"] != null && row["sendCost"].ToString() != "")
         {
             model.sendCost = decimal.Parse(row["sendCost"].ToString());
         }
         if (row["freeSendcost"] != null && row["freeSendcost"].ToString() != "")
         {
             model.freeSendcost = int.Parse(row["freeSendcost"].ToString());
         }
         if (row["radius"] != null)
         {
             model.radius = row["radius"].ToString();
         }
         if (row["sendArea"] != null)
         {
             model.sendArea = row["sendArea"].ToString();
         }
         if (row["tel"] != null)
         {
             model.tel = row["tel"].ToString();
         }
         if (row["address"] != null)
         {
             model.address = row["address"].ToString();
         }
         if (row["personLimite"] != null && row["personLimite"].ToString() != "")
         {
             model.personLimite = int.Parse(row["personLimite"].ToString());
         }
         if (row["notice"] != null)
         {
             model.notice = row["notice"].ToString();
         }
         if (row["hotelintroduction"] != null)
         {
             model.hotelintroduction = row["hotelintroduction"].ToString();
         }
         if (row["email"] != null)
         {
             model.email = row["email"].ToString();
         }
         if (row["emailpwd"] != null)
         {
             model.emailpwd = row["emailpwd"].ToString();
         }
         if (row["stmp"] != null)
         {
             model.stmp = row["stmp"].ToString();
         }
         if (row["css"] != null)
         {
             model.css = row["css"].ToString();
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["kcType"] != null)
         {
             model.kcType = row["kcType"].ToString();
         }
         if (row["miaoshu"] != null)
         {
             model.miaoshu = row["miaoshu"].ToString();
         }
         if (row["xplace"] != null && row["xplace"].ToString() != "")
         {
             model.xplace = decimal.Parse(row["xplace"].ToString());
         }
         if (row["yplace"] != null && row["yplace"].ToString() != "")
         {
             model.yplace = decimal.Parse(row["yplace"].ToString());
         }
         if (row["hoteltimeBegin1"] != null && row["hoteltimeBegin1"].ToString() != "")
         {
             model.hoteltimeBegin1 = DateTime.Parse(row["hoteltimeBegin1"].ToString());
         }
         if (row["hoteltimeEnd1"] != null && row["hoteltimeEnd1"].ToString() != "")
         {
             model.hoteltimeEnd1 = DateTime.Parse(row["hoteltimeEnd1"].ToString());
         }
         if (row["hoteltimeBegin2"] != null && row["hoteltimeBegin2"].ToString() != "")
         {
             model.hoteltimeBegin2 = DateTime.Parse(row["hoteltimeBegin2"].ToString());
         }
         if (row["hoteltimeEnd2"] != null && row["hoteltimeEnd2"].ToString() != "")
         {
             model.hoteltimeEnd2 = DateTime.Parse(row["hoteltimeEnd2"].ToString());
         }
     }
     return(model);
 }
Пример #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MxWeiXinPF.Model.wx_diancai_shopinfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_diancai_shopinfo set ");
            strSql.Append("wid=@wid,");
            strSql.Append("hotelName=@hotelName,");
            strSql.Append("hotelLogo=@hotelLogo,");
            strSql.Append("hoteltimeBegin=@hoteltimeBegin,");
            strSql.Append("hoteltimeEnd=@hoteltimeEnd,");
            strSql.Append("limiteOrder=@limiteOrder,");
            strSql.Append("dcRename=@dcRename,");
            strSql.Append("sendPrice=@sendPrice,");
            strSql.Append("sendCost=@sendCost,");
            strSql.Append("freeSendcost=@freeSendcost,");
            strSql.Append("radius=@radius,");
            strSql.Append("sendArea=@sendArea,");
            strSql.Append("tel=@tel,");
            strSql.Append("address=@address,");
            strSql.Append("personLimite=@personLimite,");
            strSql.Append("notice=@notice,");
            strSql.Append("hotelintroduction=@hotelintroduction,");
            strSql.Append("email=@email,");
            strSql.Append("emailpwd=@emailpwd,");
            strSql.Append("stmp=@stmp,");
            strSql.Append("css=@css,");
            //strSql.Append("createDate=@createDate,");
            strSql.Append("kcType=@kcType,");
            strSql.Append("miaoshu=@miaoshu,");
            strSql.Append("xplace=@xplace,");
            strSql.Append("yplace=@yplace,");
            strSql.Append("hoteltimeBegin1=@hoteltimeBegin1,");
            strSql.Append("hoteltimeEnd1=@hoteltimeEnd1,");
            strSql.Append("hoteltimeBegin2=@hoteltimeBegin2,");
            strSql.Append("hoteltimeEnd2=@hoteltimeEnd2");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",               SqlDbType.Int,          4),
                new SqlParameter("@hotelName",         SqlDbType.VarChar,    500),
                new SqlParameter("@hotelLogo",         SqlDbType.VarChar,    200),
                new SqlParameter("@hoteltimeBegin",    SqlDbType.DateTime),
                new SqlParameter("@hoteltimeEnd",      SqlDbType.DateTime),
                new SqlParameter("@limiteOrder",       SqlDbType.Bit,          1),
                new SqlParameter("@dcRename",          SqlDbType.VarChar,    200),
                new SqlParameter("@sendPrice",         SqlDbType.Float,        8),
                new SqlParameter("@sendCost",          SqlDbType.Float,        8),
                new SqlParameter("@freeSendcost",      SqlDbType.Int,          4),
                new SqlParameter("@radius",            SqlDbType.VarChar,    200),
                new SqlParameter("@sendArea",          SqlDbType.VarChar,    200),
                new SqlParameter("@tel",               SqlDbType.VarChar,    100),
                new SqlParameter("@address",           SqlDbType.VarChar,    200),
                new SqlParameter("@personLimite",      SqlDbType.Int,          4),
                new SqlParameter("@notice",            SqlDbType.VarChar,    300),
                new SqlParameter("@hotelintroduction", SqlDbType.VarChar,    500),
                new SqlParameter("@email",             SqlDbType.VarChar,    200),
                new SqlParameter("@emailpwd",          SqlDbType.VarChar,    100),
                new SqlParameter("@stmp",              SqlDbType.VarChar,    100),
                new SqlParameter("@css",               SqlDbType.VarChar,    200),
                //new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@kcType",            SqlDbType.VarChar,   4000),
                new SqlParameter("@miaoshu",           SqlDbType.VarChar,    200),
                new SqlParameter("@xplace",            SqlDbType.Float,        8),
                new SqlParameter("@yplace",            SqlDbType.Float,        8),
                new SqlParameter("@hoteltimeBegin1",   SqlDbType.DateTime),
                new SqlParameter("@hoteltimeEnd1",     SqlDbType.DateTime),
                new SqlParameter("@hoteltimeBegin2",   SqlDbType.DateTime),
                new SqlParameter("@hoteltimeEnd2",     SqlDbType.DateTime),
                new SqlParameter("@id",                SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.hotelName;
            parameters[2].Value  = model.hotelLogo;
            parameters[3].Value  = model.hoteltimeBegin;
            parameters[4].Value  = model.hoteltimeEnd;
            parameters[5].Value  = model.limiteOrder;
            parameters[6].Value  = model.dcRename;
            parameters[7].Value  = model.sendPrice;
            parameters[8].Value  = model.sendCost;
            parameters[9].Value  = model.freeSendcost;
            parameters[10].Value = model.radius;
            parameters[11].Value = model.sendArea;
            parameters[12].Value = model.tel;
            parameters[13].Value = model.address;
            parameters[14].Value = model.personLimite;
            parameters[15].Value = model.notice;
            parameters[16].Value = model.hotelintroduction;
            parameters[17].Value = model.email;
            parameters[18].Value = model.emailpwd;
            parameters[19].Value = model.stmp;
            parameters[20].Value = model.css;
            //parameters[21].Value = model.createDate;
            parameters[21].Value = model.kcType;
            parameters[22].Value = model.miaoshu;
            parameters[23].Value = model.xplace;
            parameters[24].Value = model.yplace;
            parameters[25].Value = model.hoteltimeBegin1;
            parameters[26].Value = model.hoteltimeEnd1;
            parameters[27].Value = model.hoteltimeBegin2;
            parameters[28].Value = model.hoteltimeEnd2;
            parameters[29].Value = model.id;

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

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