protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { AboutSiteDAO abdao = new AboutSiteDAO(); aboutMy abmy = abdao.AboutSiteSelect(); lblMy.Text = abmy.AboutSite; lblMyName.Text = abmy.MyName; lblOccupation.Text = abmy.Occupation; lblIntroduction.Text = abmy.Introduction; RepJs.DataSource = new codeContentCssDAO().CodeContentCssSelectCaNamehaha("js"); RepJs.DataBind(); RepCss.DataSource = new codeContentCssDAO().CodeContentCssSelectCaNamehaha("css"); RepCss.DataBind(); RepHtml.DataSource = new codeContentCssDAO().CodeContentCssSelectCaNamehaha("html"); RepHtml.DataBind(); RepAsp.DataSource = new codeContentCssDAO().CodeContentCssSelectCaNamehaha("asp"); RepAsp.DataBind(); RepOne.DataSource = new codeContentCssDAO().CodeContentCssSelectCaNamehaha("其它"); RepOne.DataBind(); RepNewsCont.DataSource = new codeContentCssDAO().codeContentCssSelectTop(); RepNewsCont.DataBind(); RepNewsTop.DataSource = new RecmdDAO().recmdSelecTop(); RepNewsTop.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { AboutSiteDAO abdao = new AboutSiteDAO(); aboutMy abmy = abdao.AboutSiteSelect(); lblMy.Text = abmy.AboutSite; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { AboutSiteDAO abdao = new AboutSiteDAO(); aboutMy abmy = abdao.AboutSiteSelect(); lblMy.Text = abmy.AboutSite; RepSay.DataSource = new SayDAO().SayAll(); RepSay.DataBind(); } }
/// <summary> /// 查询关于我们 /// </summary> /// <returns></returns> public aboutMy AboutSiteSelect() { DataTable dt = new DataTable(); aboutMy about = new aboutMy(); string sql = "SELECT * FROM aboutSiteText"; dt = sqlhelper.GetDataTable(sql); about.Id = dt.Rows[0]["id"].ToString(); about.AboutSite = dt.Rows[0]["aboutSite"].ToString(); about.MyName = dt.Rows[0]["myName"].ToString(); about.Occupation = dt.Rows[0]["occupation"].ToString(); about.Introduction = dt.Rows[0]["introduction"].ToString(); about.AboutMyText = dt.Rows[0]["aboutMyText"].ToString(); return(about); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { AboutSiteDAO aboutdao = new AboutSiteDAO(); aboutMy outmy = aboutdao.AboutSiteSelect(); aboutCode.InnerText = outmy.AboutSite; bozhu.Value = outmy.MyName; zhiye.Value = outmy.Occupation; jianjie.InnerText = outmy.Introduction; guanyumy.InnerText = outmy.AboutMyText; RepRiJi.DataSource = new RiJiDAO().RiJiSelectAll(); RepRiJi.DataBind(); RepGuest.DataSource = new GuestBooksDAO().SelectAllGuest(); RepGuest.DataBind(); } }
/// <summary> /// 关于我们 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void modify_Click(object sender, EventArgs e) { aboutMy aboutmy = new aboutMy(); aboutmy.AboutSite = aboutCode.InnerText; aboutmy.MyName = bozhu.Value; aboutmy.Occupation = zhiye.Value; aboutmy.Introduction = jianjie.InnerText; aboutmy.AboutMyText = guanyumy.InnerText; bool res = new AboutSiteDAO().AboutUpdate(aboutmy); if (res) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('关于我们修改成功');</script>"); } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('关于我们修改失败');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { AboutSiteDAO abdao = new AboutSiteDAO(); aboutMy abmy = abdao.AboutSiteSelect(); lblMyName.Text = abmy.MyName; string caid = Request.QueryString["CaId"]; codeContentCssDAO codecssdao = new codeContentCssDAO(); CodeContentCss css = codecssdao.CodeContentCssSelectId(caid); string strTime = css.CreateTime; lblTime.Text = Convert.ToDateTime(strTime).ToString("yyyy-MM-dd"); lblCaName.Text = css.CaName; lblContent.Text = css.NewsContent; lblTitle.Text = css.Title; lblcate.Text = css.CaName; lblExplain.Text = css.Explain; } }
/// <summary> /// 修改关于我们 /// </summary> /// <param name="cont">内容</param> /// <param name="id">id</param> /// <returns></returns> public bool AboutUpdate(aboutMy abmy) { bool falg = false; string sql = "UPDATE aboutSiteText set aboutSite=@aboutSite,myName=@myName,occupation=@occupation,introduction=@introduction,aboutMyText=@aboutMyText "; SqlParameter[] par = { new SqlParameter("@aboutSite", abmy.AboutSite), new SqlParameter("@myName", abmy.MyName), new SqlParameter("@occupation", abmy.Occupation), new SqlParameter("@introduction", abmy.Introduction), new SqlParameter("@aboutMyText", abmy.AboutMyText) }; int res = sqlhelper.ExecuteNonQuery(sql, CommandType.Text, par); if (res > 0) { falg = true; } return(falg); }