protected void Page_Load(object sender, EventArgs e) { //判断通过身份验证的用户是否有权限访问本页面 FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity; //判断通过身份验证的用户是否是Admin角色 if (!id.Ticket.UserData.Contains("admin")) { //跳转到访问权限不够的错误提示页面 Response.Redirect("~/Admin/error.html"); } if (Session["UserIdentity"] != "manager") { Response.Redirect("error1.html"); } if (!IsPostBack) { string page = Request.QueryString["page"]; string act = Request.QueryString["act"]; Int32 this_nav = 1; if (page != null && CommonFunction.IsInt(page)) { this_nav = Convert.ToInt32(page); } int countAll = 0; SqlServerProvider conn = new SqlServerProvider(); conn.Open(); switch (act) { case "all": PanelOrderList.Visible = true; countAll = Convert.ToInt32(conn.GetCmd("Select Count(distinct orderId) as Alldata From Y_Order").ExecuteScalar());//获取多少条数据 GetAllList(this_nav); break; case "edit": PanelOrderList.Visible = false; PanelOrderEdit.Visible = true; break; default: countAll = Convert.ToInt32(conn.GetCmd("Select Count(distinct orderId) as Alldata From Y_Order").ExecuteScalar());//获取多少条数据 GetAllList(this_nav); break; } conn.Close(); int pageCount = (int)Math.Ceiling(countAll / 10.0); string pagenav = ""; int num = 1; if (this_nav <= 10) { num = this_nav; } else { string this_num = this_nav.ToString(); num = Convert.ToInt32(this_num.Substring(this_num.Length - 1, 1)); } int start = this_nav - num + 1; int end = this_nav - num + 10; for (int i = start; i <= end; i++) { if (i <= pageCount) { if (i == start && i > 10) { pagenav += "<li><a href='?act=" + act + "&page=1'>←</a></li>"; pagenav += "<li><a href='?act=" + act + "&page=" + (i - 1) + "'>...</a></li>"; } pagenav += "<li><a"; if (this_nav == i) { pagenav += " class='current'"; } pagenav += " href='?act=" + act + "&page=" + i + "'>" + i + "</a></li>"; if (i == end) { pagenav += "<li><a href='?act=" + act + "&page=" + (i + 1) + "'>...</a></li>"; pagenav += "<li><a href='?act=" + act + "&page=" + pageCount + "'>→</a></li>"; } } } pagenav = "<ul class='pagenavigation'>" + pagenav + "</ul>"; PageList.InnerHtml = pagenav; } }
protected void GetAllList(int this_nav,string act) { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); int pagestart = (this_nav - 1) * 10 + 1; int pageend = this_nav * 10; string sql = "select * from(select o.orderId,o.customerName,o.customerAddress,o.orderTime,o.jiajiGradeId,o.customerMobile,o.isJiesuan,ch.chuliName,s.sendType,o.company,w.name,w.mobile,w.qq,c.conditionType,j.jiajiType,row_number() over (order by o.orderId asc) as num from Y_Order o left outer join Y_OrderCondition c on c.conditionId=o.conditionId left outer join Y_Worker w on w.workerId=o.workerId left outer join Y_OrderSendType s on s.sendTypeId=o.sendTypeId left outer join Y_JiajiType j on j.jiajiTypeId=o.jiajiTypeId left outer join Y_Chuli ch on ch.chuliId=o.chuliId) as s where s.num between '" + pagestart + "' and '" + pageend + "'"; DataSet ds = new DataSet(); ds = conn.GetDataSet(sql, ds, "tb1"); string p_list = ""; if (ds.Tables["tb1"].Rows.Count > 0) { for (int i = 0; i < ds.Tables["tb1"].Rows.Count; i++) { p_list += "<div class='infoBox'><p>工单ID:" + ds.Tables["tb1"].Rows[i]["orderId"] + ".下单时间:" + ds.Tables["tb1"].Rows[i]["orderTime"]; if (Convert.ToInt32(ds.Tables["tb1"].Rows[i]["jiajiGradeId"]) != 1) { p_list += "<span>加急处理等级:" + ds.Tables["tb1"].Rows[i]["jiajiGradeId"] + "</span><span>加急处理类型:" + ds.Tables["tb1"].Rows[i]["jiajiType"] + "</span><span>处理进度:" + ds.Tables["tb1"].Rows[i]["chuliName"] + "</span>"; } if (CommonFunction.BoolenYanzhong(Convert.ToInt32(ds.Tables["tb1"].Rows[i]["orderId"]))) { p_list += "<span>严重超时</span>"; } else if (CommonFunction.BoolenYiban(Convert.ToInt32(ds.Tables["tb1"].Rows[i]["orderId"]))) { p_list += "<span>一般超时</span>"; } p_list += "</p>"; p_list += "<ul><li class='liInput'><input name='subBox' id='subBox' type='checkbox' value='" + ds.Tables["tb1"].Rows[i]["orderId"] + "' /></li><li class='listCustomer'><span class='spanName'>客户姓名:" + ds.Tables["tb1"].Rows[i]["customerName"] + " 客户手机:" + ds.Tables["tb1"].Rows[i]["customerMobile"] + "</span>"; p_list += "<span class='spanAddress'>客户地址:" + ds.Tables["tb1"].Rows[i]["customerAddress"] + "</li><li>" + ds.Tables["tb1"].Rows[i]["company"] + "</li><li>" + ds.Tables["tb1"].Rows[i]["sendType"] + "</li><li>" + ds.Tables["tb1"].Rows[i]["conditionType"] + "</li><li>" + ds.Tables["tb1"].Rows[i]["name"] + ds.Tables["tb1"].Rows[i]["mobile"] + "</li><li class='liEdit'><a href='?act=edit&id=" + ds.Tables["tb1"].Rows[i]["orderId"] + "'>编辑</a><a href='?act=update&id=" + ds.Tables["tb1"].Rows[i]["orderId"] + "'>更新状态</a></li></ul></div>"; } } else { p_list = "<span>暂无该类型的工单</span>"; } int countAll = 0; countAll = Convert.ToInt32(conn.GetCmd("Select Count(distinct orderId) as Alldata From Y_Order").ExecuteScalar());//获取多少条数据 int pageCount = (int)Math.Ceiling(countAll / 10.0); string pagenav = ""; int num = 1; if (this_nav <= 10) { num = this_nav; } else { string this_num = this_nav.ToString(); num = Convert.ToInt32(this_num.Substring(this_num.Length - 1, 1)); } int start = this_nav - num + 1; int end = this_nav - num + 10; for (int i = start; i <= end; i++) { if (i <= pageCount) { if (i == start && i > 10) { pagenav += "<ul><li><a href='?act=" + act + "&page=1'>←</a></li>"; pagenav += "<li><a href='?act=" + act + "&page=" + (i - 10) + "'>...</a></li>"; } pagenav += "<li><a"; if (this_nav == i) { pagenav += " class='current'"; } pagenav += " href='?act=" + act + "&page=" + i + "'>" + i + "</a></li>"; if (i == end) { pagenav += "<li><a href='?act=" + act + "&page=" + (i + 1) + "'>...</a></li>"; pagenav += "<li><a href='?act=" + act + "&page=" + pageCount + "'>→</a></li>"; } } } pagenav = "<ul class='pagenavigation'>" + pagenav + "</ul>"; PageList.InnerHtml = pagenav; conn.Close(); InfoList.InnerHtml = p_list; }
private void GetAddressList(int this_nav) { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); int pagestart = (this_nav - 1) * 10 + 1; int pageend = this_nav * 10; string sql = "select * from(select p.provinceName,c.cityName,a.areaName,a.areaId,row_number() over (order by p.provinceId) as num from Y_Province p left outer join Y_City c on c.provinceId=p.provinceId left outer join Y_Area a on a.cityId=c.cityId) as s where s.num between '" + pagestart + "' and '" + pageend + "'"; DataSet ds = new DataSet(); ds = conn.GetDataSet(sql, ds, "tb1"); string p_list = "<table><tr><td>省</td><td>市</td><td>区/县</td><td>操作</td></tr>"; if (ds.Tables["tb1"].Rows.Count > 0) { for (int i = 0; i < ds.Tables["tb1"].Rows.Count; i++) { p_list += "<tr><td>" + ds.Tables["tb1"].Rows[i]["provinceName"] + "</td><td>" + ds.Tables["tb1"].Rows[i]["cityName"] + "</td><td>" + ds.Tables["tb1"].Rows[i]["areaName"] + "</td><td><a href='?act=edit&id=" + ds.Tables["tb1"].Rows[i]["areaId"] + "'>编辑</a><a href='?act=deletd&id=" + ds.Tables["tb1"].Rows[i]["areaId"] + "'>删除</a></td></tr>"; } } else { p_list = "<span>暂无地址信息</span>"; } AddressList.InnerHtml = p_list; int countAll = 0; countAll = Convert.ToInt32(conn.GetCmd("Select Count(distinct areaId) as Alldata From Y_Area").ExecuteScalar());//获取多少条数据 int pageCount = (int)Math.Ceiling(countAll / 10.0); string pagenav = ""; int num = 1; if (this_nav <= 10) { num = this_nav; } else { string this_num = this_nav.ToString(); num = Convert.ToInt32(this_num.Substring(this_num.Length - 1, 1)); } int start = this_nav - num + 1; int end = this_nav - num + 10; for (int i = start; i <= end; i++) { if (i <= pageCount) { if (i == start && i > 10) { pagenav += "<ul><li><a href='?page=1'>←</a></li>"; pagenav += "<li><a href='?page=" + (i - 10) + "'>...</a></li>"; } pagenav += "<li><a"; if (this_nav == i) { pagenav += " class='current'"; } pagenav += " href='?page=" + i + "'>" + i + "</a></li>"; if (i == end) { pagenav += "<li><a href='?page=" + (i + 1) + "'>...</a></li>"; pagenav += "<li><a href='?page=" + pageCount + "'>→</a></li>"; } } } pagenav = "<ul class='pagenavigation'>" + pagenav + "</ul>"; PageList.InnerHtml = pagenav; conn.Close(); }
protected void Page_Load(object sender, EventArgs e) { //判断通过身份验证的用户是否有权限访问本页面 FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity; //判断通过身份验证的用户是否是Admin角色 if (!id.Ticket.UserData.Contains("admin")) { //跳转到访问权限不够的错误提示页面 Response.Redirect("~/Admin/error.html"); } if (Session["UserIdentity"] != "manager") { Response.Redirect("error1.html"); } if (!IsPostBack) { Int32 this_nav = 1; if (Request.QueryString["page"] != null && CommonFunction.IsInt(Request.QueryString["page"])) { this_nav = Convert.ToInt32(Request.QueryString["page"]); } SqlServerProvider conn = new SqlServerProvider(); conn.Open(); string sqlcount = "Select Count(distinct orderId) as Alldata From Y_Order"; Int32 countAll = Convert.ToInt32(conn.GetCmd(sqlcount).ExecuteScalar());//获取多少条数据 int pagestart = (this_nav - 1) * 10 + 1; int pageend = this_nav * 10; string sql = "select * from(select o.orderId,o.sendTime,o.customerName,o.customerAddress,o.customerMobile,o.isYiban,o.isYanzhong,o.isJinji,o.isJiaji,s.sendType,company,w.name,w.mobile,w.qq,c.conditionType,row_number() over (order by o.orderId asc) as num from Y_Order o left outer join Y_OrderCondition c on c.conditionId=o.conditionId left outer join Y_Worker w on w.workerId=o.workerId left outer join Y_OrderSendType s on s.sendTypeId=o.sendTypeId) as s where s.num between '" + pagestart + "' and '" + pageend + "'"; DataSet ds = new DataSet(); ds = conn.GetDataSet(sql, ds, "tb1"); if (ds.Tables["tb1"].Rows.Count > 0) { string p_list = ""; for (int i = 0; i < ds.Tables["tb1"].Rows.Count; i++) { p_list += "<div class='infoBox'><p>" + (i + 1) + ".派单时间:" + ds.Tables["tb1"].Rows[i]["sendTime"]; if ((bool)ds.Tables["tb1"].Rows[i]["isYiban"]) { p_list += "<span>一般超时</span>"; } if ((bool)ds.Tables["tb1"].Rows[i]["isYanzhong"]) { p_list += "<span>严重超时</span>"; } if ((bool)ds.Tables["tb1"].Rows[i]["isJinji"]) { p_list += "<span>紧急处理</span>"; } if ((bool)ds.Tables["tb1"].Rows[i]["isJiaji"]) { p_list += "<span>加急处理</span>"; } p_list += "</p>"; p_list += "<ul><li class='listCustomer'><span class='spanName'>客户姓名:" + ds.Tables["tb1"].Rows[i]["customerName"] + " 客户手机:" + ds.Tables["tb1"].Rows[i]["customerMobile"] + "</span>"; p_list += "<span class='spanAddress'>客户地址:" + ds.Tables["tb1"].Rows[i]["customerAddress"] + "</li><li>" + ds.Tables["tb1"].Rows[i]["company"] + "</li><li>" + ds.Tables["tb1"].Rows[i]["sendType"] + "</li><li>" + ds.Tables["tb1"].Rows[i]["conditionType"] + "</li><li>" + ds.Tables["tb1"].Rows[i]["name"] + ds.Tables["tb1"].Rows[i]["mobile"] + "</li><li><a href='?act=edit&id=" + ds.Tables["tb1"].Rows[i]["orderId"] + "'>编辑</a><a href='?act=update&id=" + ds.Tables["tb1"].Rows[i]["orderId"] + "'>更新状态</a></li></ul></div>"; } InfoList.InnerHtml = p_list; } //int pageCount = (int)Math.Ceiling(countAll / 10.0); //string pagenav = ""; //int num = 1; //if (this_nav <= 10) //{ // num = this_nav; //} //else //{ // string this_num = this_nav.ToString(); // num = Convert.ToInt32(this_num.Substring(this_num.Length - 1, 1)); //} //int start = this_nav - num + 1; //int end = this_nav - num + 10; //for (int i = start; i <= end; i++) //{ // if (i <= pageCount) // { // if (i == start && i > 10) // { // pagenav += "<li><a href='?page=1'>←</a></li>"; // pagenav += "<li><a href='?page=" + (i - 1) + "'>...</a></li>"; // } // pagenav += "<li><a"; // if (this_nav == i) // { // pagenav += " class='current'"; // } // pagenav += " href='?page=" + i + "'>" + i + "</a></li>"; // if (i == end) // { // pagenav += "<li><a href='?page=" + (i + 1) + "'>...</a></li>"; // pagenav += "<li><a href='?page=" + pageCount + "'>→</a></li>"; // } // } //} //pagenav = "<ul class='pagenavigation'>" + pagenav + "</ul>"; //pagenavi.InnerHtml = pagenav; // ds.Clear(); //conn.Close(); } }