UserSelect.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:5k
源码类别:

.net编程

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using com.etong.user;
  12. using com.etong.Inform;
  13. using com.etong.BusinessRule.Zwf;
  14. using com.etong.Model;
  15. public partial class UserSelect : System.Web.UI.Page
  16. {
  17.     int ActID = -1;
  18.     int WFInstanceID = -1;
  19.     int UserID = -1;
  20.     int PrjID = -1;
  21.     protected void Page_Load(object sender, EventArgs e)
  22.     {        
  23.         try
  24.         {
  25.              ActID =Convert.ToInt32(Request.QueryString["ActID"].ToString().Trim());
  26.              WFInstanceID = Convert.ToInt32(Request.QueryString["WFInstanceID"].ToString().Trim());
  27.              UserID = Convert.ToInt32(Request.QueryString["UserID"].ToString().Trim());
  28.              PrjID = Convert.ToInt32(Request.QueryString["PrjID"].ToString().Trim());
  29.         }
  30.         catch
  31.         {
  32.             this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:传出的参数错误!');top.location.href='../login.aspx';", true);
  33.         }
  34.        
  35.         if (!IsPostBack)
  36.         {
  37.             PrjCheck prjcheck = new PrjCheck();
  38.             DataView dv = prjcheck.GetUser(ActID,WFInstanceID);
  39.             GridView1.DataSource = dv;
  40.             GridView1.DataBind();
  41.         }
  42.     }
  43.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  44.     {        
  45.         int currentpageindex;
  46.         currentpageindex = Convert.ToInt32(e.NewPageIndex);
  47.         if (currentpageindex == -2)
  48.         {
  49.             TextBox txtNewPageIndex;
  50.             txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
  51.             if (txtNewPageIndex != null)
  52.             {
  53.                 try
  54.                 {
  55.                     currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
  56.                 }
  57.                 catch
  58.                 {
  59.                     currentpageindex = 0;
  60.                 }
  61.             }
  62.         }
  63.         currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
  64.         currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
  65.         GridView1.PageIndex = currentpageindex;
  66.         PrjCheck prjcheck = new PrjCheck();
  67.         DataView dv = prjcheck.GetUser(ActID, WFInstanceID);
  68.         GridView1.DataSource = dv;
  69.         GridView1.DataBind();
  70.     }   
  71.     protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  72.     {
  73.         string EmpType = "";
  74.         GridViewRow row = ((Control)e.CommandSource).BindingContainer as GridViewRow;
  75.         int index = row.RowIndex;     
  76.         if (e.CommandName == "Select")
  77.         {           
  78.             EtongZwf etongzwf = new EtongZwf();
  79.             PrjCheck prjcheck = new PrjCheck();
  80.             bool ReActInsValue = false;
  81.             ReActInsValue = etongzwf.WFActInsUpdata(ActID,UserID,3);
  82.             if (ReActInsValue == true)
  83.             {
  84.                 //产生回退活动事例
  85.                 // 注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
  86.                 int ReActInsValue2 = 0;
  87.                 DataView dvAct = prjcheck.GetByActInsId(ActID, PrjID);
  88.                 int PreviousActID = -1;
  89.                 int PreviousUserID = -1;
  90.                 int PreviousRoleID = -1;
  91.                 if (dvAct.Count>0)
  92.                 {
  93.                     for (int i = 0; i < dvAct.Count; i++)
  94.                     {
  95.                         UserID = Convert.ToInt32(GridView1.DataKeys[index].Value.ToString());                      
  96.                         PreviousActID = Convert.ToInt16(dvAct[i]["PreviousActID"].ToString().Trim());
  97.                         PreviousUserID = Convert.ToInt16(dvAct[i]["PreviousUserID"].ToString().Trim());
  98.                         PreviousRoleID = Convert.ToInt16(dvAct[i]["PreviousRoleID"].ToString().Trim());
  99.                         if (PreviousUserID == UserID)
  100.                         {
  101.                             break;
  102.                         }
  103.                     }
  104.                 }
  105.                 dvAct = prjcheck.GetEmptype(PreviousUserID);
  106.                 if (dvAct.Count > 0)
  107.                 {
  108.                     EmpType =dvAct[0]["EmpType"].ToString();
  109.                 }
  110.                 WFActInsInfo wfactinsinfo2 = new WFActInsInfo(-1, PreviousActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  111.                                                                     2, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, EmpType, PreviousUserID, PreviousRoleID);
  112.                 ReActInsValue2 = etongzwf.WFActInsADD(wfactinsinfo2);
  113.                 if (ReActInsValue2 != 0)
  114.                      this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>window.returnValue='success';window.close();</script>");                  
  115.                 
  116.             }           
  117.         }
  118.     }
  119. }