/// <summary> /// 列表 /// </summary> /// <returns></returns> protected string GetList() { ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table(); ShowShop.BLL.Accessories.Hailhellowlink bll = new ShowShop.BLL.Accessories.Hailhellowlink(); ChangeHope.DataBase.DataByPage dataPage = bll.GetList(); //第一步先添加表头 table.AddHeadCol("", "序号"); table.AddHeadCol("", "会员名称"); table.AddHeadCol("", "优先级"); table.AddHeadCol("", "点击数"); table.AddHeadCol("", "会员类型"); table.AddHeadCol("", "审核状态"); table.AddHeadCol("", "操作"); table.AddRow(); //添加表的内容 if (dataPage.DataReader != null) { int curpage = ChangeHope.WebPage.PageRequest.GetInt("pageindex"); if (curpage < 0) { curpage = 1; } int count = 0; while (dataPage.DataReader.Read()) { count++; string No = (15 * (curpage - 1) + count).ToString(); table.AddCol(No); table.AddCol(string.Format("<a href='?id={0}'>{1}</a>", dataPage.DataReader["id"].ToString(), dataPage.DataReader["sitename"].ToString())); table.AddCol(string.Format("<input id='leavel{0}' value='{1}' size='5' onblur='SetLeavel({0})'/>", dataPage.DataReader["id"].ToString(), dataPage.DataReader["sitelevel"].ToString())); table.AddCol(dataPage.DataReader["siteclickcount"].ToString()); table.AddCol(dataPage.DataReader["putouttyid"].ToString() == "0" ? "管理员" : "会员"); table.AddCol(string.Format("<img src='../images/{0}.gif' alt='审核与否'/>", dataPage.DataReader["sitestate"].ToString())); table.AddCol(string.Format("<a href=hailhellowlink_edit.aspx?id={0}>编辑</a> <a href='javascript:void(0)' onclick='Del({0})'>删除</a>", dataPage.DataReader["id"].ToString())); table.AddRow(); } } string view = table.GetTable() + dataPage.PageToolBar; dataPage.Dispose(); dataPage = null; return view; }
/// <summary> /// 显示编辑信息 /// </summary> /// <param name="id"></param> protected void BandInfo(int id) { ShowShop.BLL.Accessories.Hailhellowlink bll = new ShowShop.BLL.Accessories.Hailhellowlink(); ShowShop.Model.Accessories.Hailhellowlink model = bll.GetModelByID(id); hfAread.Value = model.Aread; this.txtArea.Text = AreaName(model.Aread); this.txtSiteName.Text = model.SiteName; this.txtSiteUrl.Text = model.SiteUrl; this.txtSiteLogo.Text = model.SiteLogo; this.txtSiteLevel.Text = model.SiteLevel.ToString(); this.txtSiteContent.Text = model.SiteContent; this.rablistLinkType.SelectedValue = model.SiteLinkType.ToString(); this.rablistSiteState.SelectedValue = model.SiteState.ToString(); this.txtSiteClickCount.Text = model.SiteClickCount.ToString(); ViewState["CreateDate"] = model.CreateDate.ToString(); ViewState["UpdateDate"] = model.UpdateDate.ToString(); ViewState["PutoutID"] = model.PutoutID.ToString(); ViewState["PutoutTyID"] = model.PutoutTyID.ToString(); ViewState["ID"] = model.ID.ToString(); ViewState["SiteImages"] = model.SiteLogo;// }
/// <summary> /// 保存 /// </summary> protected void Save() { ShowShop.BLL.Accessories.Hailhellowlink bll = new ShowShop.BLL.Accessories.Hailhellowlink(); ShowShop.Model.Accessories.Hailhellowlink model = new ShowShop.Model.Accessories.Hailhellowlink(); ShowShop.Common.SysParameter sp = new ShowShop.Common.SysParameter(); model.SiteName = this.txtSiteName.Text.Trim(); model.SiteUrl = this.txtSiteUrl.Text.Trim(); if (this.txtSiteLogo.Text.Trim() != null && this.txtSiteLogo.Text.Trim() != "" && !this.fuSmallImages.HasFile) { model.SiteLogo = this.txtSiteLogo.Text.Trim(); } else { //获取图片 ChangeHope.Common.UploadFile uf = new ChangeHope.Common.UploadFile(); uf.ExtensionLim = ".gif,.jpg,.jpeg,.dmp"; uf.FileLengthLim = sp.ImageSize; uf.PostedFile = this.fuSmallImages; uf.SavePath = "/yxuploadfile/brand"; if (uf.Upload()) { if (uf.HaveLoad) { model.SiteLogo = uf.FilePath; } else { if (ViewState["SiteImages"] != null) { model.SiteLogo = ViewState["SiteImages"].ToString(); } else { model.SiteLogo = string.Empty; } } } else { this.ltlMsg.Text = "操作失败," + uf.Message + ""; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } } //model.SiteLogo = this.txtSiteLogo.Text.Trim(); model.SiteLevel = Convert.ToInt32(this.txtSiteLevel.Text.Trim()); model.SiteContent = this.txtSiteContent.Text.Trim(); model.SiteLinkType = Convert.ToInt32(this.rablistLinkType.SelectedValue); model.SiteState = Convert.ToInt32(this.rablistSiteState.SelectedValue); model.SiteClickCount = this.txtSiteClickCount.Text == string.Empty ? 0 : Convert.ToInt32(this.txtSiteClickCount.Text.Trim()); model.Aread = this.hfAread.Value != string.Empty ? this.hfAread.Value : "0"; if (ViewState["ID"] != null) { model.ID = Convert.ToInt32(ViewState["ID"].ToString()); model.PutoutID = Convert.ToInt32(ViewState["PutoutID"]); model.PutoutTyID = Convert.ToInt32(ViewState["PutoutTyID"]); model.UpdateDate = DateTime.Now; model.CreateDate = Convert.ToDateTime(ViewState["CreateDate"].ToString()); bll.Amend(model); this.ltlMsg.Text = "操作成功,已保存该信息"; this.BandInfo(model.ID);//刷新 this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } else { //添加时的类型 model.PutoutTyID = 0; ShowShop.Model.Admin.AdminInfo adminModel = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get(); //管理员ID model.PutoutID = adminModel.AdminId; model.CreateDate = DateTime.Now; model.UpdateDate = DateTime.Now; bll.Add(model); this.ltlMsg.Text = "操作成功,已添加该信息"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } }
/// <summary> /// 修改优先级 /// </summary> /// <param name="id"></param> /// <param name="sort"></param> private void SetLeavel(int id, int sitelevel) { ShowShop.BLL.Accessories.Hailhellowlink bll = new ShowShop.BLL.Accessories.Hailhellowlink(); bll.Amend(id, "sitelevel", sitelevel); Response.Write("ok"); }
/// <summary> /// 删除 /// </summary> /// <param name="id"></param> private void Del(int id) { ShowShop.BLL.Accessories.Hailhellowlink bll = new ShowShop.BLL.Accessories.Hailhellowlink(); bll.Delete(id); Response.Write("ok"); }