Ejemplo n.º 1
0
 /// <summary>
 /// 特色采摘
 /// </summary>
 public void Bindtscz(string types)
 {
     if (Request.QueryString["ids"] != null && Request.QueryString["ids"].ToString() != "")
     {
         specialPickmodel = specialPickbll.GetModel(Convert.ToInt32(Request.QueryString["ids"]));
         if (specialPickmodel != null)
         {
             contentstr = specialPickmodel.Introduction;
             headname   = specialPickmodel.Name;
             if (specialPickmodel.Picture.ToString() != "")
             {
                 string[] strlist = specialPickmodel.Picture.ToString().Split(',');
                 if (strlist.Length > 0)
                 {
                     picimageurl1 = geturl(strlist[0].Trim(), types);
                     if (strlist.Length > 1)
                     {
                         picimageurl2 = geturl(strlist[1].Trim(), types);
                     }
                     if (strlist.Length > 2)
                     {
                         picimageurl3 = geturl(strlist[2].Trim(), types);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(HeqiaoDaoshiCore.Model.SpecialPick model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SpecialPick(");
            strSql.Append("CreateTime,SpecialPickUUID,Name,Phone,Introduction,Address,Price,Picture,State,IsDelete,Cover,Lon,Lat,ytype,PlayType)");
            strSql.Append(" values (");
            strSql.Append("@CreateTime,@SpecialPickUUID,@Name,@Phone,@Introduction,@Address,@Price,@Picture,@State,@IsDelete,@Cover,@Lon,@Lat,@ytype,@PlayType)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CreateTime",      SqlDbType.DateTime),
                new SqlParameter("@SpecialPickUUID", SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@Name",            SqlDbType.NVarChar,          50),
                new SqlParameter("@Phone",           SqlDbType.NVarChar,          -1),
                new SqlParameter("@Introduction",    SqlDbType.NVarChar,          -1),
                new SqlParameter("@Address",         SqlDbType.NVarChar,          -1),
                new SqlParameter("@Price",           SqlDbType.NVarChar,          -1),
                new SqlParameter("@Picture",         SqlDbType.NVarChar,          -1),
                new SqlParameter("@State",           SqlDbType.Int,                4),
                new SqlParameter("@IsDelete",        SqlDbType.Int,                4),
                new SqlParameter("@Cover",           SqlDbType.VarChar,          255),
                new SqlParameter("@Lon",             SqlDbType.NVarChar,         255),
                new SqlParameter("@Lat",             SqlDbType.NVarChar,         255),
                new SqlParameter("@ytype",           SqlDbType.NVarChar,         255),
                new SqlParameter("@PlayType",        SqlDbType.NVarChar, 255)
            };
            parameters[0].Value  = model.CreateTime;
            parameters[1].Value  = Guid.NewGuid();
            parameters[2].Value  = model.Name;
            parameters[3].Value  = model.Phone;
            parameters[4].Value  = model.Introduction;
            parameters[5].Value  = model.Address;
            parameters[6].Value  = model.Price;
            parameters[7].Value  = model.Picture;
            parameters[8].Value  = model.State;
            parameters[9].Value  = model.IsDelete;
            parameters[10].Value = model.Cover;
            parameters[11].Value = model.Lon;
            parameters[12].Value = model.Lat;
            parameters[13].Value = model.ytype;
            parameters[14].Value = model.PlayType;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HeqiaoDaoshiCore.Model.SpecialPick GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,CreateTime,SpecialPickUUID,Name,Phone,Introduction,Address,Price,Picture,State,IsDelete,Cover,Lon,Lat,ytype,PlayType from SpecialPick ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            HeqiaoDaoshiCore.Model.SpecialPick model = new HeqiaoDaoshiCore.Model.SpecialPick();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public HeqiaoDaoshiCore.Model.SpecialPick DataRowToModel(DataRow row)
 {
     HeqiaoDaoshiCore.Model.SpecialPick model = new HeqiaoDaoshiCore.Model.SpecialPick();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["CreateTime"] != null && row["CreateTime"].ToString() != "")
         {
             model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
         }
         if (row["SpecialPickUUID"] != null && row["SpecialPickUUID"].ToString() != "")
         {
             model.SpecialPickUUID = new Guid(row["SpecialPickUUID"].ToString());
         }
         if (row["Name"] != null)
         {
             model.Name = row["Name"].ToString();
         }
         if (row["Phone"] != null)
         {
             model.Phone = row["Phone"].ToString();
         }
         if (row["Introduction"] != null)
         {
             model.Introduction = row["Introduction"].ToString();
         }
         if (row["Address"] != null)
         {
             model.Address = row["Address"].ToString();
         }
         if (row["Price"] != null)
         {
             model.Price = row["Price"].ToString();
         }
         if (row["Picture"] != null)
         {
             model.Picture = row["Picture"].ToString();
         }
         if (row["State"] != null && row["State"].ToString() != "")
         {
             model.State = int.Parse(row["State"].ToString());
         }
         if (row["IsDelete"] != null && row["IsDelete"].ToString() != "")
         {
             model.IsDelete = int.Parse(row["IsDelete"].ToString());
         }
         if (row["Cover"] != null)
         {
             model.Cover = row["Cover"].ToString();
         }
         if (row["Lon"] != null)
         {
             model.Lon = row["Lon"].ToString();
         }
         if (row["Lat"] != null)
         {
             model.Lat = row["Lat"].ToString();
         }
         if (row["ytype"] != null)
         {
             model.ytype = row["ytype"].ToString();
         }
         if (row["PlayType"] != null)
         {
             model.PlayType = row["PlayType"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(HeqiaoDaoshiCore.Model.SpecialPick model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SpecialPick set ");
            strSql.Append("CreateTime=@CreateTime,");
            strSql.Append("Name=@Name,");
            strSql.Append("Phone=@Phone,");
            strSql.Append("Introduction=@Introduction,");
            strSql.Append("Address=@Address,");
            strSql.Append("Price=@Price,");
            strSql.Append("Picture=@Picture,");
            strSql.Append("State=@State,");
            strSql.Append("IsDelete=@IsDelete,");
            strSql.Append("Cover=@Cover,");
            strSql.Append("Lon=@Lon,");
            strSql.Append("Lat=@Lat,");
            strSql.Append("ytype=@ytype,");
            strSql.Append("PlayType=@PlayType");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CreateTime",      SqlDbType.DateTime),
                new SqlParameter("@Name",            SqlDbType.NVarChar,          50),
                new SqlParameter("@Phone",           SqlDbType.NVarChar,          -1),
                new SqlParameter("@Introduction",    SqlDbType.NVarChar,          -1),
                new SqlParameter("@Address",         SqlDbType.NVarChar,          -1),
                new SqlParameter("@Price",           SqlDbType.NVarChar,          -1),
                new SqlParameter("@Picture",         SqlDbType.NVarChar,          -1),
                new SqlParameter("@State",           SqlDbType.Int,                4),
                new SqlParameter("@IsDelete",        SqlDbType.Int,                4),
                new SqlParameter("@Cover",           SqlDbType.VarChar,          255),
                new SqlParameter("@Lon",             SqlDbType.NVarChar,         255),
                new SqlParameter("@Lat",             SqlDbType.NVarChar,         255),
                new SqlParameter("@ytype",           SqlDbType.NVarChar,         255),
                new SqlParameter("@PlayType",        SqlDbType.NVarChar,         255),
                new SqlParameter("@ID",              SqlDbType.Int,                4),
                new SqlParameter("@SpecialPickUUID", SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value  = model.CreateTime;
            parameters[1].Value  = model.Name;
            parameters[2].Value  = model.Phone;
            parameters[3].Value  = model.Introduction;
            parameters[4].Value  = model.Address;
            parameters[5].Value  = model.Price;
            parameters[6].Value  = model.Picture;
            parameters[7].Value  = model.State;
            parameters[8].Value  = model.IsDelete;
            parameters[9].Value  = model.Cover;
            parameters[10].Value = model.Lon;
            parameters[11].Value = model.Lat;
            parameters[12].Value = model.ytype;
            parameters[13].Value = model.PlayType;
            parameters[14].Value = model.ID;
            parameters[15].Value = model.SpecialPickUUID;

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

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