You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
5.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL.Sys;
namespace CPCBILLSYS
{
public partial class Default : System.Web.UI.Page
{
public string userID = "";
public string name = "高速集中管理系统-" + CommonHelper._userStaName;
public string currAreaName = "";
//public List<AreaInfo> listArea = new List<AreaInfo>();
UserCtrlBLL bll = new UserCtrlBLL(CommonHelper._dbType, CommonHelper.DbConStr);
//如果更改了程序,必须修改本版本号并做好日志
public string bbh = "3.1.0.0";
protected void Page_Load(object sender, EventArgs e)
{
string id = Request.QueryString["id"];
if (string.IsNullOrEmpty(id) && Session["UserID"] == null)
{
Response.Redirect("login.htm");
}
if (!IsPostBack)
{
//说明是切换来的
if (Session["UserID"] == null && !string.IsNullOrEmpty(id))
{
string decID = CommonHelper.DecryptDES(id, "58612911");
// LogClass.WriteLog(string.Format("id:{0},,,,,decid:{1}", id, decID), "", 0);
//检查下是否有这个用户, 假如没有这个用户
if (bll.GetUserCount(" and manno=" + decID) == 0)
{
Response.Write("<script>alert('当前系统没有这个用户!');window.location.href='../login.htm'</script>");
return;
}
else
{
Session["UserID"] = decID;
}
}
userID = Session["UserID"].ToString();
//string where = string.IsNullOrEmpty(CommonHelper.HideSystemID.Trim()) ? " " : " and sysid not in (" + CommonHelper.HideSystemID.Trim() + ")";
string where = " and sysid=7300";
this.RepeaterPage.DataSource = GetList(where);
RepeaterPage.DataBind();
}
}
public void Show(System.Web.UI.Page page, string msg)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "message", "<script language='javascript' defer>alert('" + msg.ToString() + "');</script>");
}
public List<PageInfo> GetList(string where)
{
DataTable dt = bll.GetAllEnableSys(where);
int pageCount = Convert.ToInt32(Math.Ceiling(dt.Rows.Count * 1.0 / 15));
List<PageInfo> list = new List<PageInfo>();
for (int i = 0; i < pageCount; i++)
{
int min = i * 15;
int max = (i + 1) * 15 - 1;
List<SystemInfo> sysList = new List<SystemInfo>();
for (int j = min; j <= max; j++)
{
if (j < dt.Rows.Count)
{
DataRow dr = dt.Rows[j];
SystemInfo si = new SystemInfo(Convert.ToInt32(dr["SYSID"].ToString()), dr["IMGURL"].ToString(), dr["SYSNAME"].ToString());
sysList.Add(si);
}
else
{
break;
}
}
PageInfo pi = new PageInfo(i, sysList);
list.Add(pi);
}
return list;
}
}
public class PageInfo
{
private int pageID;
public int PageID
{
get { return pageID; }
set { pageID = value; }
}
private IList<SystemInfo> sysList;
public IList<SystemInfo> SysList
{
get { return sysList; }
set { sysList = value; }
}
public PageInfo(int id, IList<SystemInfo> list)
{
this.pageID = id;
this.sysList = list;
}
}
public class SystemInfo
{
string imgUrl, sysName;
public string SysName
{
get { return sysName; }
set { sysName = value; }
}
public string ImgUrl
{
get { return imgUrl; }
set { imgUrl = value; }
}
int sysID;
public int SysID
{
get { return sysID; }
set { sysID = value; }
}
public SystemInfo(int id, string url, string name)
{
this.sysID = id;
this.imgUrl = url;
this.sysName = name;
}
}
public class AreaInfo
{
string areaID;
public string AreaID
{
get { return areaID; }
set { areaID = value; }
}
string iP, areaName;
public string AreaName
{
get { return areaName; }
set { areaName = value; }
}
public string IP
{
get { return iP; }
set { iP = value; }
}
public AreaInfo(string id, string name, string ip)
{
this.areaID = id;
this.areaName = name;
this.iP = ip;
}
}
}