//绑定数据 private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryIntValue("page", 1); this.txtKeywords.Text = Utils.Htmls(this.keywords); this.ddlClassID.SelectedValue = this.class_id.ToString(); DataTable dt = new BLL.plugin_images().GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount).Tables[0]; dt.Columns.Add("class_title", Type.GetType("System.String")); if (dt.Rows.Count > 0) { int cid = 0; Model.plugin_images_class cmodel; BLL.plugin_images_class bll = new BLL.plugin_images_class(); for (int i = 0; i < dt.Rows.Count; i++) { cid = int.Parse(dt.Rows[i]["class_id"].ToString()); cmodel = bll.GetModel(cid); if (null != cmodel) { dt.Rows[i]["class_title"] = cmodel.title; } } } this.rptList.DataSource = dt; this.rptList.DataBind(); //绑定页码 this.txtPageNum.Text = pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("images_list.aspx", "keywords={0}&class_id={1}&page={2}", keywords, this.class_id.ToString(), "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
/// <summary> /// 批量删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_images_class", DTEnums.ActionEnum.Delete.ToString()); BLL.plugin_images_class bll = new BLL.plugin_images_class(); int sucCount = 0; int errorCount = 0; Repeater rptList = new Repeater(); rptList = this.rptList; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount++; } else { errorCount++; } } } AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除广告橱窗位成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("成功删除 " + sucCount + " 条,失败 " + errorCount + " 条!", Utils.CombUrlTxt("class_list.aspx", "keywords={0}", this.keywords)); }
private void TreeBind() { BLL.plugin_images_class bll = new BLL.plugin_images_class(); DataTable dt = bll.GetList(0, "is_lock=0", "sort_id asc,id asc").Tables[0]; this.ddlClassId.Items.Clear(); this.ddlClassId.Items.Add(new ListItem("选择标橱窗位", "")); foreach (DataRow dr in dt.Rows) { this.ddlClassId.Items.Add(new ListItem(dr["title"].ToString().Trim(), dr["id"].ToString().Trim())); } }
private void ShowInfo(int _id) { BLL.plugin_images_class bll = new BLL.plugin_images_class(); Model.plugin_images_class model = bll.GetModel(_id); txtName.Text = model.title; txtCallIndex.Text = model.call_index; txtNum.Text = model.num.ToString(); txtHeight.Text = model.height.ToString(); txtWidth.Text = model.width.ToString(); txtSort.Text = model.sort_id.ToString(); rblHide.SelectedValue = model.is_lock.ToString(); }
//绑定数据 private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryIntValue("page", 1); this.txtKeywords.Text = Utils.Htmls(this.keywords); BLL.plugin_images_class bll = new BLL.plugin_images_class(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 this.txtPageNum.Text = pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("class_list.aspx", "keywords={0}&page={1}", keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
/// <summary> /// 根据ID查询图片 /// </summary> /// <param name="id">ID</param> /// <returns>返回 Model</returns> public DataTable get_images_list(string call_index) { DataTable dt = new DataTable(); if (null != call_index && call_index.Length > 0) { Model.plugin_images_class model = new BLL.plugin_images_class().GetModel(call_index); if (null != model && model.is_lock == 0) { DataTable old = new BLL.plugin_images().GetList(model.num, "is_lock=0 and class_id=" + model.id, "sort_id asc,id desc").Tables[0]; dt = add_class_info(old, model); } } return(dt); }
/// <summary> /// 保存排序 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_images_class", DTEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.plugin_images_class bll = new BLL.plugin_images_class(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "sort_id=" + sortId.ToString()); } JscriptMsg("保存排序成功!", Utils.CombUrlTxt("class_list.aspx", "keywords={0}", this.keywords)); }
private bool DoEdit(int _id) { BLL.plugin_images_class bll = new BLL.plugin_images_class(); Model.plugin_images_class model = bll.GetModel(_id); model.title = txtName.Text.Trim(); model.call_index = txtCallIndex.Text.Trim(); model.num = Utils.StrToInt(txtNum.Text.Trim(), 10); model.width = Utils.StrToInt(txtWidth.Text.Trim(), 100); model.height = Utils.StrToInt(txtHeight.Text.Trim(), 100); model.is_lock = int.Parse(rblHide.SelectedValue); model.sort_id = Utils.StrToInt(txtSort.Text, 99); if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改广告橱窗位信息" + model.title); //记录日志 return(true); } return(false); }
/// <summary> /// 根据标记名查询内容列表 /// </summary> /// <param name="call_index">call_index</param> /// <returns>返回内容</returns> public DataTable get_images_list(string call_index, string _strWhere, string filedOrder) { DataTable dt = new DataTable(); if (null != call_index && call_index.Length > 0) { Model.plugin_images_class model = new BLL.plugin_images_class().GetModel(call_index); if (null != model && model.is_lock == 0) { string strWhere = "is_lock=0 and class_id=" + model.id; if (null != _strWhere && _strWhere.Length > 0) { strWhere += " and " + _strWhere; } DataTable old = new BLL.plugin_images().GetList(model.num, strWhere, filedOrder).Tables[0]; dt = add_class_info(old, model); } } return(dt); }