MY_ZZCG_TJ.aspx (弹出层选择学生、引入数据)
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MY_ZZCG_TJ.aspx.cs" Inherits="GSAO.CGGL.MY_ZZCG_TJ" %> <!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" /> <script language="javascript" type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script> </head> <body> <form id="form1" runat="server"> <table class="tbDefault mt5 mb5" width="900"> <caption>成果管理_添加著作成果</caption> <tr id="tr_kkb" runat="server"> <td class="tdLeft" colspan="4"> <asp:Button ID="btn_kkb_show" runat="server" Text="选择学生" CssClass="btnStyle" onclick="btn_kkb_show_Click" /> <span class="colorRed">(选择学生)</span> <div class="div_main" id="div_kkb_select" style="width:600px;left:30%; position: absolute; top: 20%;z-index:999;" runat="server"> <table class="tbDefault" width="600" > <tr> <td class="tdRight bgEFEFEF" width="120">学号或姓名:</td> <td class="tdLeft"> <asp:TextBox ID="tb_xs_name" runat="server" CssClass="txt mr10" ></asp:TextBox> <asp:Button ID="btn_search_stuaa" runat="server" Text="查询学生" CssClass="btnStyle mr10" onclick="btn_search_stuaa_Click" /> <asp:button id="btn_exit" runat="server" Width="60px" Text="退 出" CssClass="btnStyle" onclick="btn_exit_Click" ></asp:button> </td> </tr> </table> <div style="width:600px;height:300px;overflow:auto; float:left; text-align:left"> <asp:GridView ID="gv_xs" runat="server" CssClass="tbGvw" Width="100%" HorizontalAlign="Left" AutoGenerateColumns="false" BorderStyle="Solid" BorderWidth="1" BorderColor="Silver" onrowcommand="gv_xs_RowCommand" onrowdatabound="gv_xs_RowDataBound" > <RowStyle HorizontalAlign="Center" Wrap="False" Height="25px" ></RowStyle> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Height="23px" ForeColor="Black" BackColor="White" Wrap="False" ></HeaderStyle> <Columns> <asp:TemplateField HeaderText="选择" ItemStyle-Width="60px"> <ItemTemplate> <asp:ImageButton id="btn_select" CommandArgument ="<%# gv_xs.Rows.Count %>" CommandName="select1" runat="server" ImageUrl="../images/icon_check.gif" ImageAlign="Baseline" AlternateText="选择"></asp:ImageButton> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="VID" HeaderText="VID" /> <asp:BoundField DataField="XH" HeaderText="学号" /> <asp:BoundField DataField="XM" HeaderText="姓名" /> <asp:BoundField DataField="YXSM" HeaderText="YXSM" /> <asp:BoundField DataField="YXSMC" HeaderText="YXSMC" /> <asp:BoundField DataField="ZYMC" HeaderText="ZYMC" /> <asp:BoundField DataField="NJ" HeaderText="NJ" /> <asp:BoundField DataField="LDAP_ID" HeaderText="LDAP_ID" /> </Columns> </asp:GridView> </div> </div> </td> </tr> <tr id="tr_SRO" runat="server"> <td class="tdRight bgEFEFEF" width="100">科研系统数据:<asp:Label ID="lb_CGGL_ZZCG_SYSTEM" runat="server" Visible="false"></asp:Label> <asp:Label ID="lb_CGGL_ZZCG_SYSTEM_ID" runat="server" Visible="false"></asp:Label> </td> <td class="tdLeft" colspan="3"> <asp:GridView ID="GridView1" runat="server" CssClass="tbGvw" Width="100%" HorizontalAlign="Left" AutoGenerateColumns="false" BorderStyle="Solid" BorderWidth="1" BorderColor="Silver" onrowcommand="GridView1_RowCommand" onrowdatabound="GridView1_RowDataBound" > <RowStyle HorizontalAlign="Center" Wrap="False" Height="25px" ></RowStyle> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Height="23px" ForeColor="Black" BackColor="White" Wrap="False" ></HeaderStyle> <Columns> <asp:BoundField DataField="KY_ZZCG_ID" HeaderText="序号"/> <asp:TemplateField HeaderText="引入" ItemStyle-Width="60px"> <ItemTemplate> <asp:ImageButton id="btn_select" CommandArgument ="<%#GridView1.Rows.Count%>" CommandName="select1" runat="server" ImageUrl="../images/icon_check.gif" ImageAlign="Baseline" AlternateText="选择"></asp:ImageButton> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="title" HeaderText="名称" ItemStyle-CssClass="tdLeft wordBreak" /> <asp:BoundField DataField="author" HeaderText="作者" ItemStyle-CssClass="tdLeft wordBreak" /> <asp:BoundField DataField="pressmark" HeaderText="书号" /> <asp:BoundField DataField="wordcount" HeaderText="总字数" /> <asp:BoundField DataField="publishdate" HeaderText="出版日期" DataFormatString="{0:yyyy-MM-dd}"/> <asp:BoundField DataField="bookconcern" HeaderText="出版社" ItemStyle-CssClass="tdLeft wordBreak" /> </Columns> </asp:GridView> </td> </tr> <tr> <td class="tdRight bgEFEFEF" width="100">成果类型:</td> <td class="tdLeft"> <asp:DropDownList ID="ddl_CGGL_ZZCG_LX" runat="server" CssClass="ddl"> <asp:ListItem Value="主编">主编</asp:ListItem> <asp:ListItem Value="副主编">副主编</asp:ListItem> <asp:ListItem Value="独著">独著</asp:ListItem> </asp:DropDownList> </td> <td class="tdRight bgEFEFEF" width="100"><font color='red'>*</font>名称:</td> <td class="tdLeft"> <asp:TextBox ID="tb_CGGL_ZZCG_MC" runat="server" CssClass="txt" Width="100%"></asp:TextBox> </td> </tr> <tr> <td class="tdRight bgEFEFEF" width="100">出版社:</td> <td class="tdLeft" width="280"> <asp:TextBox ID="tb_CGGL_ZZCG_CBS" runat="server" CssClass="txt"></asp:TextBox> </td> <td class="tdRight bgEFEFEF" width="100">书 号:</td> <td class="tdLeft" width="280"> <asp:TextBox ID="tb_CGGL_ZZCG_SH" runat="server" CssClass="txt"></asp:TextBox> </td> </tr> <tr> <td class="tdRight bgEFEFEF" width="100">个人排名:</td> <td class="tdLeft" width="280"> <asp:TextBox ID="tb_CGGL_ZZCG_GRPM" runat="server" CssClass="txt"></asp:TextBox> </td> <td class="tdRight bgEFEFEF" width="100">工作量:</td> <td class="tdLeft" width="280"> <asp:TextBox ID="tb_CGGL_ZZCG_GZL" runat="server" CssClass="txt"></asp:TextBox> </td> </tr> <tr> <td class="tdRight bgEFEFEF" width="100">作 者:</td> <td class="tdLeft" width="280"> <asp:TextBox ID="tb_CGGL_ZZCG_ZZ" runat="server" CssClass="txt"></asp:TextBox> </td> <td class="tdRight bgEFEFEF" width="100">出版日期:</td> <td class="tdLeft" width="280"> <INPUT class="txt" id="tb_CGGL_ZZCG_CBRQ" runat="server" onfocus="WdatePicker()" > </td> </tr> <tr> <td class="tdRight bgEFEFEF" width="100" >备注:</td> <td class="tdLeft" colspan="3"> <asp:TextBox ID="tb_CGGL_ZZCG_BZ" runat="server" CssClass="textarea f12" Width="700" Height="50" TextMode="MultiLine"></asp:TextBox> </td> </tr> <tr> <td class="tdRight bgEFEFEF" width="100">学 院:</td> <td class="tdLeft" width="280"> <asp:Label ID="lb_CGGL_YXSM" runat="server" Text="" Visible="false"></asp:Label> <asp:Label ID="lb_CGGL_YXSM_MC" runat="server" Text="" CssClass="lbl"></asp:Label> </td> <td class="tdRight bgEFEFEF" width="100">年 级:</td> <td class="tdLeft" width="280"> <asp:Label ID="lb_CGGL_NJ" runat="server" Text="" CssClass="lbl"></asp:Label> </td> </tr> <tr> <td class="tdRight bgEFEFEF" width="100">学 号:</td> <td class="tdLeft" width="280"> <asp:Label ID="lb_CGGL_VID" runat="server" Text="0" Visible="false"></asp:Label> <asp:Label ID="lb_CGGL_XH" runat="server" Text="" CssClass="lbl"></asp:Label> </td> <td class="tdRight bgEFEFEF" width="100">姓 名:</td> <td class="tdLeft" width="280"> <asp:Label ID="lb_CGGL_XM" runat="server" Text="" CssClass="lbl"></asp:Label> </td> </tr> <tr> <td class="tdRight bgEFEFEF" width="100">专业:</td> <td class="tdLeft" width="280"> <asp:Label ID="lb_CGGL_ZY_NAME" runat="server" Text="" CssClass="lbl"></asp:Label> </td> <td class="tdRight bgEFEFEF" width="100">帐号:</td> <td class="tdLeft" width="280"> <asp:Label ID="lb_CGGL_LDAP" runat="server" Text="" CssClass="lbl"></asp:Label> </td> </tr> <tr> <td colspan="4"> <asp:Button ID="btn_save" runat="server" Text="保存" CssClass="btnStyle mr10" onclick="btn_save_Click" />
<input id="btn_back" type="button" value="返回" class="btnStyle" onclick="javascript:history.back();" />(保存基本信息后,可以继续上传文件)</td> </tr> </table> </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_ZZCG_TJ : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (string.IsNullOrEmpty(Request.QueryString["from"])) { //学生新增个人成果 BindStu(Session["vid"].ToString()); BindSRO(Session["user_name"].ToString(), Session["vid"].ToString()); tr_kkb.Visible = false; } else { //学院或学校新增个人成果 this.div_kkb_select.Visible = false; tr_kkb.Visible = true; } } } #region 选择学生 /// <summary> /// 选择学生(弹出层) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_kkb_show_Click(object sender, EventArgs e) { this.div_kkb_select.Visible = true; } /// <summary> /// 查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_search_stuaa_Click(object sender, EventArgs e) { DAL_GSAO_JW.Controller.JW_XSXJXX C_JW_XSXJXX = new DAL_GSAO_JW.Controller.JW_XSXJXX(); DataSet ds_JW_XSXJXX = C_JW_XSXJXX.GetList_Join_All(" JW_XSXJXX.XH like '%" + tb_xs_name.Text + "%' or JW_XSJBXX.XM like '%" + tb_xs_name.Text + "%'"); gv_xs.DataSource = ds_JW_XSXJXX; gv_xs.DataBind(); } /// <summary> /// 退出 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_exit_Click(object sender, EventArgs e) { this.div_kkb_select.Visible = false; } protected void gv_xs_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[4].Visible = false; e.Row.Cells[5].Visible = false; e.Row.Cells[6].Visible = false; e.Row.Cells[7].Visible = false; e.Row.Cells[8].Visible = false; } } /// <summary> ///选择学生 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gv_xs_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "select1") { int nIdx = Convert.ToInt32(e.CommandArgument.ToString()); GridViewRow row = this.gv_xs.Rows[nIdx]; lb_CGGL_VID.Text = row.Cells[1].Text; lb_CGGL_XH.Text = row.Cells[2].Text; lb_CGGL_XM.Text = row.Cells[3].Text; lb_CGGL_YXSM.Text = row.Cells[4].Text; lb_CGGL_YXSM_MC.Text = row.Cells[5].Text; lb_CGGL_ZY_NAME.Text = row.Cells[6].Text; lb_CGGL_NJ.Text = row.Cells[7].Text; lb_CGGL_LDAP.Text = row.Cells[8].Text; this.div_kkb_select.Visible = false; BindSRO(lb_CGGL_XM.Text, lb_CGGL_VID.Text); } } #endregion /// <summary> /// 绑定引入数据 /// </summary> /// <param name="user_name"></param> /// <param name="vid"></param> private void BindSRO(string user_name, string vid) { string CGGL_ZZCG_SYSTEM_ID_In = "0"; DataTable dt_ZZCG = DAL_GSAO_KYGL.DbHelperSQL_GSAO.Query("select CGGL_ZZCG_SYSTEM_ID from CGGL_ZZCG where CGGL_VID=" + vid).Tables[0]; for (int i = 0; i < dt_ZZCG.Rows.Count; i++) CGGL_ZZCG_SYSTEM_ID_In += "," + dt_ZZCG.Rows[i]["CGGL_ZZCG_SYSTEM_ID"].ToString(); DataTable dt_SRO = DAL_GSAO_KYGL.DbHelperSQL_SRO.Query("select * from KY_ZZCG where KY_ZZCG_ID in (select KY_ZZCG_ID from KY_ZZCG_RY where name='" + user_name + "') and KY_ZZCG_ID not in (" + CGGL_ZZCG_SYSTEM_ID_In + ")").Tables[0]; if (dt_SRO.Rows.Count > 0) { //绑定并显示SRO数据 GridView1.DataSource = dt_SRO; GridView1.DataBind(); } else this.tr_SRO.Visible = false; } private void BindStu(string sVID) {
//DAL_GSAO_Common.StuaaUserData C_StuaaUserData = new DAL_GSAO_Common.StuaaUserData();
//DataTable dtStuaaUserData = C_StuaaUserData.GetAccountByVid(sVID);
//if (dtStuaaUserData.Rows.Count > 0)
//{
// lbl_YKT_ID.Text = dtStuaaUserData.Rows[0]["smartcard_id"].ToString();
//}
DAL_GSAO_JW.Controller.JW_XSXJXX C_JW_XSXJXX = new DAL_GSAO_JW.Controller.JW_XSXJXX(); DataSet ds_JW_XSXJXX = C_JW_XSXJXX.GetList_Join_All(" JW_XSJBXX.VID=" + sVID); if (ds_JW_XSXJXX.Tables[0].Rows.Count > 0) { DataRow dr_JW_XSXJXX = ds_JW_XSXJXX.Tables[0].Rows[0]; lb_CGGL_VID.Text = dr_JW_XSXJXX["VID"].ToString(); lb_CGGL_XH.Text = dr_JW_XSXJXX["XH"].ToString(); lb_CGGL_XM.Text = dr_JW_XSXJXX["XM"].ToString(); lb_CGGL_YXSM.Text = dr_JW_XSXJXX["YXSM"].ToString(); lb_CGGL_YXSM_MC.Text = dr_JW_XSXJXX["YXSMC"].ToString(); lb_CGGL_ZY_NAME.Text = dr_JW_XSXJXX["ZYMC"].ToString(); lb_CGGL_NJ.Text = dr_JW_XSXJXX["NJ"].ToString(); lb_CGGL_LDAP.Text = dr_JW_XSXJXX["LDAP_ID"].ToString(); } } protected void btn_save_Click(object sender, EventArgs e) { string from = "MY_ZZCG.aspx"; try { from = this.Request.QueryString["from"].ToString(); } catch { } if (this.tb_CGGL_ZZCG_MC.Text == "") { Common_GSAO.Tools.ShowAlert("-*-不能为空!"); return; } DAL_GSAO_KYGL.Entities.CGGL_ZZCG E_CGGL_ZZCG = new DAL_GSAO_KYGL.Entities.CGGL_ZZCG(); DAL_GSAO_KYGL.Controller.CGGL_ZZCG C_CGGL_ZZCG = new DAL_GSAO_KYGL.Controller.CGGL_ZZCG(); E_CGGL_ZZCG.CGGL_XH = this.lb_CGGL_XH.Text; E_CGGL_ZZCG.CGGL_XM = this.lb_CGGL_XM.Text; E_CGGL_ZZCG.CGGL_VID = int.Parse(this.lb_CGGL_VID.Text); E_CGGL_ZZCG.CGGL_ZY_NAME = this.lb_CGGL_ZY_NAME.Text; E_CGGL_ZZCG.CGGL_NJ = this.lb_CGGL_NJ.Text; E_CGGL_ZZCG.CGGL_LDAP = this.lb_CGGL_LDAP.Text; E_CGGL_ZZCG.CGGL_YXSM = int.Parse(this.lb_CGGL_YXSM.Text); E_CGGL_ZZCG.CGGL_YXSM_MC = this.lb_CGGL_YXSM_MC.Text; E_CGGL_ZZCG.CGGL_ZZCG_LX = ddl_CGGL_ZZCG_LX.SelectedValue; E_CGGL_ZZCG.CGGL_ZZCG_MC = tb_CGGL_ZZCG_MC.Text; E_CGGL_ZZCG.CGGL_ZZCG_CBS = tb_CGGL_ZZCG_CBS.Text; E_CGGL_ZZCG.CGGL_ZZCG_SH = tb_CGGL_ZZCG_SH.Text; E_CGGL_ZZCG.CGGL_ZZCG_GRPM = tb_CGGL_ZZCG_GRPM.Text; E_CGGL_ZZCG.CGGL_ZZCG_GZL = tb_CGGL_ZZCG_GZL.Text; E_CGGL_ZZCG.CGGL_ZZCG_ZZ = tb_CGGL_ZZCG_ZZ.Text; try { E_CGGL_ZZCG.CGGL_ZZCG_CBRQ = DateTime.Parse(tb_CGGL_ZZCG_CBRQ.Value); } catch { E_CGGL_ZZCG.CGGL_ZZCG_CBRQ = DateTime.Parse("1900-1-1"); } E_CGGL_ZZCG.CGGL_ZZCG_BZ = tb_CGGL_ZZCG_BZ.Text; E_CGGL_ZZCG.CGGL_ZZCG_SPBZ = ""; E_CGGL_ZZCG.CGGL_ZZCG_SYSTEM = ""; E_CGGL_ZZCG.CGGL_ZZCG_SYSTEM_ID = 0; //审核状态 if (from == "MY_DEPART_ZZCG.aspx") E_CGGL_ZZCG.ZT_FLG = 2; else if (from == "All_ZZCG.aspx") E_CGGL_ZZCG.ZT_FLG = 3; else E_CGGL_ZZCG.ZT_FLG = 1; C_CGGL_ZZCG.Add(E_CGGL_ZZCG); string CGGL_ZZCG_KEY = C_CGGL_ZZCG.GetMaxID(); from = "MY_ZZCG_XG.aspx?from=" + from + "&CGGL_ZZCG_KEY=" + CGGL_ZZCG_KEY; Common_GSAO.Tools.ShowAlertAndRedirect("成功保存-" + this.tb_CGGL_ZZCG_MC.Text + "-!", from); } /// <summary> /// 引入数据操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "select1") { int nIdx = Convert.ToInt32(e.CommandArgument.ToString()); GridViewRow row = this.GridView1.Rows[nIdx]; string id = row.Cells[0].Text; this.lb_CGGL_ZZCG_SYSTEM_ID.Text = id; this.lb_CGGL_ZZCG_SYSTEM.Text = "SRO"; //名称 string CGGL_ZZCG_MC = row.Cells[2].Text; tb_CGGL_ZZCG_MC.Text = CGGL_ZZCG_MC; //作者 string CGGL_ZZCG_ZZ = row.Cells[3].Text; tb_CGGL_ZZCG_ZZ.Text = CGGL_ZZCG_ZZ; //书号 string CGGL_ZZCG_SH = row.Cells[4].Text; tb_CGGL_ZZCG_SH.Text = CGGL_ZZCG_SH; //工作量 string CGGL_ZZCG_GZL = row.Cells[5].Text + "(千字)"; tb_CGGL_ZZCG_GZL.Text = CGGL_ZZCG_GZL; //出版日期 string CGGL_ZZCG_CBRQ = row.Cells[6].Text; tb_CGGL_ZZCG_CBRQ.Value = CGGL_ZZCG_CBRQ; //出版社 string CGGL_ZZCG_CBS = row.Cells[7].Text; tb_CGGL_ZZCG_CBS.Text = CGGL_ZZCG_CBS; tr_SRO.Visible = false; } } 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; } } } }