protected void BtnLogin_Click(object sender, EventArgs e) { if (AuthenticationCode1.AuthenticationCodeValidate(yanZheng.Text.Trim())) { string userName = CommonFunction.FilterSqlStr(Request.Form["userName"]); string passWord = Request.Form["passWord"]; if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(passWord)) { Response.Write("<Script language=JavaScript>alert('账号密码输入有误,请重新输入!');window.location.href='index.aspx';</script>"); } else { passWord = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(passWord, "MD5"); string sql=string.Empty; string userRole = string.Empty; if(yuangong.Checked==true) { sql = "select * from Y_Admin where userName='******' and passWord='******' and isLock=0"; } else if (merchant.Checked) { sql = "select * from Y_Merchant where userName='******' and passWord='******' and isLock=0"; } SqlServerProvider conn = new SqlServerProvider(); conn.Open(); if (conn.ExistData(sql)) { if (yuangong.Checked) { Session["userName"] = userName.ToString(); Session["UserIdentity"] = "manager"; userRole = "admin"; } else if (merchant.Checked) { Session["userName"] = userName.ToString(); Session["UserIdentity"] = "merchant"; userRole = "merchant"; } UpdateLogin(userName); AccountSystem(userName, userRole); } else { Response.Write("<Script language=JavaScript>alert('账号或密码错误,请重新输入!');window.location.href='index.aspx';</script>"); } conn.Close(); } } else { Response.Write("<Script language=JavaScript>alert('验证码输入有误,请重新输入!');window.location.href='index.aspx';</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserIdentity"] != "merchant" && Session["UserIdentity"] != "manager") { Response.Redirect("error1.html"); } if (!IsPostBack) { //超级管理员导航 string adminIndex = "<li><a href='/Admin/AdminIndexMain.aspx' target='rightFrm'>" + "待办事项" + "</a></li>"; string addOrder = "<li><a href='' target='rightFrm'>" + "添加工单" + "</a></li>"; string orderManage = "<li><a href='OrderManage.aspx' target='rightFrm'>" + "工单管理" + "</a></li>"; string adminManage = "<li><a href='' target='rightFrm'>" + "用户管理" + "</a></li>"; //时间 string workerManage = "<li><a href='' target='rightFrm'>" + "师傅管理" + "</a></li>"; string feeSetting = "<li><a href='' target='rightFrm'>" + "系统设置" + "</a></li>"; string addressManage = "<li><a href='' target='rightFrm'>" + "地址管理" + "</a></li>"; string webLog = "<li><a href='' target='rightFrm'>" + "系统日志" + "</a></li>"; //合作商导航 string checkOrder = "<li><a href='' target='rightFrm'>" + "工单查询" + "</a></li>"; SqlServerProvider conn = new SqlServerProvider(); conn.Open(); DataSet ds = new DataSet(); string strMenuone = "<div><ul>"; if (Session["UserIdentity"] == "manager") { strMenuone += adminIndex; ds = conn.GetDataSet("select id,checkWorker,addOrder,editWorker,departName from Y_Admin where userName='******'", ds, "t1"); UserName.InnerText = ds.Tables["t1"].Rows[0]["departName"] + " " +Convert.ToString(Session["userName"]); if ((bool)ds.Tables["t1"].Rows[0]["addOrder"])//有导入工单的权限 { strMenuone += addOrder; } strMenuone += orderManage; if ((int)ds.Tables["t1"].Rows[0]["id"] == 1)//是超级管理员,id只能是1,数据库不可乱改 { strMenuone += adminManage; } if ((bool)ds.Tables["t1"].Rows[0]["checkWorker"])//查看师傅的权限 { strMenuone += workerManage; } if ((bool)ds.Tables["t1"].Rows[0]["editWorker"])//有编辑师傅的权限时,显示系统设置(费用设置),和地址管理 { strMenuone += feeSetting + addressManage ; } strMenuone += webLog + "</ul></div>"; } if (Session["UserIdentity"] == "merchant") { strMenuone += adminIndex; ds = conn.GetDataSet("select addOrder,name from Y_Merchant where userName='******'", ds, "t2"); UserName.InnerText = ds.Tables["t2"].Rows[0]["name"] + " " + Convert.ToString(Session["userName"]); if ((bool)ds.Tables["t2"].Rows[0]["addOrder"]) { strMenuone += addOrder; } strMenuone += checkOrder + "</ul></div>"; } conn.Close(); nav.InnerHtml += strMenuone; } }
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) { 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.sendTime,o.customerName,o.customerAddress,o.customerMobile,o.isJiesuan,o.chuliId,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"); 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>" + (i + 1) + ".派单时间:" + ds.Tables["tb1"].Rows[i]["sendTime"]; if (Convert.ToInt32(ds.Tables["tb1"].Rows[i]["chuliId"]) == 3) { p_list += "<span>紧急处理</span>"; } else if (Convert.ToInt32(ds.Tables["tb1"].Rows[i]["chuliId"]) == 2) { p_list += "<span>加急处理</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' type='checkbox' value='' /></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>"; } conn.Close(); InfoList.InnerHtml = p_list; }
protected void BtnSaveEditCity_Click(object sender, EventArgs e) { string id = Request.QueryString["id"]; int idd = Convert.ToInt32(id); if (string.IsNullOrEmpty(TxtEditCity.Text.Trim())) { Response.Write("<script>alert('不能为空!');window.history.go(-1);</script>"); } else { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); string proId = conn.GetItem("select c.provinceId from Y_City c left outer join Y_Area a on a.cityId=c.cityId where a.areaId='" + idd + "'", "0"); string sql = "select * from Y_City where cityName='" + TxtEditCity.Text.ToString().Trim() + "' and provinceId='"+Convert.ToInt32(proId)+"'"; if (proId != "0") { if (conn.ExistData(sql)) { Response.Write("<script>alert('该市已存在!请重新输入');window.history.go(-1);</script>"); } else { string cityId = conn.GetItem("select cityId from Y_Area where areaId='"+idd+"'", "0"); if (cityId != "0") { conn.Execute("update Y_City set cityName='" + TxtEditCity.Text.Trim() + "' where cityId='" + Convert.ToInt32(cityId) + "'"); conn.Execute("insert into Y_LogOperation (actionInfo,changeTime,userName) values('修改市," + TxtEditPro.Text.Trim() + "','" + DateTime.Now + "','" + Session["userName"] + "')"); Response.Write("<script>alert('修改市成功!');window.history.go(-1);</script>"); } else { Response.Write("<script>alert('修改失败!');window.history.go(-1);</script>"); } } } else { Response.Write("<script>alert('修改失败!');window.history.go(-1);</script>"); } conn.Close(); } }
protected void BtnSaveArea_Click(object sender, EventArgs e) { if (DropDownListProvince2.SelectedValue == "0") { Response.Write("<script>alert('请先选择省!');window.history.go(-1);</script>"); } else if (DropDownListCity.SelectedValue == "0") { Response.Write("<script>alert('请先选择市!');window.history.go(-1);</script>"); } else if (string.IsNullOrEmpty(TxtArea.Text.Trim())) { Response.Write("<script>alert('请输入地区名或县名!');window.history.go(-1);</script>"); return; } else { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); string sql = "select * from Y_Area where areaName='" + TxtArea.Text.Trim() + "' and cityId='" + DropDownListCity.SelectedValue + "'"; if (conn.ExistData(sql)) { Response.Write("<script>alert('该地区已存在!请重新输入');window.history.go(-1);</script>"); } else { conn.Execute("insert into Y_Area (areaName,cityId) values('" + TxtArea.Text.Trim() + "'," + DropDownListCity.SelectedValue + ")"); conn.Execute("insert into Y_LogOperation (actionInfo,changeTime,userName) values('添加地区," + TxtArea.Text.Trim() + "','" + DateTime.Now + "','" + Session["userName"] + "')"); Response.Write("<script>alert('添加地区成功!');window.history.go(-1);</script>"); } conn.Close(); } }
protected void DropDownListProvince2_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownListProvince2.SelectedValue != "0") { DropDownListCity.Items.Clear(); SqlServerProvider conn = new SqlServerProvider(); conn.Open(); DataSet ds = new DataSet(); ds = conn.GetDataSet("select cityId,cityName from Y_City where provinceId='" + DropDownListProvince2.SelectedValue + "'", ds, "t3"); DropDownListCity.Items.Add(new ListItem("--请选择--", "0")); for (int i = 0; i < ds.Tables["t3"].Rows.Count; i++) { DropDownListCity.Items.Add(new ListItem(ds.Tables["t3"].Rows[i]["cityName"].ToString(), ds.Tables["t3"].Rows[i]["cityId"].ToString())); } conn.Close(); } else { DropDownListCity.Items.Clear(); } }
private void GetMechantList() { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); string sql = "select o.orderId,o.customerName,o.customerAddress,o.orderTime,o.jiajiGradeId,o.customerMobile,o.isJiesuan,ch.chuliName,o.company,w.name,w.mobile,w.qq,c.conditionType,j.jiajiType 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_JiajiType j on j.jiajiTypeId=o.jiajiTypeId left outer join Y_Chuli ch on ch.chuliId=o.chuliId where o.conditionId=1"; 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"]; 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></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=receive&id=" + ds.Tables["tb1"].Rows[i]["orderId"] + "'>确认接单</a></li></ul></div>"; } } else { p_list = "<span>暂无该类型的工单</span>"; } conn.Close(); InfoList.InnerHtml = p_list; }
protected void BtnSavePro_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(TxtProvince.Text.Trim())) { Response.Write("<script>alert('请输入省份!');window.history.go(-1);</script>"); return; } else { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); string sql="select * from Y_Province where provinceName='"+TxtProvince.Text.Trim()+"'"; if (conn.ExistData(sql)) { Response.Write("<script>alert('该省份已存在!请重新输入');window.history.go(-1);</script>"); } else { conn.Execute("insert into Y_Province (provinceName) values ('" + TxtProvince.Text.Trim() + "')"); conn.Execute("insert into Y_LogOperation (actionInfo,changeTime,userName) values('添加省份,"+TxtProvince.Text.Trim()+"','" + DateTime.Now + "','" + Session["userName"] + "')"); Response.Write("<script>alert('添加省份成功!');window.history.go(-1);</script>"); } conn.Close(); } }
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) { if (!IsPostBack) { string act = Request.QueryString["act"]; string page = Request.QueryString["page"]; string id =Request.QueryString["id"]; int idd=Convert.ToInt32(id); Int32 this_nav = 1; if (page != null && CommonFunction.IsInt(page)) { this_nav = Convert.ToInt32(page); } SqlServerProvider conn = new SqlServerProvider(); conn.Open(); switch (act) { case "menage": ProvinceTable.Visible = false; CityTable.Visible = false; AreaTable.Visible = false; EditTable.Visible = false; PanelAddressList.Visible = true; GetAddressList(this_nav); break; case "addp": ProvinceTable.Visible = true; CityTable.Visible = false; AreaTable.Visible = false; EditTable.Visible = false; PanelAddressList.Visible = false; break; case "addc": ProvinceTable.Visible = false; CityTable.Visible = true; AreaTable.Visible = false; EditTable.Visible = false; PanelAddressList.Visible = false; GetProvince1(); break; case "adda": ProvinceTable.Visible = false; CityTable.Visible = false; AreaTable.Visible = true; EditTable.Visible = false; PanelAddressList.Visible = false; GetProvince2(); break; case "edit": ProvinceTable.Visible = false; CityTable.Visible = false; AreaTable.Visible = false; PanelAddressList.Visible = false; EditTable.Visible = true; DataSet dss = new DataSet(); dss = conn.GetDataSet("select a.areaName,c.cityName,p.provinceName from Y_Area a left outer join Y_City c on c.cityId=a.cityId left outer join Y_Province p on p.provinceId=c.provinceId where a.areaId='" + idd + "'", dss, "t4"); if (dss.Tables["t4"].Rows.Count > 0) { TxtEditPro.Text = dss.Tables["t4"].Rows[0]["provinceName"].ToString(); TxtEditCity.Text = dss.Tables["t4"].Rows[0]["cityName"].ToString(); TxtEditArea.Text = dss.Tables["t4"].Rows[0]["areaName"].ToString(); } break; default: ProvinceTable.Visible = false; CityTable.Visible = false; AreaTable.Visible = false; PanelAddressList.Visible = true; EditTable.Visible = false; GetAddressList(this_nav); break; } conn.Close(); } }
protected void BtnSerch_Click(object sender, EventArgs e) { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); DropDownListProvince1.Items.Clear(); DataSet ds = new DataSet(); ds = conn.GetDataSet("select provinceId,provinceName from Y_Province", ds, "t1"); DropDownListProvince1.Items.Add(new ListItem("--请选择--", "0")); for (int i = 0; i < ds.Tables["t1"].Rows.Count; i++) { DropDownListProvince1.Items.Add(new ListItem(ds.Tables["t1"].Rows[i]["provinceName"].ToString(), ds.Tables["t1"].Rows[i]["provinceId"].ToString())); } conn.Close(); }
private void GetProvince1() { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); DataSet dsss = new DataSet(); dsss = conn.GetDataSet("select provinceId,provinceName from Y_Province", dsss, "t2"); DropDownListProvince1.Items.Add(new ListItem("--请选择--", "0")); for (int i = 0; i < dsss.Tables["t2"].Rows.Count; i++) { DropDownListProvince1.Items.Add(new ListItem(dsss.Tables["t2"].Rows[i]["provinceName"].ToString(), dsss.Tables["t2"].Rows[i]["provinceId"].ToString())); } conn.Close(); }
public static bool BoolenYanzhong(int order_id) { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); int conditionId = Convert.ToInt32(conn.GetItem("select conditionId from Y_Order where orderId='" + order_id + "'", "0")); if ((conditionId != 3 && conditionId != 4 && conditionId != 5) || conditionId == 0) { conn.Close(); return false; } else { string time = ""; //待安装 if (conditionId == 5) { time = conn.GetItem("select top 1 subscribeTime from Y_OrderChange where orderId='" + order_id + "' order by changeTime desc", "0001/1/1 0:00:00"); } //待确认需电联 else { time = conn.GetItem("select top 1 changeTime from Y_OrderChange where orderId='" + order_id + "' order by changeTime desc", "0001/1/1 0:00:00"); } if (time != "") { DateTime Time = Convert.ToDateTime(time); if (Time.ToString() != "0001/1/1 0:00:00") { int yanzhongTime = Convert.ToInt32( conn.GetItem("select yanzhong from Y_Chaoshi where conditionId='" + conditionId + "'", "0")); conn.Close(); TimeSpan ts = DateTime.Now - Time; //获得两个时间差 if (ts.TotalHours >= yanzhongTime) //ts.TotalHours把时间差转换为小时 { return true; } else { return false; } } else { conn.Close(); return false; } } else { conn.Close(); return false; } } }
/// <summary> /// 更新登陆操作日志 /// </summary> protected void UpdateLogin(string username) { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); conn.Execute("insert into Y_LogOperation (actionInfo,changeTime,userName) values('登录系统~~','" + DateTime.Now + "','" + username + "')"); conn.Close(); }
protected void BtnEditSave_Click(object sender, EventArgs e) { //if (string.IsNullOrEmpty(TxtEditPro.Text.Trim())) //{ // Response.Write("<script>alert('省不能为空!');window.history.go(-1);</script>"); //} //else if (string.IsNullOrEmpty(TxtEditCity.Text.Trim())) //{ // Response.Write("<script>alert('市不能为空!');window.history.go(-1);</script>"); //} //else string id = Request.QueryString["id"]; int idd = Convert.ToInt32(id); if(string.IsNullOrEmpty(TxtEditArea.Text.Trim())) { Response.Write("<script>alert('地区不能为空!');window.history.go(-1);</script>"); } else { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); string sql = "select * from Y_Area a left outer join Y_City c on c.cityId=a.areaId where cityName='"+TxtEditCity.Text.ToString().Trim()+"'"; if (conn.ExistData(sql)) { Response.Write("<script>alert('该地区已存在!请重新输入');window.history.go(-1);</script>"); } else { conn.Execute("update Y_Area set areaName='" + TxtEditArea.Text.Trim() + "' where areaId='"+idd+"'"); conn.Execute("insert into Y_LogOperation (actionInfo,changeTime,userName) values('修改地区," + TxtEditArea.Text.Trim() + "','" + DateTime.Now + "','" + Session["userName"] + "')"); Response.Write("<script>alert('修改地区成功!');window.history.go(-1);</script>"); } conn.Close(); } }
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; }