protected void lbtnDel_Click(object sender, EventArgs e) { CMS.DAL.CMS_Product dal = new CMS.DAL.CMS_Product(); CMS.Model.CMS_Product model = new CMS.Model.CMS_Product(); for (int i = 0; i < gvdataList.Rows.Count; i++) { Label label = (Label)gvdataList.Rows[i].FindControl("lb_id"); int id = Convert.ToInt32(label.Text); CheckBox cb = (CheckBox)gvdataList.Rows[i].FindControl("cb_id"); if (cb.Checked) { model = dal.GetModel(id); //删除图片 DeleteFile(model.CMS_ProductImg); //保存日志 // SaveLogs("[资讯模块]删除文章:" + model.Title); //删除记录 //bll.Delete(kindId, id); dal.Delete(id); } } JscriptPrint("批量删除成功啦!", "ProductsList.aspx", "Success"); }
private void InitData() { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { int id = Int32.Parse(Request.QueryString["id"]); CMS.Model.CMS_Product model = new CMS.Model.CMS_Product(); CMS.DAL.CMS_Product dal = new CMS.DAL.CMS_Product(); model = dal.GetModel(id); string ProductImg = model.CMS_ProductImg; string ProductName = model.CMS_ProductName; StringBuilder str = new StringBuilder(); str.Append("<a href='" + ProductImg + "' title=\"" + ProductName + "\">"); str.Append("<img alt=\"" + ProductName + "\" src=\"" + ProductImg + "\" Width=\"300\" Height=\"300\" class=\"photo\"/>"); str.Append("</a>"); this.lblimgproduct.Text = str.ToString(); this.lblProductName.Text = model.CMS_ProductName; this.lblProductClass.Text = model.CMS_ProductClassID.ToString(); this.lblContent.Text = model.CMS_ProductContent; } }
/// <summary> /// 载入首页推荐产品 /// </summary> private void InitIndexProduct() { StringBuilder strHTML = new StringBuilder(); strHTML.Append("<table style=\"width: 100%;\" align=\"left\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">"); strHTML.Append("<tr>"); CMS.DAL.CMS_Product dal = new CMS.DAL.CMS_Product(); DataTable dt = dal.GetFlashList(); for (int i = 0; i < dt.Rows.Count; i++) { string strID = dt.Rows[i]["ID"].ToString(); string strProductImg = dt.Rows[i]["CMS_ProductImg"].ToString(); string strProductName = dt.Rows[i]["CMS_ProductName"].ToString(); strHTML.Append("<td valign=\"top\" width=\"150\">"); strHTML.Append("<a href=\"ProductView.aspx?id=" + strID + " \" target=\"_blank\"> <img src=\"" + strProductImg + "\" alt=\"\" width=\"150\" height=\"150\" border=\"0\" /></a>"); strHTML.Append(" "); strHTML.Append("<span style=\"text-align:center\">" + strProductName + "</span>"); strHTML.Append("</td>"); strHTML.Append("<td valign=\"top\" width=\"5px\">"); strHTML.Append("</td>"); } strHTML.Append("</tr>"); strHTML.Append("</table>"); this.ltrIndexProductHTML.Text = strHTML.ToString(); }
/// <summary> /// 绑定数据 /// </summary> /// <param name="PageIndex">页码</param> private void ListDataBind(int PageIndex) { int num = 15, i = 0, j = 0; CMS.DAL.CMS_Product dal = new CMS.DAL.CMS_Product(); CMS.DAL.CMS_ProductClass dalClass = new CMS.DAL.CMS_ProductClass(); string strWhere = ""; if (!string.IsNullOrEmpty(Request.QueryString["class"])) { string strclassid = Request.QueryString["class"]; int classid = int.Parse(strclassid); CMS.Model.CMS_ProductClass model = dalClass.GetModel(classid); string classidlist = model.CMS_ClassIdList;//树结构列表 StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT ID FROM CMS_ProductClass"); strSql.Append(" where CMS_ClassIdList like '" + classidlist + "%'"); strWhere = " CMS_ProductClassID in ("+strSql.ToString()+")"; } DataTable dt = dal.GetPagesAll(strWhere, PageIndex, num, out i, out j); this.PageNavigator1.PageCount = j; this.PageNavigator1.PageIndex = PageIndex; this.PageNavigator1.RecordCount = i; this.Repeater1.DataSource = dt; this.Repeater1.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { int ID = int.Parse(this.hdfid.Value); string CMS_ProductName = this.txtProductName.Text; int CMS_ProductClassID = int.Parse(this.ddlProductClass.SelectedValue); string CMS_ProductContent = this.txtContent.Value; string CMS_ProductImg = this.txtProductImg.Text; DateTime CMS_AddTime = DateTime.Now; ; string CMS_Puter = this.txtPuter.Text; int CMS_IsSlide = (cbxIsSlide.Checked)?1:0; CMS.Model.CMS_Product model = new CMS.Model.CMS_Product(); model.ID = ID; model.CMS_ProductName = CMS_ProductName; model.CMS_ProductClassID = CMS_ProductClassID; model.CMS_ProductContent = CMS_ProductContent; model.CMS_ProductImg = CMS_ProductImg; model.CMS_AddTime = CMS_AddTime; model.CMS_Puter = CMS_Puter; model.CMS_IsSlide = CMS_IsSlide; CMS.DAL.CMS_Product bll = new CMS.DAL.CMS_Product(); bll.Update(model); JscriptPrint("产品信息修改成功!", "ProductsList.aspx", "Success"); }
/// <summary> /// 绑定数据 /// </summary> /// <param name="PageIndex">页码</param> private void ListDataBind(int PageIndex) { int num = 15, i = 0, j = 0; string strWhere = ""; CMS.DAL.CMS_Product dal = new CMS.DAL.CMS_Product(); DataTable dt = dal.GetPagesAll(strWhere,PageIndex, num, out i, out j); this.PageNavigator1.PageCount = j; this.PageNavigator1.PageIndex = PageIndex; this.PageNavigator1.RecordCount = i; gvdataList.DataSource = dt; gvdataList.DataBind(); }
private void ShowInfo(int ID) { CMS.DAL.CMS_Product bll = new CMS.DAL.CMS_Product(); CMS.Model.CMS_Product model = bll.GetModel(ID); this.hdfid.Value = model.ID.ToString(); this.txtProductName.Text = model.CMS_ProductName; this.ddlProductClass.SelectedValue = model.CMS_ProductClassID.ToString(); this.txtContent.Value = model.CMS_ProductContent; this.txtProductImg.Text = model.CMS_ProductImg; this.txtPuter.Text = model.CMS_Puter; this.cbxIsSlide.Checked = (model.CMS_IsSlide == 1) ? true : false; }