UserSelect.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:5k
- 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 com.etong.user;
- using com.etong.Inform;
- using com.etong.BusinessRule.Zwf;
- using com.etong.Model;
- public partial class UserSelect : System.Web.UI.Page
- {
- int ActID = -1;
- int WFInstanceID = -1;
- int UserID = -1;
- int PrjID = -1;
- protected void Page_Load(object sender, EventArgs e)
- {
- try
- {
- ActID =Convert.ToInt32(Request.QueryString["ActID"].ToString().Trim());
- WFInstanceID = Convert.ToInt32(Request.QueryString["WFInstanceID"].ToString().Trim());
- UserID = Convert.ToInt32(Request.QueryString["UserID"].ToString().Trim());
- PrjID = Convert.ToInt32(Request.QueryString["PrjID"].ToString().Trim());
- }
- catch
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:传出的参数错误!');top.location.href='../login.aspx';", true);
- }
-
- if (!IsPostBack)
- {
- PrjCheck prjcheck = new PrjCheck();
- DataView dv = prjcheck.GetUser(ActID,WFInstanceID);
- GridView1.DataSource = dv;
- GridView1.DataBind();
- }
- }
- protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
- {
- int currentpageindex;
- currentpageindex = Convert.ToInt32(e.NewPageIndex);
- if (currentpageindex == -2)
- {
- TextBox txtNewPageIndex;
- txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
- if (txtNewPageIndex != null)
- {
- try
- {
- currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
- }
- catch
- {
- currentpageindex = 0;
- }
- }
- }
- currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
- currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
- GridView1.PageIndex = currentpageindex;
- PrjCheck prjcheck = new PrjCheck();
- DataView dv = prjcheck.GetUser(ActID, WFInstanceID);
- GridView1.DataSource = dv;
- GridView1.DataBind();
- }
- protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
- {
- string EmpType = "";
- GridViewRow row = ((Control)e.CommandSource).BindingContainer as GridViewRow;
- int index = row.RowIndex;
- if (e.CommandName == "Select")
- {
- EtongZwf etongzwf = new EtongZwf();
- PrjCheck prjcheck = new PrjCheck();
- bool ReActInsValue = false;
- ReActInsValue = etongzwf.WFActInsUpdata(ActID,UserID,3);
- if (ReActInsValue == true)
- {
- //产生回退活动事例
- // 注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
- int ReActInsValue2 = 0;
- DataView dvAct = prjcheck.GetByActInsId(ActID, PrjID);
- int PreviousActID = -1;
- int PreviousUserID = -1;
- int PreviousRoleID = -1;
- if (dvAct.Count>0)
- {
- for (int i = 0; i < dvAct.Count; i++)
- {
- UserID = Convert.ToInt32(GridView1.DataKeys[index].Value.ToString());
- PreviousActID = Convert.ToInt16(dvAct[i]["PreviousActID"].ToString().Trim());
- PreviousUserID = Convert.ToInt16(dvAct[i]["PreviousUserID"].ToString().Trim());
- PreviousRoleID = Convert.ToInt16(dvAct[i]["PreviousRoleID"].ToString().Trim());
- if (PreviousUserID == UserID)
- {
- break;
- }
- }
- }
- dvAct = prjcheck.GetEmptype(PreviousUserID);
- if (dvAct.Count > 0)
- {
- EmpType =dvAct[0]["EmpType"].ToString();
- }
- WFActInsInfo wfactinsinfo2 = new WFActInsInfo(-1, PreviousActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 2, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, EmpType, PreviousUserID, PreviousRoleID);
- ReActInsValue2 = etongzwf.WFActInsADD(wfactinsinfo2);
- if (ReActInsValue2 != 0)
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>window.returnValue='success';window.close();</script>");
-
- }
- }
- }
- }