protected void lbtn_excel_Click(object sender, EventArgs e) { string url = panel1.BackImageUrl; if (url == "") { SystemTool.AlertShow(this, "图片为空,请先刷新"); return; } DataTable dt = (DataTable)ViewState["excel"]; //模板文件 string TempletFileName = Server.MapPath("~/template/blank.xlsx");//路径 //导出文件 string dts = DateTime.Now.ToString("yyyyMMddHHmmss"); string ReportFileName = Server.MapPath("~/xiazai/ChuChengLiMoZuLi" + dts + ".xlsx"); TableToExcel(dt, TempletFileName, ReportFileName); System.IO.FileInfo filet = new System.IO.FileInfo(ReportFileName); Response.Clear(); Response.Charset = "GB2312"; Response.ContentEncoding = System.Text.Encoding.UTF8; // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 Response.AddHeader("Content-Disposition", "attachment; filename=初掌力与末阻力.xlsx"); // 添加头信息,指定文件大小,让浏览器能够显示下载进度 Response.AddHeader("Content-Length", filet.Length.ToString()); // 指定返回的是一个不能被客户端读取的流,必须被下载 Response.ContentType = "application/ms-excel"; // 把文件流发送到客户端 Response.WriteFile(filet.FullName); // 停止页面的执行 Response.End(); }
protected void lbtn_add_Click(object sender, EventArgs e) { string ids = ""; for (int i = 0; i < rpt_shiyongdanwei.Items.Count; i++) { CheckBox ckb = rpt_shiyongdanwei.Items[i].FindControl("ckb") as CheckBox; if (ckb.Checked == true) { ids += ckb.ToolTip + ","; } } if (ids.Length > 0) { ids = ids.Substring(0, ids.Length - 1); } else { SystemTool.AlertShow(this, "请选择需要操作的数据"); return; } string sql = "update shiyongdanwei set isxianzhi=1 where shiyongdanwei_id in(" + ids + ")"; int result = DB.ExecuteSql(sql, null); if (result > 0) { BindInfo(); SystemTool.AlertShow(this, "操作成功"); } else { SystemTool.AlertShow(this, "操作失败"); } }
protected void lbtn_search_Click(object sender, EventArgs e) { string dt1 = datemin.Value; string dt2 = datemax.Value; if (dt1 == "") { SystemTool.AlertShow(this, "开始时间不能为空"); return; } if (dt2 == "") { SystemTool.AlertShow(this, "结束时间不能为空"); return; } ViewState["search"] = " dingdanriqi>='" + dt1 + "' and dingdanriqi<='" + dt2 + "'"; BindInfo(); //表头 string sql = "select count(taizhang_id) from taizhang_info where jihualeixing='应急采购' and " + ViewState["search"]; string result = DB.ExecuteSqlValue(sql, null); if (result == "" || result == "no") { result = "0"; } sql = "select count(taizhang_id) from taizhang_info where " + ViewState["search"]; string resulta = DB.ExecuteSqlValue(sql, null); if (resulta == "" || resulta == "no") { resulta = "0"; } divheader.InnerHtml = dt1 + "--" + dt2 + "(单位:元) 共实施各类采购" + resulta + "次,其中应急采购" + result + "次"; }
protected void lbtn_save_Click(object sender, EventArgs e) { string wdh = weidaohuo.Text.Trim(); if (wdh == "") { wdh = "0"; } string cq = chaoqi.Text.Trim(); if (cq == "") { cq = "0"; } string sql = "update tiaojian_info set chaoqi=" + cq + ",weidaohuo=" + wdh + ""; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow_Refresh1(this, "保存成功", "tiaojian_info.aspx"); } else { SystemTool.AlertShow(this, "保存失败"); return; } }
protected void btnsubmit_Click(object sender, EventArgs e) { if (txtpass1.Text == "" && txtpass2.Text == "") { SystemTool.AlertShow(this, "密码不能为空!"); return; } if (txtpass1.Text != "" || txtpass2.Text != "") { if (txtpass1.Text.Trim() != txtpass2.Text.Trim()) { SystemTool.AlertShow(this, "两次密码不一致!"); return; } } if (txtpass1.Text != "") { string sql = "update manager_info set man_psw='" + SystemTool.jimi(txtpass1.Text) + "' where man_id=" + ViewState["userid"]; int i = DB.ExecuteSql(sql, null); if (i > 0) { SystemTool.AlertShow(this, "操作成功!"); } else { SystemTool.AlertShow(this, "操作失败!"); } } }
protected void lbtDelAll_OnClick(object sender, EventArgs e) { string ids = ""; for (int i = 0; i < rptlist.Items.Count; i++) { CheckBox ckb = rptlist.Items[i].FindControl("ckb") as CheckBox; if (ckb.Checked == true) { ids += ckb.ToolTip + ","; } } if (ids.Length > 0) { ids = ids.Substring(0, ids.Length - 1); } else { SystemTool.AlertShow(this, "请选择需要删除的用户"); return; } string sql = "delete from manager_info where man_id in(" + ids + ")"; int result = DB.ExecuteSql(sql, null); if (result > 0) { BindInfo(); SystemTool.AlertShow(this, "删除成功"); } else { SystemTool.AlertShow(this, "删除失败"); } }
protected void rptlist_ItemCommand(object source, RepeaterCommandEventArgs e) { string cmd = e.CommandName.ToString(); string userid = e.CommandArgument.ToString(); string sql = ""; if (cmd == "lbtshan") { sql = "delete from manager_info where man_id=" + userid; } if (cmd == "lbtn_open") { sql = "update manager_info set state='启用' where man_id=" + userid; } if (cmd == "lbtn_close") { sql = "update manager_info set state='禁止' where man_id=" + userid; } int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow(this, "保存成功"); BindInfo(); } else { SystemTool.AlertShow(this, "保存失败"); } }
protected void lbtn_dels_Click(object sender, EventArgs e) { string ids = ""; for (int i = 0; i < rpt_shiyongdanwei.Items.Count; i++) { CheckBox ckb = rpt_shiyongdanwei.Items[i].FindControl("ckb") as CheckBox; if (ckb.Checked == true) { ids += ckb.ToolTip + ","; } } if (ids.Length > 0) { ids = ids.Substring(0, ids.Length - 1); } else { SystemTool.AlertShow(this, "请选择需要删除的数据"); return; } string sql = "delete from gonghuochangshang where gonghuochangshang_id in(" + ids + ")"; int result = DB.ExecuteSql(sql, null); if (result > 0) { BindInfo(); SystemTool.AlertShow(this, "删除成功"); } else { SystemTool.AlertShow(this, "删除失败"); } }
protected void lbtn_cequ_Click(object sender, EventArgs e) { string aname = txtcequ.Value; if (aname == "") { SystemTool.AlertShow(this, "测区名称不能为空"); return; } string sqlck = "select * from areainfo where areaname='" + aname + "'"; DataSet dsck = DB.ExecuteSqlDataSet(sqlck, null); if (dsck.Tables[0].Rows.Count > 0) { SystemTool.AlertShow(this, "测区名称已存在"); return; } string sql = "insert into areainfo (areaname) values('" + aname + "')"; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.JavascriptShow(this, "changclass1()"); sql = "select * from AreaInfo"; DataSet ds = DB.ExecuteSqlDataSet(sql, null); rpt_cequ.DataSource = ds.Tables[0]; rpt_cequ.DataBind(); txtcequ.Value = ""; BindData(); } else { SystemTool.AlertShow(this, "操作失败"); } }
protected void lbtn_delete_Click(object sender, EventArgs e) { string ids = ""; for (int i = 0; i < rpt_taizhang.Items.Count; i++) { CheckBox ckb = rpt_taizhang.Items[i].FindControl("ckb") as CheckBox; if (ckb.Checked == true) { ids += "'" + ckb.ToolTip + "',"; } } if (ids.Length > 0) { ids = ids.Substring(0, ids.Length - 1); } else { SystemTool.AlertShow(this, "请选择需要操作的数据"); return; } string sql = "update taizhang_info set isdelete=1 where dingdanbianhao in(" + ids + ")"; int result = DB.ExecuteSql(sql, null); if (result > 0) { BindInfo(); SystemTool.AlertShow(this, "操作成功"); } else { SystemTool.AlertShow(this, "操作失败"); } }
protected void lbtn_export_Click(object sender, EventArgs e) { string url = panel1.BackImageUrl; if (url == "") { SystemTool.AlertShow(this, "图片为空,请先查询"); return; } string ReportFileName = Server.MapPath("~/" + url); System.IO.FileInfo filet = new System.IO.FileInfo(ReportFileName); Response.Clear(); Response.Charset = "GB2312"; Response.ContentEncoding = System.Text.Encoding.UTF8; // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 Response.AddHeader("Content-Disposition", "attachment; filename=顶板离层数据分析.jpg"); // 添加头信息,指定文件大小,让浏览器能够显示下载进度 Response.AddHeader("Content-Length", filet.Length.ToString()); // 指定返回的是一个不能被客户端读取的流,必须被下载 Response.ContentType = "application/ms-excel"; // 把文件流发送到客户端 Response.WriteFile(filet.FullName); // 停止页面的执行 Response.End(); }
protected void btnok_Click(object sender, EventArgs e) { string navid = "5"; string suoluetu = jiexi_picture(txtname.Text); if (suoluetu == "") { SystemTool.AlertShow(this, "图片不能为空"); return; } string detail = "album"; string sql = "if not exists (select * from article_info where nav_id=" + Request.QueryString["nid"].ToString() + ")insert into article_info(nav_id,title,article_image,author,descr,detail,isshow) values(@nav_id,@title,@article_image,@author,@descr,@detail,@isshow)"; if (Request.QueryString["nid"] != null) { sql = "update article_info set nav_id=@nav_id,title=@title,article_image=@article_image,author=@author,descr=@descr,detail=@detail,isshow=@isshow where nav_id=" + Request.QueryString["nid"].ToString(); } SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@nav_id", SqlDbType.Int) { Value = navid }, new SqlParameter("@title", SqlDbType.NVarChar) { Value = "" }, new SqlParameter("@article_image", SqlDbType.NVarChar) { Value = suoluetu }, new SqlParameter("@author", SqlDbType.NVarChar) { Value = "" }, new SqlParameter("@descr", SqlDbType.NVarChar) { Value = "" }, new SqlParameter("@detail", SqlDbType.NText) { Value = detail }, new SqlParameter("@isshow", SqlDbType.Int) { Value = "1" }, }; int result = DB.ExecuteSql(sql, parm); if (result > 0) { SystemTool.AlertShow_Refresh(this, "保存成功", "albumadd.aspx?nid=5"); } else { SystemTool.AlertShow(this, "保存失败"); return; } }
protected void btnok_Click(object sender, EventArgs e) { if (txtname.Text == "") { SystemTool.AlertShow(this, "管理员名称不能为空"); return; } if (txtpassok.Text != txtpassok2.Text) { SystemTool.AlertShow(this, "两次输入密码不一致"); return; } string sql = ""; int result = 0; if (null != Request.QueryString["manId"]) { //更新操作 if (txtpassok.Text == "") {//密码不更新 sql = "UPDATE manager_info set roleId='" + ddljiaose.SelectedValue + "',remark='" + SystemTool.NoHtml(txtbeizhu.Value) + "',state='" + ddlState.SelectedValue + "' where man_id=" + SystemTool.NoHtml(Request.QueryString["manId"]); } else { sql = "UPDATE manager_info set man_psw='" + SystemTool.jimi(SystemTool.NoHtml(txtpassok.Text)) + "',roleId='" + ddljiaose.SelectedValue + "',remark='" + SystemTool.NoHtml(txtbeizhu.Value) + "',state='" + ddlState.SelectedValue + "' where man_id=" + SystemTool.NoHtml(Request.QueryString["manId"]); } result = DB.ExecuteSql(sql, null); } else { sql = "select man_id from manager_info where man_name='" + SystemTool.NoHtml(txtname.Text) + "'"; string r = DB.ExecuteSqlValue(sql, null); if (r != "" && r != "no") { SystemTool.AlertShow(this, "管理员名称已存在"); return; } if (txtpassok.Text == "") { SystemTool.AlertShow(this, "管理员密码不能为空"); return; } sql = "insert into manager_info (man_name,man_psw,roleId,remark,state) values('" + SystemTool.NoHtml(txtname.Text) + "','" + SystemTool.jimi(SystemTool.NoHtml(txtpassok.Text)) + "'," + ddljiaose.SelectedValue + ",'" + SystemTool.NoHtml(txtbeizhu.Value) + "','" + ddlState.SelectedValue + "')"; result = DB.ExecuteSql(sql, null); } if (result > 0) { SystemTool.AlertShow_Refresh1(this, "保存成功", "guanliyuanlist.aspx"); } else { SystemTool.AlertShow(this, "保存失败"); return; } }
protected void rptlist_ItemCommand(object source, RepeaterCommandEventArgs e) { string cmd = e.CommandName.ToString(); string userid = e.CommandArgument.ToString(); TextBox name = e.Item.FindControl("txt_name") as TextBox; DropDownList muban = e.Item.FindControl("ddl_muban") as DropDownList; TextBox paixu = e.Item.FindControl("txt_paixu") as TextBox; DropDownList show = e.Item.FindControl("ddl_show") as DropDownList; DropDownList nav0 = e.Item.FindControl("ddl_nav0") as DropDownList; if (cmd == "lbtshan") { string sql = "delete from nav_info where id=" + userid; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow(this, "删除成功"); BindInfo(); } } if (cmd == "lbtn_edit") { if (name.Text == "") { SystemTool.AlertShow(this, "导航栏名称不能为空"); } if (paixu.Text == "") { SystemTool.AlertShow(this, "排序不能为空"); return; } if (!SystemTool.IsInt(paixu.Text)) { paixu.Text = "0"; } string sql = "select id from nav_info where nav_name='" + name.Text + "'"; string r = DB.ExecuteSqlValue(sql, null); if (r != "" && r != "no") { if (r != userid) { SystemTool.AlertShow(this, "导航栏名称已存在"); return; } } sql = "update nav_info set nav_name='" + name.Text + "',muban_id='" + muban.SelectedValue + "',paixu='" + paixu.Text + "',isshow='" + show.SelectedValue + "',parent_id='" + nav0.SelectedValue + "' where id=" + userid; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow_Refresh(this, "保存成功", "nvalist.aspx"); } else { SystemTool.AlertShow(this, "保存失败"); } } }
protected void rptlist_ItemCommand(object source, RepeaterCommandEventArgs e) { string cmd = e.CommandName.ToString(); string userid = e.CommandArgument.ToString(); if (cmd == "lbtn_open") { string sql = "update role_info set state='启用' where id=" + userid; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow(this, "保存成功"); BindInfo(); } else { SystemTool.AlertShow(this, "保存失败"); } } if (cmd == "lbtn_close") { string sql = "update role_info set state='禁止' where id=" + userid; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow(this, "保存成功"); BindInfo(); } else { SystemTool.AlertShow(this, "保存失败"); } } if (cmd == "lbtshan") { string sql = "delete from role_info where id=" + userid; string sql2 = "delete from manager_info where roleId=" + userid; string[] sqls = { sql, sql2 }; bool r = DB.ExecuteSqlsTransaction2(sqls, null); if (r) { SystemTool.AlertShow(this, "删除成功"); BindInfo(); } else { SystemTool.AlertShow(this, "删除失败"); } } }
protected void rptlist_ItemCommand(object source, RepeaterCommandEventArgs e) { string cmd = e.CommandName.ToString(); string userid = e.CommandArgument.ToString(); TextBox name = e.Item.FindControl("txt_name") as TextBox; TextBox url = e.Item.FindControl("txt_url") as TextBox; if (cmd == "lbtshan") { string sql = "delete from muban_info where id=" + userid; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow(this, "删除成功"); BindInfo(); } } if (cmd == "lbtn_edit") { if (name.Text == "") { SystemTool.AlertShow(this, "模板名称不能为空"); } if (url.Text == "") { SystemTool.AlertShow(this, "模板地址不能为空"); } string sql = "select id from muban_info where muban_name='" + name.Text + "'"; string r = DB.ExecuteSqlValue(sql, null); if (r != "" && r != "no") { if (r != userid) { SystemTool.AlertShow(this, "模板名称已存在"); return; } } sql = "update muban_info set muban_name='" + name.Text + "',muban_url='" + url.Text + "' where id=" + userid; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow_Refresh(this, "保存成功", "mubanlist.aspx"); BindInfo(); } else { SystemTool.AlertShow(this, "添加失败"); } } }
protected void btn_submit_Click(object sender, EventArgs e) { string name = SystemTool.NoHtml(txt_name.Text); string pass = SystemTool.NoHtml(txt_psw.Text); if (name == "" || pass == "") { SystemTool.AlertShow(this, "账户和密码不能为空"); return; } if (vCode.Value == "") { SystemTool.AlertShow(this, "验证码不能为空"); return; } if (Session["Code"] == null) { SystemTool.AlertShow(this, "验证码已过期"); return; } if (Session["Code"].ToString() != vCode.Value) { SystemTool.AlertShow(this, "验证码不正确"); return; } //string sql = "select man_id from manager_info where man_name='" + name + "' and man_psw='" + SystemTool.jimi(pass) + "'"; string sql = "select man_id,manager_info.state mstate,role_info.state rstate from manager_info,role_info where roleId=id and man_name='" + name + "' and man_psw='" + SystemTool.jimi(pass) + "'"; DataSet ds = DB.ExecuteSqlDataSet(sql, null); if (ds.Tables[0].Rows.Count == 0) { SystemTool.AlertShow(this, "账号或密码错误"); return; } if (ds.Tables[0].Rows[0]["mstate"].ToString() == "禁止") { SystemTool.AlertShow(this, "该用户被禁用"); return; } if (ds.Tables[0].Rows[0]["rstate"].ToString() == "禁止") { SystemTool.AlertShow(this, "该用户所在的组被禁用"); return; } HttpCookie cookid = new HttpCookie(Cookie.ComplanyId, ds.Tables[0].Rows[0]["man_id"].ToString()); cookid.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookid); Response.Redirect("index.aspx"); }
protected void lbtn_daoru_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { string dt = DateTime.Now.ToString("yyyyMMddHHmmss"); FileUpload1.SaveAs(Server.MapPath("~/daoru/") + dt + FileUpload1.FileName); //导入数据 DataTable dta = ExcelToTable(Server.MapPath("~/daoru/") + dt + FileUpload1.FileName); } else { SystemTool.AlertShow(this, "请选择要导入的Excel"); } }
protected void lbtn_add_Click(object sender, EventArgs e) { string areaname = ddl_cequ.SelectedValue; string facename = ddl_gongzuomian.SelectedValue; string datetime = datemin.Value; string hcjcnose = txtjitoujinchi.Text; string hcjctail = txtjiweijinchi.Text; decimal jitou = Convert.ToDecimal(hcjcnose); decimal jiwei = Convert.ToDecimal(hcjctail); decimal zhongbu = (jitou + jiwei) / 2; string hcjcmid = zhongbu.ToString(); if (lblstate.Text == "i") { string sqlck = "select * from huicai where areaname='" + areaname + "' and facename='" + facename + "' and datetime='" + datetime + "'"; DataSet ds = DB.ExecuteSqlDataSet(sqlck, null); if (ds.Tables[0].Rows.Count > 0) { SystemTool.AlertShow(this, "回采数据已经添加,如需修改请联系管理员!"); return; } string sql = "insert into huicai(id,areaname,facename,datetime,hcjcnose,hcjcmid,hcjctail)values(newid(),'" + areaname + "','" + facename + "','" + datetime + "','" + hcjcnose + "','" + hcjcmid + "','" + hcjctail + "')"; int r = DB.ExecuteSql(sql, null); if (r > 0) { SystemTool.AlertShow(this, "操作成功"); BindInfo(); } else { SystemTool.AlertShow(this, "操作失败"); } } if (lblstate.Text == "u") { //string sql = "insert into huicai(id,areaname,facename,datetime,hcjcnose,hcjcmid,hcjctail)values(newid(),'" + areaname + "','" + facename + "','" + datetime + "','" + hcjcnose + "','" + hcjcmid + "','" + hcjctail + "')"; string sql = "update huicai set hcjcnose='" + hcjcnose + "',hcjcmid='" + hcjcmid + "',hcjctail='" + hcjctail + "' where areaname='" + areaname + "' and facename='" + facename + "' and datetime='" + datetime + "'"; int r = DB.ExecuteSql(sql, null); if (r > 0) { SystemTool.AlertShow(this, "操作成功"); BindInfo(); } else { SystemTool.AlertShow(this, "操作失败"); } } }
protected void add_modules(object sender, EventArgs e) { string pid = ddl_nav.SelectedValue; string muban_id = ddl_muban.SelectedValue; //if (muban_id == "0") { // SystemTool.AlertShow(this, "请选择模板"); // return; //} string name = daohanglanmingcheng.Value; if (name == "") { SystemTool.AlertShow(this, "导航栏名称不能为空"); return; } string px = xuhao.Value; if (px == "") { SystemTool.AlertShow(this, "序号不能为空"); return; } if (!SystemTool.IsInt(px)) { px = "0"; } string isshow = ddl_show.SelectedValue; string sql = "select id from nav_info where nav_name='" + name + "'"; string r = DB.ExecuteSqlValue(sql, null); if (r != "" && r != "no") { SystemTool.AlertShow(this, "导航栏名称已存在"); return; } sql = "insert into nav_info(nav_name,muban_id,parent_id,paixu,isshow) values('" + name + "','" + muban_id + "','" + pid + "','" + px + "','" + isshow + "')"; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow_Refresh(this, "保存成功", "nvalist.aspx"); } else { SystemTool.AlertShow(this, "添加失败"); } }
protected void rptlist_ItemCommand(object source, RepeaterCommandEventArgs e) { string cmd = e.CommandName.ToString(); string userid = e.CommandArgument.ToString(); if (cmd == "lbtshan") { string sqlchck = "SELECT id FROM dbo.module_info WHERE parentId="+ userid; string id = DB.ExecuteSqlValue(sqlchck, null); if (id != "" && id != "no") { SystemTool.AlertShow(this, "此模块中包含其他模块,请先删除其他模块"); return; } string sql = "delete from module_info where id=" + userid; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow(this, "删除成功"); BindInfo(); } } if (cmd == "lbtn_edit") { string sql = "select id,moduleName,parentId,modelHref,paixu,tubiao from module_info where id=" + userid; DataSet ds = DB.ExecuteSqlDataSet(sql, null); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["parentId"].ToString() == "0") { ddlmoduleName.SelectedValue = "--"; } else { ddlmoduleName.SelectedValue = ds.Tables[0].Rows[0]["parentId"].ToString(); } hidid.Value = ds.Tables[0].Rows[0]["id"].ToString(); qitatiaojian.Value = ds.Tables[0].Rows[0]["moduleName"].ToString(); mokuaidizhi.Value = ds.Tables[0].Rows[0]["modelHref"].ToString(); paixu.Value = ds.Tables[0].Rows[0]["paixu"].ToString(); tubiao.Value = ds.Tables[0].Rows[0]["tubiao"].ToString(); } } }
protected void search_Click(object sender, EventArgs e) { string url = datemin.Value; if (url == "") { SystemTool.AlertShow(this, "开始日期不能为空"); return; } url = datemax.Value; if (url == "") { SystemTool.AlertShow(this, "结束日期不能为空"); return; } string riqi = datemin.Value; string riqi2 = datemax.Value; string t1 = "00:00:00"; // datemax.Value; string t2 = "23:59:59"; // datemax2.Value; string cequ = ddl_cequ.SelectedValue; string gongzuomian = ddl_gongzuomian.SelectedValue; string yz = ConfigurationManager.ConnectionStrings["YuZhi"].ToString();//小于此值,舍去yuzhi.Value; string zhu = "3"; string strConn = ConfigurationManager.ConnectionStrings["webConnectionString"].ToString(); DrawImage.DrawingCurve dc = new DrawImage.DrawingCurve(strConn); Bitmap img = DrawImage.DrawingCurve.DrawingImg10_0(cequ, gongzuomian, zhu, yz, riqi, riqi2 + " " + t2); string str = Server.MapPath("./xiazai/"); string str2 = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "MeiRiGongZuoZuLiFenBuQuXian.jpg"; img.Save(str + str2); img1.ImageUrl = "xiazai/" + str2; ViewState["date"] = riqi; ViewState["date2"] = riqi2; ViewState["baojingzhi"] = "0"; ViewState["yujingzhi"] = "0"; string sqlbjz = "select * from dbo.PressurePar where areaname='" + cequ + "' and facename='" + gongzuomian + "'"; DataSet result = DB.ExecuteSqlDataSet(sqlbjz, null); if (result.Tables[0].Rows.Count > 0) { ViewState["baojingzhi"] = result.Tables[0].Rows[0]["pressuremax"].ToString(); ViewState["yujingzhi"] = result.Tables[0].Rows[0]["pressuremin"].ToString(); } }
protected void rptlist_ItemCommand(object source, RepeaterCommandEventArgs e) { string cmd = e.CommandName.ToString(); string userid = e.CommandArgument.ToString(); if (cmd == "lbtshan") { string sql = "delete from article_info where id=" + userid; int r = DB.ExecuteSql(sql, null); if (r > 0) { SystemTool.AlertShow(this, "删除成功"); BindInfo(); } else { SystemTool.AlertShow(this, "删除失败"); } } }
protected void lbtn_gongzuomian_Click(object sender, EventArgs e) { string aname = txtgongzuomian.Value; string cequ = ddl_AreaInfo.SelectedValue; if (cequ == "0") { SystemTool.AlertShow(this, "测区名称不能为空"); return; } if (aname == "") { SystemTool.AlertShow(this, "工作面名称不能为空"); return; } string sqlck = "select * from workfaceinfo where areaname='" + cequ + "' and workfacename='" + aname + "'"; DataSet dsck = DB.ExecuteSqlDataSet(sqlck, null); if (dsck.Tables[0].Rows.Count > 0) { SystemTool.AlertShow(this, "工作面名称已存在"); SystemTool.JavascriptShow(this, "changclass22()"); return; } string sql = "insert into workfaceinfo (areaname,workfacename) values('" + cequ + "','" + aname + "')"; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.JavascriptShow(this, "changclass2()"); sql = "select * from workfaceinfo"; DataSet ds = DB.ExecuteSqlDataSet(sql, null); rpt_workface.DataSource = ds.Tables[0]; rpt_workface.DataBind(); ddl_AreaInfo.SelectedValue = "0"; txtgongzuomian.Value = ""; } else { SystemTool.AlertShow(this, "操作失败"); } }
protected void lbtn_xiangdao_Click(object sender, EventArgs e) { string aname = txtxiangdao.Value; string cequ = ddl_cequ2.SelectedValue; if (cequ == "0") { SystemTool.AlertShow(this, "测区名称不能为空"); return; } if (aname == "") { SystemTool.AlertShow(this, "巷道名称不能为空"); return; } string sqlck = "select * from roadinfo where areaname='" + cequ + "' and roadname='" + aname + "'"; DataSet dsck = DB.ExecuteSqlDataSet(sqlck, null); if (dsck.Tables[0].Rows.Count > 0) { SystemTool.AlertShow(this, "巷道名称已存在"); SystemTool.JavascriptShow(this, "changclass33()"); return; } string sql = "insert into roadinfo (areaname,roadname) values('" + cequ + "','" + aname + "')"; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.JavascriptShow(this, "changclass3()"); sql = "select * from roadinfo"; DataSet ds = DB.ExecuteSqlDataSet(sql, null); rpt_xiangdao.DataSource = ds.Tables[0]; rpt_xiangdao.DataBind(); ddl_cequ2.SelectedValue = "0"; txtxiangdao.Value = ""; } else { SystemTool.AlertShow(this, "操作失败"); } }
protected void rpt_taizhang_ItemCommand(object source, RepeaterCommandEventArgs e) { string cmd = e.CommandName.ToString(); string userid = e.CommandArgument.ToString(); if (cmd == "lbtn_open") { string sql = "update role_info set state='启用' where id=" + userid; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow(this, "保存成功"); BindInfo(); } else { SystemTool.AlertShow(this, "保存失败"); } } }
protected void btnok_Click(object sender, EventArgs e) { string title = txttitle.Text; string keywords = txtkeywords.Text; string description = txtdescription.Text; string beian = txtbeian.Value; string sql = "update sys_info set title=@title,keywords=@keywords,description=@description,beian=@beian "; SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@title", SqlDbType.NVarChar) { Value = title }, new SqlParameter("@keywords", SqlDbType.NVarChar) { Value = keywords }, new SqlParameter("@description", SqlDbType.NVarChar) { Value = description }, new SqlParameter("@beian", SqlDbType.NVarChar) { Value = beian }, }; int result = DB.ExecuteSql(sql, parm); if (result > 0) { SystemTool.AlertShow_Refresh(this, "保存成功", "xitongshezhi.aspx"); } else { SystemTool.AlertShow(this, "保存失败"); return; } }
protected void rptlist_ItemCommand(object source, RepeaterCommandEventArgs e) { string cmd = e.CommandName.ToString(); string facename = e.CommandArgument.ToString(); Label areaname = e.Item.FindControl("lblareaname") as Label; Label datetime = e.Item.FindControl("lbldatetime") as Label; string sql = ""; if (cmd == "lbtn_xiugai") { sql = "select * from huicai where areaname='" + areaname.Text + "' and facename='" + facename + "' and datetime='" + datetime.Text + "'"; DataSet ds = DB.ExecuteSqlDataSet(sql, null); if (ds.Tables[0].Rows.Count > 0) { txtjitoujinchi.Text = ds.Tables[0].Rows[0]["hcjcnose"].ToString(); txtjiweijinchi.Text = ds.Tables[0].Rows[0]["hcjctail"].ToString(); txtzhongbujinchi.Text = ds.Tables[0].Rows[0]["hcjcmid"].ToString(); DateTime dt = Convert.ToDateTime(ds.Tables[0].Rows[0]["datetime"].ToString()); datemin.Value = dt.ToString("yyyy-MM-dd"); lblstate.Text = "u"; } } if (cmd == "lbtn_delete") { sql = "delete from huicai where areaname='" + areaname.Text + "' and facename='" + facename + "' and datetime='" + datetime.Text + "'"; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow(this, "保存成功"); BindInfo(); } else { SystemTool.AlertShow(this, "保存失败"); } } }
protected void lbtn_save_Click(object sender, EventArgs e) { string sydw = inshiyongdanwei.Value; if (sydw == "") { SystemTool.AlertShow(this, "请输入使用单位"); return; } string sql = "select count(gonghuochangshang_id) from gonghuochangshang where mingcheng='" + sydw + "'"; string result = DB.ExecuteSqlValue(sql, null); if (result != "" && result != "no") { if (result == "0") { //未查询 sql = "insert into gonghuochangshang(mingcheng) values('" + sydw + "')"; int r = DB.ExecuteSql(sql, null); if (r > 0) { SystemTool.AlertShow(this, "保存成功"); inshiyongdanwei.Value = ""; BindInfo(); } else { SystemTool.AlertShow(this, "保存失败"); } } else { SystemTool.AlertShow(this, sydw + "已存在,请勿重复插入"); } } }
protected void add_modules(object sender, EventArgs e) { string name = mubanmingcheng.Value; if (name == "") { SystemTool.AlertShow(this, "模板名称不能为空"); return; } string url = mubandizhi.Value; if (url == "") { SystemTool.AlertShow(this, "模块地址不能为空"); return; } string sql = "select id from muban_info where muban_name='" + name + "'"; string r = DB.ExecuteSqlValue(sql, null); if (r != "" && r != "no") { SystemTool.AlertShow(this, "模板名称已存在"); return; } sql = "insert into muban_info (muban_name,muban_url) values('" + name + "','" + url + "')"; int result = DB.ExecuteSql(sql, null); if (result > 0) { SystemTool.AlertShow_Refresh(this, "保存成功", "mubanlist.aspx"); } else { SystemTool.AlertShow(this, "添加失败"); } }