MY_DEPART_ZZCG.aspx (单位绑定、测试状态控制)

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MY_DEPART_ZZCG.aspx.cs" Inherits="GSAO.CGGL.MY_DEPART_ZZCG" %>

<!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 href="../css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
     <asp:Label ID="lb_function_desc" runat="server" Visible="false" >
    功能说明:显示本部成果,按状态确定可执行操作,已提交审批可以审批,已通过的只可查看!<br/>
    操作表为:CGGL_ZZCG
    </asp:Label>
    
    <table width="99%" class="tbDefault mb5 mt5">
        <tr>
          <td class="tdRight bgEFEFEF" width="50">单位:</td>
             <td class="tdLeft" width="150">
                <asp:DropDownList ID="ddl_YXSM" runat="server" CssClass="ddl">
                 </asp:DropDownList>
            </td>
            <td class="tdRight bgEFEFEF" width="50">状态:</td>
             <td class="tdLeft" width="150">
                <asp:DropDownList ID="ddl_ZT_FLG" runat="server" CssClass="ddl">
                <asp:ListItem Value="0">全部</asp:ListItem>
                 <asp:ListItem Value="1">已提交审批</asp:ListItem>
                  <asp:ListItem Value="2">学院审批通过</asp:ListItem>
                   <asp:ListItem Value="3">学院审批不通过</asp:ListItem>
                    <asp:ListItem Value="4">学校审批通过</asp:ListItem>
                     <asp:ListItem Value="5">学校审批不通过</asp:ListItem>
                 </asp:DropDownList>
            </td>
             <td class="tdRight bgEFEFEF" width="80">成果名称:</td>
             <td class="tdLeft">
               <asp:TextBox ID="tb_CGGL_ZZCG_MC" runat="server" CssClass="txt"  Width="200"></asp:TextBox>
                &nbsp;&nbsp;
                <asp:Button ID="btn_search" runat="server" Text="查 询" CssClass="btnStyle" 
                     onclick="btn_search_Click" />
               <asp:Label ID="lb_total" runat="server"></asp:Label>
            </td>
            <td class="tdRight"> 
                <img src="../images/icon_add.gif" />
                <asp:hyperlink id="btnAdd" runat="server" NavigateUrl="MY_ZZCG_TJ.aspx?from=MY_DEPART_ZZCG.aspx">提交著作成果</asp:hyperlink>&nbsp;&nbsp;&nbsp;&nbsp;
            </td>
        </tr>
      </table>
       <asp:GridView ID="GridView1" runat="server" CssClass="tbGvw" Width="99%"   AllowPaging="true"  
          AutoGenerateColumns="false"     BorderStyle="Solid"  BorderWidth="1" 
           BorderColor="Silver"       PageSize="20" onpageindexchanged="GridView1_PageIndexChanged" 
           onrowdatabound="GridView1_RowDataBound" 
           onpageindexchanging="GridView1_PageIndexChanging" >
            <PagerSettings PageButtonCount="20" FirstPageText="[ 首页 ]" LastPageText="[ 末页 ]" 
               Mode="NextPreviousFirstLast" NextPageText="[ 下一页 ]" Position="TopAndBottom" 
               PreviousPageText="[ 上一页 ]"   />
         <PagerTemplate>
            <table width="100%"> <tr> <td style="text-align:left; color:#996600;"><asp:Label id="lblPageIndex" runat="server" text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页 共<asp:Label id="lblPageCount" runat="server" text='<%# ((GridView)Container.Parent.Parent).PageCount %>' />页 <asp:linkbutton id="btnFirst" runat="server" causesvalidation="False" commandargument="First" ForeColor="#996600" Font-Bold="true" commandname="Page" text="首页" /> <asp:linkbutton id="btnPrev" runat="server" causesvalidation="False" ForeColor="#996600" Font-Bold="true"  commandargument="Prev" commandname="Page" text="上一页" /> <asp:linkbutton id="btnNext" runat="server" ForeColor="#996600" Font-Bold="true"  causesvalidation="False" commandargument="Next" commandname="Page" text="下一页" /> <asp:linkbutton id="btnLast" runat="server" ForeColor="#996600" Font-Bold="true"  causesvalidation="False" commandargument="Last" commandname="Page" text="尾页" /></td> </tr> </table>
         </PagerTemplate>
        <HeaderStyle CssClass="tbHeader" />
        <RowStyle HorizontalAlign="Center" Wrap="False" Height="25px" ></RowStyle>
        <Columns>
         <asp:BoundField DataField="CGGL_ZZCG_KEY" HeaderText="ID不显示" /> 
         <asp:BoundField DataField="ZT_FLG" HeaderText="ZT_FLG不显示" />          
            <asp:TemplateField HeaderText="审批/查看" ItemStyle-Width="100" >
            <ItemTemplate>
                <asp:Image id="img_modify" runat="server" ImageUrl="../images/icon_edit.gif" ToolTip="审批" CssClass="cursorPointer" />&nbsp;
                <asp:Image id="img_show" runat="server" ImageUrl="../images/icon_view.gif" ToolTip="查看" CssClass="cursorPointer" />
              
            </ItemTemplate>
            </asp:TemplateField>  
            <asp:BoundField HeaderText="学号"  ItemStyle-Width="80px" DataField="CGGL_XH"/>
            <asp:BoundField HeaderText="姓名"  ItemStyle-Width="80px" DataField="CGGL_XM"/>
            <asp:BoundField HeaderText="单位名称"  ItemStyle-Width="150px" DataField="CGGL_YXSM_MC"/>
            
            <asp:BoundField HeaderText="成果类型"  ItemStyle-Width="120px" DataField="CGGL_ZZCG_LX"/> 
            <asp:BoundField HeaderText="成果名称"  ItemStyle-Width="300px" ItemStyle-CssClass="wordBreak" DataField="CGGL_ZZCG_MC"/> 
             <asp:BoundField HeaderText="出版社"  ItemStyle-Width="150px" DataField="CGGL_ZZCG_CBS"/>  
            <asp:BoundField HeaderText="书号"  ItemStyle-Width="80px" DataField="CGGL_ZZCG_SH"/> 
           
            <asp:BoundField HeaderText="出版日期" DataFormatString="{0:yyyy-MM-dd}"  ItemStyle-Width="100px" DataField="CGGL_ZZCG_CBRQ"/>
          <asp:BoundField HeaderText="当前状态"  ItemStyle-Width="100px" DataField="ZT_FLG"/> 
            </Columns>
            <PagerStyle  Font-Size="10pt"  BorderColor="White" Font-Bold="False" ForeColor="#996600"></PagerStyle> 
      </asp:GridView>
    </form>
