111,126
社区成员
发帖
与我相关
我的任务
分享
<%@ Page Language="C#" Theme="common" AutoEventWireup="true" CodeFile="check_a.aspx.cs" Inherits="check_a" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>审核</title>
<link rel="stylesheet" type="text/css" href="css/css.css" />
<link rel="stylesheet" type="text/css" href="css/dateshow.css" />
<link rel="stylesheet" type="text/css" href="css/window.css" />
</head>
<body>
<form id="form1" runat="server">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="table_top">
<tr>
<td background="image/indexbar5ye.gif" class="font-title2" height="25">
>>申请书审核
</td>
</tr>
</table>
<div>
<table align="center" width="98%">
<tr>
<td align="left">
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"
RepeatDirection="Horizontal">
<asp:ListItem Value="0">已审</asp:ListItem>
<asp:ListItem Value="1">未审</asp:ListItem>
</asp:RadioButtonList></td>
<td colspan="2" align="right" valign="baseline">
<asp:Label ID="Label4" runat="server" Text="单击下列表行进入审核"></asp:Label> </td>
</tr>
</table>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" CssClass="Gv1" DataKeyNames="id" HorizontalAlign="Center"
OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound"
OnSorting="GridView1_Sorting" SkinID="NewSkin" ToolTip="点击进入查看详细信息!" Width="98%" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:BoundField HeaderText="编号" Visible="False">
<HeaderStyle Width="27px" />
</asp:BoundField>
<asp:BoundField DataField="number" HeaderText="单号">
<HeaderStyle Width="90px" />
</asp:BoundField>
<asp:BoundField DataField="A_usern" HeaderText="申请人" SortExpression="A_usern">
<ItemStyle Width="65px" />
<HeaderStyle Width="60px" />
</asp:BoundField>
<asp:BoundField DataField="A_th" HeaderText="申请事项" SortExpression="A_th">
<HeaderStyle Width="200px" />
</asp:BoundField>
<asp:BoundField DataField="A_why" HeaderText="申请事由" SortExpression="A_why">
<HeaderStyle Width="150px" />
</asp:BoundField>
<asp:BoundField DataField="A_mon" DataFormatString="¥{0:N2}" HeaderText="费用" SortExpression="A_mon">
<ItemStyle Width="60px" />
<HeaderStyle Width="60px" />
</asp:BoundField>
<asp:HyperLinkField DataNavigateUrlFields="id" DataNavigateUrlFormatString="edit_a.aspx?id={0}"
DataTextField="id" DataTextFormatString="查看详情" HeaderText="查看">
<ItemStyle Font-Bold="True" />
<HeaderStyle Width="60px" />
</asp:HyperLinkField>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:Button ID="btxian" runat="server" CausesValidation="false" CommandName="select"
Text="按钮" />
</ItemTemplate>
<HeaderStyle Width="0px" />
</asp:TemplateField>
</Columns>
<SelectedRowStyle Font-Bold="True" />
</asp:GridView>
<asp:Panel ID="Panel1" runat="server" Width="98%" Visible="False" >
<table width="98%">
<tr>
<td valign="top" width="500">
<asp:Label ID="Label3" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label><br />
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" Width="400px" SkinID="NewSkin" OnRowDataBound="GridView2_RowDataBound1" ToolTip="aaa">
<Columns>
<asp:BoundField DataField="ps" HeaderText="批示">
<HeaderStyle Width="200px" />
</asp:BoundField>
<asp:BoundField DataField="sh" HeaderText="审核人">
<HeaderStyle Width="60px" />
</asp:BoundField>
<asp:BoundField DataField="rq" HeaderText="日期" DataFormatString="{0:d}" HtmlEncode="False">
<HeaderStyle Width="100px" />
</asp:BoundField>
<asp:TemplateField HeaderText="同意是否">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</EditItemTemplate>
<HeaderStyle Width="80px" />
<ItemTemplate>
<asp:Image ID="Image1" runat="server" />
<asp:Label ID="Label1" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
<table background="image/indexbar5ye.gif" width="100%"><tr style=" color:Black; font-weight:bold;" >
<th scope="col" style="width:200px;" align="left">批示</th>
<th scope="col" style="width:60px;" align="left">审核人</th>
<th scope="col" style="width:100px;" align="left">日期</th>
<th scope="col" style="width:80px;" align="left">同意是否</th>
</tr> </table>
</EmptyDataTemplate>
</asp:GridView>
</td>
<td align="left" valign="top">
批示:<br />
<asp:TextBox ID="txt_ps" runat="server" Height="64px" TextMode="MultiLine" Width="252px"></asp:TextBox><br />
<asp:Button ID="btyes" runat="server" CssClass="button60" Text="审核同意" OnClick="btyes_Click" />
<asp:Button ID="btno" runat="server" CssClass="button60" Text="审核不同意" OnClick="btno_Click" />
<asp:Label ID="Label2" runat="server" Visible="False"></asp:Label>
</td>
</tr>
</table>
</asp:Panel>
</div>
</form>
</body>
</html>
<%@ Page Language="C#" Theme="common" AutoEventWireup="true" CodeFile="check_a.aspx.cs" Inherits="check_a" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>审核</title>
<link rel="stylesheet" type="text/css" href="css/css.css" />
<link rel="stylesheet" type="text/css" href="css/dateshow.css" />
<link rel="stylesheet" type="text/css" href="css/window.css" />
</head>
<body>
<form id="form1" runat="server">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="table_top">
<tr>
<td background="image/indexbar5ye.gif" class="font-title2" height="25">
>>申请书审核
</td>
</tr>
</table>
<div>
<table align="center" width="98%">
<tr>
<td align="left">
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"
RepeatDirection="Horizontal">
<asp:ListItem Value="0">已审</asp:ListItem>
<asp:ListItem Value="1">未审</asp:ListItem>
</asp:RadioButtonList></td>
<td colspan="2" align="right" valign="baseline">
<asp:Label ID="Label4" runat="server" Text="单击下列表行进入审核"></asp:Label> </td>
</tr>
</table>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" CssClass="Gv1" DataKeyNames="id" HorizontalAlign="Center"
OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound"
OnSorting="GridView1_Sorting" SkinID="NewSkin" ToolTip="点击进入查看详细信息!" Width="98%" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:BoundField HeaderText="编号" Visible="False">
<HeaderStyle Width="27px" />
</asp:BoundField>
<asp:BoundField DataField="number" HeaderText="单号">
<HeaderStyle Width="90px" />
</asp:BoundField>
<asp:BoundField DataField="A_usern" HeaderText="申请人" SortExpression="A_usern">
<ItemStyle Width="65px" />
<HeaderStyle Width="60px" />
</asp:BoundField>
<asp:BoundField DataField="A_th" HeaderText="申请事项" SortExpression="A_th">
<HeaderStyle Width="200px" />
</asp:BoundField>
<asp:BoundField DataField="A_why" HeaderText="申请事由" SortExpression="A_why">
<HeaderStyle Width="150px" />
</asp:BoundField>
<asp:BoundField DataField="A_mon" DataFormatString="¥{0:N2}" HeaderText="费用" SortExpression="A_mon">
<ItemStyle Width="60px" />
<HeaderStyle Width="60px" />
</asp:BoundField>
<asp:HyperLinkField DataNavigateUrlFields="id" DataNavigateUrlFormatString="edit_a.aspx?id={0}"
DataTextField="id" DataTextFormatString="查看详情" HeaderText="查看">
<ItemStyle Font-Bold="True" />
<HeaderStyle Width="60px" />
</asp:HyperLinkField>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:Button ID="btxian" runat="server" CausesValidation="false" CommandName="select"
Text="按钮" />
</ItemTemplate>
<HeaderStyle Width="0px" />
</asp:TemplateField>
</Columns>
<SelectedRowStyle Font-Bold="True" />
</asp:GridView>
<asp:Panel ID="Panel1" runat="server" Width="98%" Visible="False" >
<table width="98%">
<tr>
<td valign="top" width="500">
<asp:Label ID="Label3" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label><br />
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" Width="400px" SkinID="NewSkin" OnRowDataBound="GridView2_RowDataBound1" ToolTip="aaa">
<Columns>
<asp:BoundField DataField="ps" HeaderText="批示">
<HeaderStyle Width="200px" />
</asp:BoundField>
<asp:BoundField DataField="sh" HeaderText="审核人">
<HeaderStyle Width="60px" />
</asp:BoundField>
<asp:BoundField DataField="rq" HeaderText="日期" DataFormatString="{0:d}" HtmlEncode="False">
<HeaderStyle Width="100px" />
</asp:BoundField>
<asp:TemplateField HeaderText="同意是否">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</EditItemTemplate>
<HeaderStyle Width="80px" />
<ItemTemplate>
<asp:Image ID="Image1" runat="server" />
<asp:Label ID="Label1" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
<table background="image/indexbar5ye.gif" width="100%"><tr style=" color:Black; font-weight:bold;" >
<th scope="col" style="width:200px;" align="left">批示</th>
<th scope="col" style="width:60px;" align="left">审核人</th>
<th scope="col" style="width:100px;" align="left">日期</th>
<th scope="col" style="width:80px;" align="left">同意是否</th>
</tr> </table>
</EmptyDataTemplate>
</asp:GridView>
</td>
<td align="left" valign="top">
批示:<br />
<asp:TextBox ID="txt_ps" runat="server" Height="64px" TextMode="MultiLine" Width="252px"></asp:TextBox><br />
<asp:Button ID="btyes" runat="server" CssClass="button60" Text="审核同意" OnClick="btyes_Click" />
<asp:Button ID="btno" runat="server" CssClass="button60" Text="审核不同意" OnClick="btno_Click" />
<asp:Label ID="Label2" runat="server" Visible="False"></asp:Label>
</td>
</tr>
</table>
</asp:Panel>
</div>
</form>
</body>
</html>
//gridview1订单行选择事件,绑定gridview2订单审核状况数据
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
this.Label3.Text = GridView1.SelectedRow.Cells[1].Text;
gridview2();
getps();
}
//邦定批示内容
private void getps()
{
//string nemb = GridView1.SelectedRow.Cells[1].Text;
//SqlCommand scd = new SqlCommand("select count(*) from ts_xs_basicInfo where studyNumber ='" + studyNumber + "'", con);
//int count = Convert.ToInt32(scd.ExecuteScalar());
//if (count > 0)
sms_conn.Open();
SqlCommand scount = new SqlCommand("select count(*) from checksh where num=" + "'" + this.Label3.Text + "'", sms_conn);
int count = Convert.ToInt32(scount.ExecuteScalar());
if (count > 0)
{
string sqlps = "select * from checksh where num=" + "'" + this.Label3.Text + "'";
SqlDataAdapter daps = new SqlDataAdapter(sqlps, sms_conn);
DataSet dsps = new DataSet();
daps.Fill(dsps, "checksh");
DataRowView dv = dsps.Tables["checksh"].DefaultView[0];
this.txt_ps.Text = dv["ps"].ToString();
sms_conn.Close();
dsps.Clear();
dsps.Dispose();
}
else
{
this.txt_ps.Text = "";
}
}
//绑定gridview2审核状况
private void gridview2()
{
//this.Label2.Text = this.GridView1.SelectedValue.ToString(); 选择行的id号
this.Panel1.Visible = true;
string Sql2 = "select * from checksh where num=" + "'" + this.Label3.Text + "'";
SqlDataAdapter da2 = new SqlDataAdapter(Sql2, sms_conn);
DataSet ds2 = new DataSet();
try
{
da2.Fill(ds2, "checksh");
GridView2.DataSource = ds2.Tables["checksh"].DefaultView;
GridView2.DataBind();
}
catch (Exception ex)
{
Response.Write("数据库错误,错误原因:" + ex.Message);
Response.End();
}
ds2.Clear();
ds2.Dispose();
sms_conn.Close();
}
//gridview2字符超过用...替换,同意不同意图片改变
protected void GridView2_RowDataBound1(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标停留时更改背景色
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#EBFBBA'");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
//e.Row.Cells[0].Style("cursor") = "hand";
e.Row.Cells[0].Attributes["title"]= e.Row.Cells[0].Text;
if ((e.Row.Cells[0].Text).Length > 15)
{
e.Row.Cells[0].Text = (e.Row.Cells[0].Text).Substring(0, 15) + "…";
}
Image Image1 = (Image)e.Row.FindControl("Image1");
Label Label1 = (Label)e.Row.FindControl("Label1");
DataRowView dv = (DataRowView)e.Row.DataItem;
if ((int)dv[checksh.YES_FIELD] == 0)
{
Image1.ImageUrl = "image/yes.png";
Label1.Text = "同意";
}
else
{
Image1.ImageUrl = "image/no.png";
Label1.Text = "不同意";
}
}
}
//审核通过按钮添加更新
protected void btyes_Click(object sender, EventArgs e)
{
sms_conn.Open();
SqlCommand scount = new SqlCommand("select count(*) from checksh where num=" + "'" + this.Label3.Text + "'", sms_conn);
int count = Convert.ToInt32(scount.ExecuteScalar());
if (count < 0)
{
string insert =
"insert into checksh (num,ps,sh,rq,yes)values('" + this.Label3.Text + "','" + this.txt_ps.Text + "','" + Session["user"] + "','" + System.DateTime.Now + "','" + 0 + "')";
SqlCommand com = new SqlCommand(insert, sms_conn);
sms_conn.Open();
try
{
com.ExecuteNonQuery();
Response.Write("<script>alert('操作成功!')</script>");
gridview2();
}
catch (SqlException)
{
Response.Write("<script>alert('操作失败!')</script>");
}
sms_conn.Close();
gridview2();
}
else
{
string updatesql = "update checksh set ps='" + this.txt_ps.Text + "',sh='" + Session["user"] + "',yes='" + 0 + "',rq='" + System.DateTime.Now + "' where num='" + this.Label3.Text + "'";
SqlCommand com = new SqlCommand(updatesql, sms_conn);
//sms_conn.Open();
try
{
com.ExecuteNonQuery();
Response.Write("<script>alert('编辑成功!')</script>");
//Response.Redirect("get_a.aspx");
}
catch (SqlException)
{
Response.Write("<script>alert('操作失败!')</script>");
}
sms_conn.Close();
gridview2();
}
}
//审核不通过
protected void btno_Click(object sender, EventArgs e)
{
sms_conn.Open();
SqlCommand scount = new SqlCommand("select count(*) from checksh where num=" + "'" + this.Label3.Text + "'", sms_conn);
int count = Convert.ToInt32(scount.ExecuteScalar());
if (count < 0)
{
string insert =
"insert into checksh (num,ps,sh,rq,yes)values('" + this.Label3.Text + "','" + this.txt_ps.Text + "','" + Session["user"] + "','" + System.DateTime.Now + "','" + 1 + "')";
SqlCommand com = new SqlCommand(insert, sms_conn);
sms_conn.Open();
try
{
com.ExecuteNonQuery();
Response.Write("<script>alert('操作成功!')</script>");
gridview2();
}
catch (SqlException)
{
Response.Write("<script>alert('操作失败!')</script>");
}
sms_conn.Close();
gridview2();
}
else
{
string updatesql = "update checksh set ps='" + this.txt_ps.Text + "',sh='" + Session["user"] + "',yes='" + 1 + "',rq='" + System.DateTime.Now + "' where num='" + this.Label3.Text + "'";
SqlCommand com = new SqlCommand(updatesql, sms_conn);
//sms_conn.Open();
try
{
com.ExecuteNonQuery();
Response.Write("<script>alert('编辑成功!')</script>");
//Response.Redirect("get_a.aspx");
}
catch (SqlException)
{
Response.Write("<script>alert('操作失败!')</script>");
}
sms_conn.Close();
gridview2();
}
}
}
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class check_a : System.Web.UI.Page
{
SqlConnection sms_conn;
//private static bool Isonclick = true;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["user"] == null)
{
Response.Redirect("Logoin.aspx");
}
string sms_connstr = System.Configuration.ConfigurationManager.AppSettings["test_crmConn"];
sms_conn = new SqlConnection(sms_connstr);
if (!IsPostBack)
{
BindData("");
gridview2();
}
}
//绑定grid
private void BindData(string Sqlsort)
{
sms_conn.Open();
string SqlStr = "select * from A order by A_dd desc";
SqlDataAdapter da = new SqlDataAdapter(SqlStr, sms_conn);
DataSet ds = new DataSet();
try
{
da.Fill(ds, "A");
GridView1.DataSource = ds.Tables["A"].DefaultView;
//GridView1.DataKeyNames = new string[] { "sq1_id" };
GridView1.DataBind();
}
catch (Exception ex)
{
Response.Write("数据库错误,错误原因:" + ex.Message);
Response.End();
}
}
//排序事件
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
string sql = "";
if (ViewState["SortDirection"] == null || ViewState["SortDirection"].ToString().CompareTo("") == 0)
{
ViewState["SortDirection"] = " desc";
}
else
ViewState["SortDirection"] = "";
sql = " order by " + e.SortExpression + ViewState["SortDirection"];
//GridViewBind(sql);
BindData(sql);
}
//分页事件
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.GridView1.PageIndex = e.NewPageIndex;
BindData("");
}
//鼠标移动改变行的颜色,自动编号,单击/双击 事件
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//是否为有效行.即把头部和脚部给去掉.
//其实就是给GridView加上鼠标划过的JS
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标停留时更改背景色
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#EBFBBA'");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
//单击/双击 事件
e.Row.Attributes["ondblclick"] = String.Format("javascript:dbl_click=true;window.open('check_xx.aspx?id={0}','mainFrame');", GridView1.DataKeys[e.Row.RowIndex].Value.ToString());
e.Row.Attributes["title"] = "双击打开详细页面";
//e.Row.Attributes.Add("onclick", "clickevent(" + e.Row.Cells[0].Text + ")");
//e.Row.Attributes.Add("onclick", "clickevent(this.Panel1.Visible=true)");
Button btn = e.Row.FindControl("btxian") as Button;
if (btn != null)
{
e.Row.Attributes.Add("onclick", "document.getElementById('" + btn.ClientID + "').click();");
}
//自动编号
if (e.Row.RowIndex != -1)
{
int idb = e.Row.RowIndex + 1;
e.Row.Cells[0].Text = idb.ToString();
}
//判断事由事项字符大于15个字后用...替代
if ((e.Row.Cells[3].Text).Length > 18)
{
e.Row.Cells[3].Text = (e.Row.Cells[3].Text).Substring(0, 18) + "…";
}
if ((e.Row.Cells[4].Text).Length > 15)
{
e.Row.Cells[4].Text = (e.Row.Cells[4].Text).Substring(0, 15) + "…";
}
}
}
//已审未审订单
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.RadioButtonList1.SelectedValue == "0")
{
sms_conn.Open();
string SqlStr = "select * from A where number in (select num from checksh where yes=0)";
SqlDataAdapter da = new SqlDataAdapter(SqlStr, sms_conn);
DataSet ds = new DataSet();
try
{
da.Fill(ds, "A");
GridView1.DataSource = ds.Tables["A"].DefaultView;
//GridView1.DataKeyNames = new string[] { "sq1_id" };
GridView1.DataBind();
gridview2();
}
catch (Exception ex)
{
Response.Write("数据库错误,错误原因:" + ex.Message);
Response.End();
}
}
else
{
sms_conn.Open();
string SqlStr = "select * from A where number in (select num from checksh where yes=1)";
SqlDataAdapter da = new SqlDataAdapter(SqlStr, sms_conn);
DataSet ds = new DataSet();
try
{
da.Fill(ds, "A");
GridView1.DataSource = ds.Tables["A"].DefaultView;
//GridView1.DataKeyNames = new string[] { "sq1_id" };
GridView1.DataBind();
gridview2();
}
catch (Exception ex)
{
Response.Write("数据库错误,错误原因:" + ex.Message);
Response.End();
}
}
}