Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!getUserCookies())
                {
                    Response.Redirect("~/Index.aspx");
                }
                else
                {
                    modeluser = blluser.GetModelByName(uid);

                }
                Spread.Model.WebSet model = new Spread.Model.WebSet();
                //bll.Get_Config(rwc);
                string pathurl = Server.MapPath(ConfigurationManager.AppSettings["WebSetpath"].ToString());
                model = bllSet.loadConfig(pathurl);
                DataTable dtChannel = cbll.GetList(" UserID='" + modeluser.ID + "' ").Tables[0];
                if (dtChannel.Rows.Count >= int.Parse(model.ChannelNum))
                {
                    string myScript = @"alertRedirectMsg('添加渠道不能大于" + model.ChannelNum + "!','error.gif','Channel.aspx');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                    return;
                }
                //TreeBind();
                DataTable dt = bll.GetList("").Tables[0];
                this.rptList.DataSource = dt;
                this.rptList.DataBind();
            }
        }
Example #2
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Spread.Model.Products GetModel(int Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 * from Products ");
			strSql.Append(" where Id=@Id ");
			SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.Int,4)};
			parameters[0].Value = Id;

			Spread.Model.Products model=new Spread.Model.Products();
			DataSet ds=DbHelper.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				if(ds.Tables[0].Rows[0]["Id"].ToString()!="")
				{
					model.Id=int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
				}
                model.Brand = ds.Tables[0].Rows[0]["Brand"].ToString();
                model.Title = ds.Tables[0].Rows[0]["Title"].ToString();
                model.Sort =int.Parse( ds.Tables[0].Rows[0]["Sort"].ToString());
				if(ds.Tables[0].Rows[0]["ClassId"].ToString()!="")
				{
					model.ClassId=int.Parse(ds.Tables[0].Rows[0]["ClassId"].ToString());
				}
				if(ds.Tables[0].Rows[0]["AddTime"].ToString()!="")
				{
					model.AddTime=DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString());
				}
                model.Url = ds.Tables[0].Rows[0]["Url"].ToString();
                model.ImgUrl = ds.Tables[0].Rows[0]["ImgUrl"].ToString();
                model.AddUser = ds.Tables[0].Rows[0]["AddUser"].ToString();
                model.Keyword = ds.Tables[0].Rows[0]["Keyword"].ToString();
                if (ds.Tables[0].Rows[0]["IsTop"].ToString() != "")
                {
                    model.IsTop = Convert.ToBoolean(ds.Tables[0].Rows[0]["IsTop"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsLock"].ToString() != "")
                {
                    model.IsLock = Convert.ToBoolean(ds.Tables[0].Rows[0]["IsLock"].ToString());
                }
				return model;
			}
			else
			{
				return null;
			}
		}