</body>
</html>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace GSAO.CGGL
{
    public partial class MY_DEPART_ZZCG : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                Bind_ddl_YXSM();
                Bind_gv();
            }
        }
        protected void Bind_ddl_YXSM()
        {
            string ldap_account = Session["ldap_account"].ToString();
            if (ldap_account == "zjcai" || ldap_account == "linyq")
                this.ddl_YXSM.DataSource = DAL_GSAO_SZGW.DbHelperSQL_GSAO.Query("select * from TB_YXS   order by YXSMC asc").Tables[0];
            else
                this.ddl_YXSM.DataSource = DAL_GSAO_SZGW.DbHelperSQL_GSAO.Query("select * from TB_YXS where YXSM in (select YXSM from XTB_YHDYYXS where vid=" + Session["vid"].ToString() + ") order by YXSMC asc").Tables[0];
            this.ddl_YXSM.DataTextField = "YXSMC";
            this.ddl_YXSM.DataValueField = "YXSM";
            this.ddl_YXSM.DataBind();
        }
        private void Bind_gv()
        {
            string where = "  CGGL_ZZCG_MC like '%" + this.tb_CGGL_ZZCG_MC.Text + "%' ";
            if (this.ddl_YXSM.SelectedValue != "0")
                where += " and CGGL_YXSM=" + this.ddl_YXSM.SelectedValue;
            if (this.ddl_ZT_FLG.SelectedValue != "0")
                where += " and ZT_FLG=" + this.ddl_ZT_FLG.SelectedValue;
            where += " order by CGGL_ZZCG_CBRQ desc";
            DAL_GSAO_KYGL.Controller.CGGL_ZZCG C_CGGL_ZZCG = new DAL_GSAO_KYGL.Controller.CGGL_ZZCG();
            DataSet ds = C_CGGL_ZZCG.GetList(where);
            this.GridView1.DataSource = ds.Tables[0];
            this.GridView1.DataBind();

            this.lb_total.Text = "总计-" + ds.Tables[0].Rows.Count.ToString() + "-项";
            for (int i = 0; i < this.GridView1.Rows.Count; i++)
            {
                System.Web.UI.WebControls.Image img_modify = (System.Web.UI.WebControls.Image)this.GridView1.Rows[i].FindControl("img_modify");
                img_modify.Attributes.Add("onclick", "location.href='MY_DEPART_ZZCG_SP.aspx?CGGL_ZZCG_KEY=" + this.GridView1.Rows[i].Cells[0].Text.Trim() + "';");

                System.Web.UI.WebControls.Image img_show = (System.Web.UI.WebControls.Image)this.GridView1.Rows[i].FindControl("img_show");
                img_show.Attributes.Add("onclick", "location.href='MY_ZZCG_XG.aspx?showonly=true&CGGL_ZZCG_KEY=" + this.GridView1.Rows[i].Cells[0].Text.Trim() + "';");



                if (this.GridView1.Rows[i].Cells[1].Text == "1")
                {
                    this.GridView1.Rows[i].Cells[11].Text = "已提交审批";
                    img_modify.Visible = true;

                }
                if (this.GridView1.Rows[i].Cells[1].Text == "2")
                {
                    this.GridView1.Rows[i].Cells[11].Text = "学院审批通过";
                    img_modify.Visible = true;

                }
                if (this.GridView1.Rows[i].Cells[1].Text == "3")
                {
                    this.GridView1.Rows[i].Cells[11].Text = "学院审批不通过";
                    img_modify.Visible = false;

                }
                if (this.GridView1.Rows[i].Cells[1].Text == "4")
                {
                    this.GridView1.Rows[i].Cells[11].Text = "学校审批通过";
                    img_modify.Visible = false;

                }
                if (this.GridView1.Rows[i].Cells[1].Text == "5")
                {
                    this.GridView1.Rows[i].Cells[11].Text = "学校审批不通过";
                    img_modify.Visible = false;

                }

            }
        }
        protected void GridView1_PageIndexChanged(object sender, EventArgs e)
        {
            Bind_gv();
        }
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onmouseover", "if(this.style.backgroundColor!='#ffffd0'){this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='#c4e4ff';}");
                e.Row.Attributes.Add("onmouseout", "if(this.style.backgroundColor!='#ffffd0')this.style.backgroundColor=this.oldcolor;");
                e.Row.Attributes.Add("onmousedown", "if(this.style.backgroundColor=='#ffffd0')this.style.backgroundColor='white';else this.style.backgroundColor='#ffffd0';");
            }
            if ((e.Row.RowType == DataControlRowType.DataRow) || (e.Row.RowType == DataControlRowType.Header) || (e.Row.RowType == DataControlRowType.Footer))
            {
                e.Row.Cells[0].Visible = false;
                e.Row.Cells[1].Visible = false;
            }

        }
        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            try
            {
                GridView1.PageIndex = e.NewPageIndex;
            }
            catch
            {
                GridView1.PageIndex = 0;
            }
        }

        protected void btn_search_Click(object sender, EventArgs e)
        {
            Bind_gv();
        }
        public override void VerifyRenderingInServerForm(Control control)
        {
            //base.VerifyRenderingInServerForm(control);
        }
    }
}

 

posted @ 2014-06-09 16:23  linyongqin  阅读(163)  评论(0编辑  收藏  举报