data/attach/1904/b8njwyrlx35fxx4e8kvc45b587a0cmb7.jpg
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="companyList.aspx.cs" Inherits="DTcms.Web.admin.oacmp.companyList" %>
<%@ Import namespace="DTcms.Common" %>
内容列表
using DTcms.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace DTcms.Web.admin.oacmp
{
public partial class companyList : Web.UI.ManagePage
{
protected int totalCount;
protected int page;
protected int pageSize;
protected int category_id;
protected string channel_name = string.Empty;
protected string property = string.Empty;
protected string keywords = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
this.category_id = DTRequest.GetQueryInt("category_id");
this.keywords = DTRequest.GetQueryString("keywords");
this.property = DTRequest.GetQueryString("property");
this.pageSize = GetPageSize(10); //每页数量
if (!Page.IsPostBack)
{
SchoolChkAdminLevel(); //检查权限
RptBind(keywords);
}
}
#region 数据绑定=================================
private void RptBind(string keywords)
{
this.page = DTRequest.GetQueryInt("page", 1);
//this.ddlProperty.SelectedValue = this.property;
this.txtKeywords.Text = this.keywords;
//图表或列表显示
BLL.oa_company bll = new BLL.oa_company();
int begin = (this.page - 1) * pageSize;
this.rptList1.DataSource = bll.GetListByPage("companyname like '%" + keywords + "%' ", " companyid desc ", begin, pageSize);
this.rptList1.DataBind();
//绑定页码
txtPageNum.Text = this.pageSize.ToString();
string pageUrl = Utils.CombUrlTxt("companyList.aspx", "page={0}&keywords={1}", "__id__", this.keywords);
this.totalCount = bll.GetAllList().Tables[0].Rows.Count;
PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, bll.GetList("companyname like '%" + keywords + "%' ").Tables[0].Rows.Count, pageUrl, 8);
}
#endregion
#region 返回每页数量=========================
private int GetPageSize(int _default_size)
{
int _pagesize;
if (int.TryParse(Utils.GetCookie("company_page_size"), out _pagesize))
{
if (_pagesize > 0)
{
return _pagesize;
}
}
return _default_size;
}
#endregion
//关健字查询
protected void btnSearch_Click(object sender, EventArgs e)
{
Response.Redirect(Utils.CombUrlTxt("companyList.aspx", "keywords={0}", txtKeywords.Text));
}
//设置分页数量
protected void txtPageNum_TextChanged(object sender, EventArgs e)
{
int _pagesize;
if (int.TryParse(txtPageNum.Text.Trim(), out _pagesize))
{
if (_pagesize > 0)
{
Utils.WriteCookie("company_page_size", _pagesize.ToString(), 43200);
}
}
Response.Redirect(Utils.CombUrlTxt("companyList.aspx", "keywords={0}&property={1}", this.keywords, this.property));
}
public void SchoolChkAdminLevel()
{
Model.manager model = GetAdminInfo();
if (model.role_type > 3)
{
string msgbox = "parent.jsdialog("错误提示", "您没有管理该页面的权限,请勿非法进入!", "back", "Error")";
Response.Write("");
Response.End();
}
}
//批量删除
protected void btnDelete_Click(object sender, EventArgs e)
{
SchoolChkAdminLevel(); //检查权限
int sucCount = 0; //成功数量
int errorCount = 0; //失败数量
BLL.oa_company bll = new BLL.oa_company();
Repeater rptList = new Repeater();
rptList = this.rptList1;
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(), "删除学校成功"); //记录日志
JscriptMsg("删除成功", "companyList.aspx", "Success");
}
}
}