public void ProcessRequest(HttpContext context) { Model.qqonline_config config = new BLL.qqonline_config().loadConfig(); if (config.status == 1) { context.Response.Write("{ \"msg\":\"在线客服功能未开启!\", \"status\":0 }"); return; } DataTable dt = new BLL.plugin_qqonline().GetList(0, "is_lock=0", "sort_id asc,id desc").Tables[0]; if (dt.Rows.Count > 0) { dt.Columns.Remove("id"); dt.Columns.Remove("is_lock"); dt.Columns.Remove("sort_id"); dt.Columns.Remove("add_time"); dt.Columns["qq"].ColumnName = "q"; dt.Columns["img_url"].ColumnName = "i"; dt.Columns["link_url"].ColumnName = "u"; dt.Columns["username"].ColumnName = "n"; dt.Columns["color"].ColumnName = "c"; } JsonHelper.WriteJson(context, new { status = 1, path = siteConfig.webpath, code = config.code, position = config.position, remark = config.remark, skin = config.pattern, list = dt }); }
/// <summary> /// 批量删除 /// </summary> protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_qqonline_list", DTEnums.ActionEnum.Delete.ToString()); BLL.plugin_qqonline bll = new BLL.plugin_qqonline(); 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(), "删除QQ在线客服成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("成功删除 " + sucCount + " 条,失败 " + errorCount + " 条!", Utils.CombUrlTxt("online_list.aspx", "keywords={0}", this.keywords)); }
/// <summary> /// 数据绑定 /// </summary> private void RptBind(string _strWhere) { this.page = DTRequest.GetQueryInt("page", 1); this.txtKeywords.Text = this.keywords; BLL.plugin_qqonline bll = new BLL.plugin_qqonline(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, "sort_id asc,id asc", out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("online_list.aspx", "keywords={0}&page={1}", this.keywords, "__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 btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_qqonline_list", DTEnums.ActionEnum.Edit.ToString()); BLL.plugin_qqonline bll = new BLL.plugin_qqonline(); 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()); } AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改QQ在线客服排序!"); //记录日志 JscriptMsg("保存排序成功!", Utils.CombUrlTxt("online_list.aspx", "keywords={0}", this.keywords)); }
//赋值操作 private void ShowInfo(int _id) { BLL.plugin_qqonline bll = new BLL.plugin_qqonline(); Model.plugin_qqonline model = bll.GetModel(_id); txtUserName.Text = model.username; txtQQ.Text = model.qq; txtColor.Text = model.color; if (model.is_lock == 0) { cbStatus.Checked = true; } else { cbStatus.Checked = false; } txtSort.Text = model.sort_id.ToString(); txtUrl.Text = model.link_url; rblPicList.SelectedValue = model.img_url; }
//增加操作 private bool DoAdd() { BLL.plugin_qqonline bll = new BLL.plugin_qqonline(); Model.plugin_qqonline model = new Model.plugin_qqonline(); model.username = txtUserName.Text.Trim(); model.qq = txtQQ.Text.Trim(); model.color = txtColor.Text; if (cbStatus.Checked == false) { model.is_lock = 1; } model.sort_id = Utils.StrToInt(txtSort.Text.Trim(), 99); model.link_url = txtUrl.Text.Trim(); model.img_url = rblPicList.SelectedValue; if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "添加QQ在线客服:" + model.username); return(true); } return(false); }