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

.net编程

开发平台:

C#

  1. using System;
  2. using System.Text;
  3. using System.Data.SqlClient;
  4. using com.etong.SqlDataConnect;
  5. using System.Data;
  6. using com.etong.DBUtility;
  7. using com.etong.Model;
  8. using System.Configuration;
  9. using System.Collections;
  10. using System.Xml;
  11. namespace com.etong.BusinessRule.Zwf
  12. {
  13.     public class EtongZwf
  14.     {
  15.         private MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
  16.         public EtongZwf()
  17.         {
  18.             //
  19.             // TODO: 在此处添加构造函数逻辑
  20.             //
  21.         }
  22.         #region  用户管理
  23.         /*************************************************************************************************************  
  24.                                              * Module: 用户管理
  25.                                              * Desc: 添加、更新、删除、查询记录
  26.                                              * Author:朱皖峰
  27.                                              * Date: 2007-03
  28.         **************************************************************************************************************/
  29.         /// <summary>
  30.         /// 添加用户记录
  31.         /// </summary>
  32.         /// <returns>返回一bool类型值</returns>
  33.         public bool UserAdd(int empid, string useraccount, string usercode, string userdecs, int ordinal, string userpwd, int islock,
  34.                            string ipaddress,int isipbound,DateTime editdate,DateTime fromdate,DateTime todate)
  35.         {
  36.             QueryParameterCollection Params = new QueryParameterCollection();
  37.             Params.Clear();
  38.             Params.Add("@empid", empid);
  39.             Params.Add("@useraccount", useraccount);
  40.             Params.Add("@usercode", usercode);
  41.             Params.Add("@userdecs", userdecs);
  42.             Params.Add("@ordinal", ordinal);
  43.             Params.Add("@userpwd", userpwd);
  44.             Params.Add("@islock", islock);
  45.             Params.Add("@ipaddress", ipaddress);
  46.             Params.Add("@isipbound", isipbound);
  47.             Params.Add("@editdate", editdate);
  48.             Params.Add("@fromdate", fromdate);
  49.             Params.Add("@todate", todate);
  50.             string sSQL = "insert into Tb_Sys_User([EmpID],[UserAccount],[UserCode],[UserDecs],[OrdInal],[UserPwd],[IsLock],[IPAddress],[IsIPBound],[EditDate],[FromDate],[ToDate]) values(" +
  51.                            "@empid ,@useraccount,@usercode,@userdecs,@ordinal,@userpwd,@islock,@ipaddress,@isipbound,@editdate,@fromdate,@todate)";
  52.             MSDA.Open();
  53.      
  54.             NewObj newobject=new NewObj();
  55.             bool returnvalue =newobject.insert(sSQL, Params, CommandType.Text);
  56.             MSDA.Close();
  57.             return returnvalue;
  58.         }
  59.         /// <summary>
  60.         /// 更新用户记录
  61.         /// </summary>
  62.         /// <returns>返回bool类型参数</returns>
  63.         public bool UserUpdata(int @userid, int empid, string useraccount, string usercode, string userdecs, int ordinal, string userpwd, int islock,
  64.                            string ipaddress, int isipbound, DateTime editdate, DateTime fromdate, DateTime todate)
  65.         {
  66.             QueryParameterCollection Params = new QueryParameterCollection();
  67.             Params.Clear();
  68.             Params.Add("@userid", @userid);
  69.             Params.Add("@empid", empid);
  70.             Params.Add("@useraccount", useraccount);
  71.             Params.Add("@usercode", usercode);
  72.             Params.Add("@userdecs", userdecs);
  73.             Params.Add("@ordinal", ordinal);
  74.             Params.Add("@userpwd", userpwd);
  75.             Params.Add("@islock", islock);
  76.             Params.Add("@ipaddress", ipaddress);
  77.             Params.Add("@isipbound", isipbound);
  78.             Params.Add("@editdate", editdate);
  79.             Params.Add("@fromdate", fromdate);
  80.             Params.Add("@todate", todate);
  81.             string sSQL = "update  Tb_Sys_User Set EmpID =@empid,UserAccount=@useraccount,UserCode=@usercode,UserDecs=@userdecs,OrdInal=@ordinal,UserPwd=@userpwd,IsLock=@islock," +
  82.             "IPAddress=@ipaddress,IsIPBound=@isipbound,EditDate=@editdate,FromDate=@fromdate,ToDate=@todate  where UserID=@userid";
  83.             MSDA.Open();
  84.            NewObj newobject=new NewObj();
  85.            bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  86.             MSDA.Close();
  87.             return returnvalue;
  88.         }
  89.        /// <summary>
  90.        /// 删除用户记录
  91.        /// </summary>
  92.        /// <param name="userid">用户ID</param>
  93.         public void UserDelete(int UserID)
  94.         {
  95.             string sSQL = "delete from Tb_Sys_User where [UserID]='" + UserID + "'";
  96.             MSDA.Open();
  97.             MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
  98.             MSDA.Close();
  99.         }
  100.         /// <summary>
  101.         /// 查询指定或全部用户记录
  102.         /// </summary>
  103.         /// <param name="SearchTxt">查找内容</param>
  104.         /// <param name="IsSearch">是否精确查询</param>
  105.         /// <param name="i">查找关键字,例:1:帐号;2:用户名;3:组织机构;4:用户id;非1,2,3,4且SearchTxt为空:查找全部</param>
  106.         public DataView  UserSearch(string SearchTxt, string i,bool IsSearch)
  107.         {
  108.             string sSQL = "select * from Tb_Sys_User a ,Tb_Sys_Employee b,Tb_Sys_Organization c  where  ";
  109.             
  110.          if(SearchTxt!="")
  111.          {
  112.              if (IsSearch == true)
  113.              {
  114.                  switch (i)
  115.                  {
  116.                      case "1":
  117.                          sSQL = sSQL + "  a.UserAccount like '%" + SearchTxt + "%' and ";
  118.                          break;
  119.                      case "2":
  120.                          sSQL = sSQL + "  b.EmpName like '%" + SearchTxt + "%' and ";
  121.                          break;
  122.                      case "3":
  123.                          sSQL = sSQL + "  c.OrgName like '%" + SearchTxt + "%' and ";
  124.                          break;
  125.                      case "4":
  126.                          sSQL = sSQL + "  a.UserID like '%" + SearchTxt + "%' and ";
  127.                          break;
  128.                  }
  129.              }
  130.              else
  131.              { //精确查询
  132.                  switch (i)
  133.                  {
  134.                      case "1":
  135.                          sSQL = sSQL + "  a.UserAccount='" + SearchTxt + "' and ";
  136.                          break;
  137.                      case "2":
  138.                          sSQL = sSQL + " b.EmpName='" + SearchTxt + "'  and ";
  139.                          break;
  140.                      case "3":
  141.                          sSQL = sSQL + " c.OrgName='" + SearchTxt + "'  and ";
  142.                          break;
  143.                      case "4":
  144.                          sSQL = sSQL + "a.UserID='" + SearchTxt + "'  and ";
  145.                          break;
  146.                  }
  147.              }
  148.          }
  149.          sSQL=sSQL+" b.EmpID=a.EmpID and c.OrgID=b.PrimaryOrgID";
  150.           
  151.             MSDA.Open();
  152.             NewObj newobject = new NewObj();
  153.            // bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  154.             DataView dv;
  155.             try
  156.             {
  157.                  dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  158.             }
  159.             catch
  160.             {
  161.                 dv = null;
  162.             }
  163.             // MSDA.ExecuteDataset(CommandType.Text, sSQL, null, ds, "");
  164.             finally
  165.             {
  166.                 MSDA.Close();
  167.             }
  168.             return dv; //ds.Tables[0].DefaultView;
  169.            
  170.         }
  171.         /// <summary>
  172.         /// 获取所有角色列表
  173.         /// </summary>
  174.         public DataView RoleGetAll()
  175.         {
  176.             string sSQL = "select  RoleID ,RoleName from Tb_Sys_Role";
  177.            
  178.             MSDA.Open();
  179.             NewObj newobject = new NewObj();
  180.             DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  181.           
  182.             MSDA.Close();
  183.             return dv; 
  184.         }
  185.         /// <summary>
  186.         /// 添加用户权限记录
  187.         /// </summary>
  188.         /// <returns>返回一bool类型值</returns>
  189.         public bool UserRoleAdd(int userid, int roleid, DateTime editdate)
  190.         {
  191.             QueryParameterCollection Params = new QueryParameterCollection();
  192.             Params.Clear();
  193.             Params.Add("@userid", userid);
  194.             Params.Add("@roleid", roleid);
  195.             Params.Add("@editdate", editdate);
  196.             string sSQL = "insert into Tb_Sys_UserRole([UserID],[RoleID],[EditDate]) values(@userid,@roleid,@editdate)";
  197.             MSDA.Open();
  198.             NewObj newobject = new NewObj();
  199.             bool returnvalue = newobject.insert(sSQL, Params, CommandType.Text);
  200.             MSDA.Close();
  201.             return returnvalue;
  202.         }
  203.         /// <summary>
  204.         ///清除用户对应的权限记录
  205.         /// </summary>
  206.         /// <param name="userid">用户ID</param>
  207.         public void UserRoleDelete(int UserID)
  208.         {
  209.             string sSQL = "delete from Tb_Sys_UserRole where [UserID]='" + UserID + "'";
  210.             MSDA.Open();
  211.             MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
  212.             MSDA.Close();
  213.         }
  214.         /// <summary>
  215.         /// 获取某个用户角色
  216.         /// </summary>
  217.         public DataView RoleGetByID(int userid)
  218.         {
  219.             //string sSQL = "select  RoleID ,RoleName from Tb_Sys_Role where  UserID='" + userid + "'";
  220.             string sSQL = "select * from Tb_Sys_Role where  RoleID in(select RoleID from Tb_Sys_UserRole where UserID='" + userid + "')";
  221.             MSDA.Open();
  222.             NewObj newobject = new NewObj();
  223.             DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  224.             MSDA.Close();
  225.             return dv;
  226.         }
  227.         /// <summary>
  228.         /// 初始化用户密码
  229.         /// </summary>
  230.         /// <returns>返回bool类型参数</returns>
  231.         public bool UserPwdUpdata(int @userid)
  232.         {
  233.             QueryParameterCollection Params = new QueryParameterCollection();
  234.             Params.Clear();
  235.             Params.Add("@userid", @userid);
  236.             //string sSQL = "update  Tb_Sys_User Set UserPwd='111111'  where UserID=@userid";
  237.             string sSQL = "update  Tb_Sys_User Set UserPwd='1'  where UserID=@userid";
  238.             MSDA.Open();
  239.             NewObj newobject = new NewObj();
  240.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  241.             MSDA.Close();
  242.             return returnvalue;
  243.         }
  244.         /// <summary>
  245.         /// 获取某个角色信息 
  246.         /// </summary>
  247.         public DataView RoleGetName(int roleid)
  248.         {
  249.             string sSQL = "select  RoleName from Tb_Sys_Role where  RoleID='" + roleid + "'";
  250.          
  251.             MSDA.Open();
  252.             NewObj newobject = new NewObj();
  253.             DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  254.             MSDA.Close();
  255.             return dv;
  256.         }
  257.         /// <summary>
  258.         /// 得到某个业务角色的所有用户
  259.         /// </summary>
  260.         /// <param name="SOrgID">业务角色ID</param>
  261.         public DataView GetOrgzation(int  OpID)
  262.         {
  263.             //string sSQL = "select OrgName from Tb_Sys_Organization where OrgID=" + orgid;
  264.            // string sSQL = "select * from tb_sys_empoprole where OpID=" + OpID;
  265.             string sSQL = "select OpName,OpID from tb_sys_oprole where OpID=" + OpID;
  266.           
  267.             MSDA.Open();
  268.             NewObj newobject = new NewObj();
  269.             DataView dv;
  270.             try
  271.             {
  272.                  dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  273.             }
  274.             catch
  275.             {
  276.                 dv = null;
  277.             }
  278.             finally
  279.             {
  280.                 MSDA.Close();
  281.             }
  282.            return dv;
  283.         }
  284.         /// <summary>
  285.         /// 根据用户ID得到组织机构ID
  286.         /// </summary>
  287.       
  288.         public int  GetOrgID(int userid)
  289.         {
  290.             string sSQL = "select PrimaryOrgID from Tb_Sys_Employee where EmpID =(select EmpID from Tb_Sys_User where UserID='" + userid +"')";
  291.             MSDA.Open();
  292.             NewObj newobject = new NewObj();
  293.          
  294.             int orgid;
  295.             try
  296.             {
  297.                 DataView dv;
  298.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  299.                 orgid = Convert.ToInt16(dv[0][0].ToString().Trim());
  300.             }
  301.             catch
  302.             {
  303.                 orgid = -1;
  304.             }
  305.             finally
  306.             {
  307.                 MSDA.Close();
  308.             }
  309.             return orgid;
  310.         }
  311.         #endregion
  312.         #region  项目分类
  313.         /*************************************************************************************************************  
  314.                                            * Module: 项目分类
  315.                                            * Desc:添加、更新、删除、查询记录
  316.                                            * Author:朱皖峰
  317.                                            * Date: 2007-03
  318.        **************************************************************************************************************/
  319.         /// <summary>
  320.         /// 添加项目分类
  321.         /// </summary>
  322.         /// <returns>返回一bool类型值</returns>
  323.         public bool ProjectAdd(string serialname)
  324.         {
  325.             QueryParameterCollection Params = new QueryParameterCollection();
  326.             Params.Clear();
  327.             Params.Add("@SerialName", serialname);
  328.             string sSQL = "insert into tb_Project_Serial([SerialName]) values(@SerialName)";
  329.             MSDA.Open();
  330.             NewObj newobject = new NewObj();
  331.             bool returnvalue = newobject.insert(sSQL, Params, CommandType.Text);
  332.             MSDA.Close();
  333.             return returnvalue;
  334.         }
  335.         /// <summary>
  336.         /// 更新项目分类
  337.         /// </summary>
  338.         /// <returns>返回bool类型参数</returns>
  339.         public bool ProjectUpdata(int serialid, string serialname)
  340.         {
  341.             QueryParameterCollection Params = new QueryParameterCollection();
  342.             Params.Clear();
  343.             Params.Add("@serialid", serialid);
  344.             Params.Add("@serialname", serialname);
  345.             string sSQL = "update  tb_Project_Serial Set SerialName =@serialname  where SerialID=@serialid";
  346.             MSDA.Open();
  347.             NewObj newobject = new NewObj();
  348.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  349.             MSDA.Close();
  350.             return returnvalue;
  351.         }
  352.         /// <summary>
  353.         /// 删除项目分类
  354.         /// </summary>
  355.         /// <param name="userid">项目分类ID</param>
  356.         public void ProjectDelete(int serialid)
  357.         {
  358.             string sSQL = "delete from tb_Project_Serial where [SerialID]='" + serialid + "'";
  359.             MSDA.Open();
  360.             MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
  361.             MSDA.Close();
  362.         }
  363.         /// <summary>
  364.         /// 获取项目分类记录
  365.         /// </summary>
  366.         public DataView ProjectSearch(int serialid)
  367.         {
  368.             string sSQL = "select * from tb_Project_Serial";
  369.             if (serialid != -1)
  370.                 sSQL = sSQL + "  where   SerialID='" + serialid + "'"; 
  371.       
  372.             MSDA.Open();
  373.             NewObj newobject = new NewObj();
  374.             DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  375.          
  376.             MSDA.Close();
  377.             return dv;
  378.         }
  379.       /// <summary>
  380.         /// 根据项目名称获取项目分类记录
  381.       /// </summary>
  382.       /// <param name="serialid">项目名称</param>
  383.       /// <returns></returns>
  384.         public int ProjectSearchByName(string serialname)
  385.         {
  386.             string sSQL = "select * from tb_Project_Serial where   SerialName='" + serialname + "'";
  387.       
  388.             MSDA.Open();
  389.             NewObj newobject = new NewObj();
  390.             DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  391.             MSDA.Close();
  392.             int returnvalue=0;
  393.             returnvalue = dv.Count;
  394.             return returnvalue;
  395.         }
  396.         /// <summary>
  397.         /// 获取全部项目分类记录
  398.         /// </summary>
  399.         public DataTable ProjectSerialGetAll()
  400.         {
  401.             string sSQL = "select * from tb_Project_Serial";
  402.             MSDA.Open();
  403.             NewObj newobject = new NewObj();
  404.             DataTable dt = new DataTable();
  405.             dt = null;
  406.             dt = newobject.Search(sSQL, null, CommandType.Text).Tables[0];
  407.             MSDA.Close();
  408.             return dt;
  409.         }
  410.         #endregion
  411.         #region  工作流
  412.         /***************************************************************************************************************  
  413.                                               * Module: 工作流
  414.                                               * Desc:项目申请
  415.                                               * Author:朱皖峰
  416.                                               * Date: 2007-04
  417.         ****************************************************************************************************************/
  418.         ///// <summary>
  419.         ///// 启动工作流
  420.         ///// </summary>
  421.         ///// <param name="UserId">用户ID</param>
  422.         ///// <param name="WFId">启动工作流ID</param>
  423.         ///// <returns>返回string类型数据:流水号</returns>
  424.         //public bool WorkFlowStart(out WFStartReValue[] WF_StartReValue, int UserId, int WFId)
  425.         //{
  426.         //    string StrProjcetLsh = DateTime.Now.ToString("yyyyMMdd");//例如:20070410   
  427.         //    int Lsh = 1;
  428.         //    //取tb_Project 中字段ProjcetLsh的最大值
  429.         //    MSDA.Open();
  430.         //    DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_ProjectMaxLsh", null);
  431.         //    if (dt.Rows.Count > 0 && dt.Rows[0]["ProjcetLsh"].ToString() != "")
  432.         //    {
  433.         //        string ProjcetLsh = dt.Rows[0]["ProjcetLsh"].ToString().Trim();
  434.         //        Lsh = Convert.ToInt32(ProjcetLsh.Substring(8).Trim().ToString()) + 1;
  435.         //    }
  436.         //    int strlen = Lsh.ToString().Trim().Length;
  437.         //    for (int i = 1; i <= 5 - strlen; i++)
  438.         //    {
  439.         //        StrProjcetLsh = StrProjcetLsh + "0";  //格式化流水号后五位,补0
  440.         //    }
  441.         //    StrProjcetLsh = StrProjcetLsh + Lsh.ToString();   //记录中最大值 化为int型后 +1  
  442.         //    //向tb_Project中添加空项目记录
  443.         //    WFStartReValue[] returnvalue=new WFStartReValue[1];
  444.         //    if (StrProjcetLsh != "")
  445.         //    {
  446.         //        returnvalue[0].LSH = StrProjcetLsh;
  447.         //        WF_StartReValue = returnvalue;
  448.         //        return true;
  449.         //    }
  450.         //    else
  451.         //    {
  452.         //        returnvalue[0].LSH = "";
  453.         //        WF_StartReValue = returnvalue;
  454.         //        return false;
  455.         //    }
  456.         //}
  457.         /// <summary>
  458.         /// 工作流启动返回信息结构
  459.         /// </summary>
  460.         public struct WFStartReValue   
  461.         {
  462.             public string LSH;          //流水号
  463.           //  public int PROJECTID;      //项目ID
  464.         }
  465.         /// <summary>
  466.         /// 获取项目记录
  467.         /// </summary>
  468.         public DataView ProjectGetAll(int prjid)
  469.         {
  470.            string sSQL = "select * from tb_Project  where  ProjectID='"+ prjid +"'";
  471.             MSDA.Open();
  472.             NewObj newobject = new NewObj();
  473.             DataView dv = null;
  474.             dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  475.             MSDA.Close();
  476.             return dv;
  477.         }
  478.         /// <summary>
  479.         /// 获取变更项目记录
  480.         /// </summary>
  481.         public DataView PrjAlertGetAll(int alertid)
  482.         {
  483.             string sSQL = "select * from tb_PrjAlert  where  AlertID='" + alertid + "'";
  484.             MSDA.Open();
  485.             NewObj newobject = new NewObj();
  486.             DataView dv = null;
  487.             dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  488.             MSDA.Close();
  489.             return dv;
  490.         }
  491.         /// <summary>
  492.         /// 获取工作流实例信息
  493.         /// </summary>
  494.         /// <param name="WFInstanceID"></param>
  495.         /// <returns></returns>
  496.         public DataView WFInstanceGetAll(int WFInstanceID)
  497.         {
  498.             string sSQL = "select * from tb_WF_Instance where WFInstanceID='"  + WFInstanceID + "' ";
  499.             MSDA.Open();
  500.             NewObj newobject = new NewObj();
  501.             DataView dv = null;
  502.             dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  503.             MSDA.Close();
  504.             return dv;
  505.         }
  506.         /// <summary>
  507.         ///添加项目
  508.         /// </summary>
  509.         public int  WFProjectAdd(ProjectInfo projectinfo)
  510.         {
  511.           
  512.             SqlParameter[] parameters ={ 
  513.                 new SqlParameter ("@ProjectID",SqlDbType.Int ,4),
  514.                 new SqlParameter ("@ProjectName" ,SqlDbType.VarChar,200),
  515.                 new SqlParameter ("@PrjSort" ,SqlDbType.VarChar,2),
  516.                 new SqlParameter ("@JcTransactor" ,SqlDbType.VarChar,30),
  517.                 new SqlParameter ("@JcFName" ,SqlDbType.VarChar,100),
  518.                 new SqlParameter ("@QuestOrg" ,SqlDbType.VarChar,100),  
  519.                 new SqlParameter ("@ZgTransactor" ,SqlDbType.VarChar,30),
  520.                 new SqlParameter ("@ZgFName" ,SqlDbType.VarChar,100),
  521.                 new SqlParameter ("@JqbXTransactor" ,SqlDbType.VarChar,30),
  522.                 new SqlParameter ("@JqbXFName" ,SqlDbType.VarChar,100),
  523.                 new SqlParameter ("@GcglXTransactor" ,SqlDbType.VarChar,30),
  524.                 new SqlParameter ("@GcglXFName" ,SqlDbType.VarChar,100), 
  525.                 new SqlParameter ("@JqbBTransactor" ,SqlDbType.VarChar,30),
  526.                 new SqlParameter ("@JqbBFName" ,SqlDbType.VarChar,100),
  527.                 new SqlParameter ("@GcglHTransactor" ,SqlDbType.VarChar,30),
  528.                 new SqlParameter ("@GcglHFName" ,SqlDbType.VarChar,100),
  529.                 new SqlParameter ("@FgTransactor" ,SqlDbType.VarChar,20),
  530.                 new SqlParameter ("@FgIdea" ,SqlDbType.VarChar,200),
  531.                 new SqlParameter ("@ZjwyhTransactor" ,SqlDbType.VarChar,20),
  532.                 new SqlParameter ("@ZjwyhIdea" ,SqlDbType.VarChar,200), 
  533.                 new SqlParameter ("@GsTransactor" ,SqlDbType.VarChar,20),
  534.                 new SqlParameter ("@GsIdea" ,SqlDbType.VarChar,400),
  535.                 new SqlParameter ("@GcglQTransactor" ,SqlDbType.VarChar,20),
  536.                 new SqlParameter ("@GcglQIdea" ,SqlDbType.VarChar,200),
  537.                 new SqlParameter ("@JqbZTransactor" ,SqlDbType.VarChar,30),
  538.                 new SqlParameter ("@JqbZFName" ,SqlDbType.VarChar,100),
  539.                 new SqlParameter ("@Status" ,SqlDbType.Int,2),
  540.             };
  541.           
  542.             parameters[0].Direction = ParameterDirection.Output;
  543.             parameters[1].Value = projectinfo.ProjectName;
  544.             parameters[2].Value = projectinfo.PrjSort;
  545.             parameters[3].Value = projectinfo.JcTransactor;
  546.             parameters[4].Value = projectinfo.JcFName;
  547.             parameters[5].Value = projectinfo.QuestOrg;
  548.             parameters[6].Value = projectinfo.ZgTransactor;
  549.             parameters[7].Value = projectinfo.ZgFName;
  550.             parameters[8].Value = projectinfo.JqbxTransactor;
  551.             parameters[9].Value = projectinfo.JqbxFName;
  552.             parameters[10].Value = projectinfo.GcglxTransactor;
  553.             parameters[11].Value = projectinfo.GcglxFName;
  554.             parameters[12].Value = projectinfo.JqbbTransactor;
  555.             parameters[13].Value = projectinfo.JqbbFName;
  556.             parameters[14].Value = projectinfo.GcglhTransactor;
  557.             parameters[15].Value = projectinfo.GcglhFName;
  558.             parameters[16].Value = projectinfo.FgTransactor;
  559.             parameters[17].Value = projectinfo.FgIdea;
  560.             parameters[18].Value = projectinfo.ZjwyhTransactor;
  561.             parameters[19].Value = projectinfo.ZjwyhIdea;
  562.             parameters[20].Value = projectinfo.GsTransactor;
  563.             parameters[21].Value = projectinfo.GsIdea;
  564.             parameters[22].Value = projectinfo.GcglqTransactor;
  565.             parameters[23].Value = projectinfo.GcglqIdea;
  566.             parameters[24].Value = projectinfo.JqbzTransactor;
  567.             parameters[25].Value = projectinfo.JqbzFName;
  568.             parameters[26].Value = projectinfo.Status;
  569.             int rv = 0;
  570.             try
  571.             { 
  572.                 SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "P_Project_ADD", parameters);
  573.                 rv = Convert.ToInt32(parameters[0].Value.ToString().Trim());
  574.             }
  575.             catch 
  576.             {
  577.                rv = 0;
  578.             }
  579.             return rv;
  580.         }
  581.         /// <summary>
  582.         /// 添加工作流实例记录
  583.         /// </summary>
  584.         /// <param name="wfinstanceinfo"></param>
  585.         /// <returns></returns>
  586.         public int  WFInstanceADD(WFInstanceInfo wfinstanceinfo)
  587.         {
  588.             SqlParameter[] parameters ={ 
  589.                 new SqlParameter ("@WFInstanceID",SqlDbType.Int,4),
  590.                 new SqlParameter ("@CreateDate",SqlDbType.DateTime ,8),
  591.                 new SqlParameter ("@CreateUserID",SqlDbType.Int ,4),
  592.                 new SqlParameter ("@TargetRoleID",SqlDbType.Int ,4),
  593.                 new SqlParameter ("@ClientID",SqlDbType.Int ,4),
  594.                 new SqlParameter ("@RealEndDate",SqlDbType.DateTime ,8),
  595.                 new SqlParameter ("@Status",SqlDbType.Int ,4),
  596.                 new SqlParameter ("@TheoryEndDate",SqlDbType.DateTime ,8),
  597.                 new SqlParameter ("@WorkFlowID",SqlDbType.Int ,4),
  598.                 new SqlParameter ("@PrjID",SqlDbType.Int ,4),
  599.             };
  600.             parameters[0].Direction = ParameterDirection.Output;
  601.             parameters[1].Value = wfinstanceinfo.CreateDate;
  602.             parameters[2].Value = wfinstanceinfo.CreateUserID;
  603.             parameters[3].Value = wfinstanceinfo.TargetRoleID;
  604.             parameters[4].Value = wfinstanceinfo.ClientID;
  605.             parameters[5].Value = wfinstanceinfo.RealEndDate;
  606.             parameters[6].Value = wfinstanceinfo.Status;   
  607.             parameters[7].Value = wfinstanceinfo.TheoryEndDate;
  608.             parameters[8].Value = wfinstanceinfo.WorkflowID;
  609.             parameters[9].Value = wfinstanceinfo.PrjID;
  610.             int WFInstanceID = 0;
  611.             try
  612.             {
  613.                 SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_Instance_ADD", parameters);
  614.                  WFInstanceID = Convert.ToInt32(parameters[0].Value.ToString().Trim());
  615.             }
  616.             catch
  617.             {
  618.             
  619.                 WFInstanceID = 0;
  620.             }
  621.             return WFInstanceID;
  622.         }
  623.         /// <summary>
  624.         /// 提交申请项目记录
  625.         /// </summary>
  626.         /// <param name="projectinfo"></param>
  627.         /// <returns>返回类型:int 返回值:0:表示不成功,-1:成功</returns>
  628.         public int  WFProjectUpdata(ProjectInfo projectinfo)
  629.         {
  630.             //SqlParameter[] parameters ={ 
  631.             //    new SqlParameter ("@ProjectID",SqlDbType.Int ,4),
  632.             //    new SqlParameter ("@AuditIdea" ,SqlDbType.VarChar,20),
  633.             //    new SqlParameter ("@ChargeMachine" ,SqlDbType.Decimal,14),
  634.             //    new SqlParameter ("@ChargeManPower" ,SqlDbType.Decimal,14),
  635.             //    new SqlParameter ("@ChargeOther" ,SqlDbType.Decimal,14),
  636.             //    new SqlParameter("@ChargeStuff" ,SqlDbType.Decimal ,14),
  637.             //    new SqlParameter ("@ChargeSum" ,SqlDbType.Decimal,15),
  638.             //    new SqlParameter ("@CreateDate" ,SqlDbType.DateTime,8),
  639.             //    new SqlParameter ("@Yw_ChargeMachine" ,SqlDbType.Decimal,14),
  640.             //    new SqlParameter ("@Yw_ChargeManPower" ,SqlDbType.Decimal,14),
  641.             //    new SqlParameter ("@Yw_ChargeOther" ,SqlDbType.Decimal,14),
  642.             //    new SqlParameter ("@Yw_ChargeStuff" ,SqlDbType.Decimal,14),
  643.             //    new SqlParameter ("@Yw_ChargeSum" ,SqlDbType.Decimal,15),
  644.             //    new SqlParameter ("@Yw_ExpenseChannel" ,SqlDbType.VarChar,200),
  645.             //    new SqlParameter ("@Yw_ProjectNumber" ,SqlDbType.VarChar,100),
  646.             //    new SqlParameter ("@Yw_TransactorIdea" ,SqlDbType.VarChar,200),
  647.             //    new SqlParameter ("@Yw_TransactorSignature" ,SqlDbType.VarChar,20),
  648.             //    new SqlParameter ("@DirectorGeneralIdea" ,SqlDbType.VarChar,200),
  649.             //    new SqlParameter ("@EditUnit" ,SqlDbType.VarChar,100),
  650.             //    new SqlParameter ("@GeneralManagerIdea" ,SqlDbType.VarChar,200),
  651.             //    new SqlParameter ("@Fg_ChargeMachine" ,SqlDbType.Decimal,14),
  652.             //    new SqlParameter ("@Fg_ChargeManPower" ,SqlDbType.Decimal,14),
  653.             //    new SqlParameter ("@Fg_ChargeOther" ,SqlDbType.Decimal,14),
  654.             //    new SqlParameter ("@Fg_ChargeStuff" ,SqlDbType.Decimal,14),
  655.             //    new SqlParameter ("@Fg_ChargeSum" ,SqlDbType.Decimal,15),
  656.             //    new SqlParameter ("@Fg_ExpenseChannel" ,SqlDbType.VarChar,200),
  657.             //    new SqlParameter ("@Fg_ProjectNumber" ,SqlDbType.VarChar,100),
  658.             //    new SqlParameter ("@Fg_TransactorIdea" ,SqlDbType.VarChar,200),
  659.             //    new SqlParameter ("@Fg_TransactorSignature" ,SqlDbType.VarChar,20),
  660.             //    new SqlParameter ("@Zjl_ChargeMachine" ,SqlDbType.Decimal,14),
  661.             //    new SqlParameter ("@Zjl_ChargeManPower" ,SqlDbType.Decimal,14),
  662.             //    new SqlParameter ("@Zjl_ChargeOther" ,SqlDbType.Decimal,14),
  663.             //    new SqlParameter ("@Zjl_ChargeStuff" ,SqlDbType.Decimal,14),
  664.             //    new SqlParameter ("@Zjl_ChargeSum" ,SqlDbType.Decimal,15),
  665.             //    new SqlParameter ("@Zjl_ExpenseChannel" ,SqlDbType.VarChar,200),
  666.             //    new SqlParameter ("@Zjl_ProjectNumber" ,SqlDbType.VarChar,100),
  667.             //    new SqlParameter ("@Zjl_TransactorIdea" ,SqlDbType.VarChar,200),
  668.             //    new SqlParameter ("@Zjl_TransactorSignature" ,SqlDbType.VarChar,20),
  669.             //    new SqlParameter ("@OfficeLeadIdea" ,SqlDbType.VarChar,100),
  670.             //    new SqlParameter ("@ProjectManager" ,SqlDbType.VarChar,20),
  671.             //    new SqlParameter ("@ProjectName" ,SqlDbType.VarChar,20),
  672.             //    new SqlParameter ("@ProjectReason" ,SqlDbType.VarChar,200),
  673.             //    new SqlParameter ("@SuccessDate" ,SqlDbType.DateTime,8),
  674.             //    new SqlParameter ("@Transactor" ,SqlDbType.VarChar,20),
  675.             //    new SqlParameter ("@UnitManager" ,SqlDbType.VarChar,200),
  676.             //    new SqlParameter ("@ProjectType" ,SqlDbType.Int,4),
  677.             //    new SqlParameter ("@wi_id" ,SqlDbType.Int,4),
  678.             //    new SqlParameter ("@ProjectSort" ,SqlDbType.VarChar,200),
  679.             //    new SqlParameter ("@Dynamic_Wi_ID" ,SqlDbType.Int,4),
  680.             //    new SqlParameter ("@Status" ,SqlDbType.Int,2),
  681.             //    new SqlParameter ("@ProjectNumber" ,SqlDbType.VarChar,200),
  682.             //    new SqlParameter ("@CurrentDate" ,SqlDbType.DateTime,8),
  683.             //    new SqlParameter ("@FactCharge" ,SqlDbType.Decimal,16),
  684.             //    new SqlParameter ("@Memo" ,SqlDbType.VarChar,200),
  685.             //    new SqlParameter ("@PlanCharge" ,SqlDbType.Decimal,15),
  686.             //    new SqlParameter ("@SuccessedDate" ,SqlDbType.DateTime,8),
  687.             //    new SqlParameter ("@TakeDepartment" ,SqlDbType.VarChar,200),
  688.             //    new SqlParameter ("@ProjcetLsh" ,SqlDbType.VarChar,15),
  689.             //    new SqlParameter ("@Jqb_TransactorSignature" ,SqlDbType.VarChar,20),
  690.             //    new SqlParameter ("@Jqb_Idea" ,SqlDbType.VarChar,200),
  691.             //    new SqlParameter ("@cw_TransactorSignature" ,SqlDbType.VarChar,20),
  692.             //    new SqlParameter ("@cw_Idea" ,SqlDbType.VarChar,200),
  693.             //    new SqlParameter ("@Ld_TransactorSignature" ,SqlDbType.VarChar,20),
  694.             //    new SqlParameter ("@Ld_Idea" ,SqlDbType.VarChar,200),
  695.             //    new SqlParameter ("@Jqb2_TransactorSignature" ,SqlDbType.VarChar,20),
  696.             //    new SqlParameter ("returnValue",SqlDbType.Int ,2)
  697.             //};
  698.             //parameters[0].Value = projectinfo.ProjectID;
  699.             //parameters[1].Value = projectinfo.AuditIdea;
  700.             //parameters[2].Value = projectinfo.Chargemachine;
  701.             //parameters[3].Value = projectinfo.ChargeManPower;
  702.             //parameters[4].Value = projectinfo.ChargeOther;
  703.             //parameters[5].Value = projectinfo.ChargeStuff;
  704.             //parameters[6].Value = projectinfo.ChargeSum;
  705.             //parameters[7].Value = projectinfo.CreateDate;
  706.             //parameters[8].Value = projectinfo.Yw_ChargeMachine;
  707.             //parameters[9].Value = projectinfo.Yw_ChargeManPower;
  708.             //parameters[10].Value = projectinfo.Yw_ChargeOther;
  709.             //parameters[11].Value = projectinfo.Yw_ChargeStuff;
  710.             //parameters[12].Value = projectinfo.Yw_ChargeSum;
  711.             //parameters[13].Value = projectinfo.Yw_ExpenseChannel;
  712.             //parameters[14].Value = projectinfo.Yw_ProjectNumber;
  713.             //parameters[15].Value = projectinfo.Yw_TransactorIdea;
  714.             //parameters[16].Value = projectinfo.Yw_TransactorSignature;
  715.             //parameters[17].Value = projectinfo.DirectorGeneralIdea;
  716.             //parameters[18].Value = projectinfo.EditUnit;
  717.             //parameters[19].Value = projectinfo.GeneralManagerIdea;
  718.             //parameters[20].Value = projectinfo.Fg_ChargeMachine;
  719.             //parameters[21].Value = projectinfo.Fg_ChargeManPower;
  720.             //parameters[22].Value = projectinfo.Fg_ChargeOther;
  721.             //parameters[23].Value = projectinfo.Fg_ChargeStuff;
  722.             //parameters[24].Value = projectinfo.Fg_ChargeSum;
  723.             //parameters[25].Value = projectinfo.Fg_ExpenseChannel;
  724.             //parameters[26].Value = projectinfo.Fg_ProjectNumber;
  725.             //parameters[27].Value = projectinfo.Fg_TransactorIdea;
  726.             //parameters[28].Value = projectinfo.Fg_TransactorSignature;
  727.             //parameters[29].Value = projectinfo.Zjl_ChargeMachine;
  728.             //parameters[30].Value = projectinfo.Zjl_ChargeManPower;
  729.             //parameters[31].Value = projectinfo.Zjl_ChargeOther;
  730.             //parameters[32].Value = projectinfo.Zjl_ChargeStuff;
  731.             //parameters[33].Value = projectinfo.Zjl_ChargeSum;
  732.             //parameters[34].Value = projectinfo.Zjl_ExpenseChannel;
  733.             //parameters[35].Value = projectinfo.Zjl_ProjectNumber;
  734.             //parameters[36].Value = projectinfo.Zjl_TransactorIdea;
  735.             //parameters[37].Value = projectinfo.Zjl_TransactorSignature;
  736.             //parameters[38].Value = projectinfo.OfficeLeadIdea;
  737.             //parameters[39].Value = projectinfo.ProjectManager;
  738.             //parameters[40].Value = projectinfo.ProjectName;
  739.             //parameters[41].Value = projectinfo.ProjectReason;
  740.             //parameters[42].Value = projectinfo.SuccessDate;
  741.             //parameters[43].Value = projectinfo.Transactor;
  742.             //parameters[44].Value = projectinfo.UnitManager;
  743.             //parameters[45].Value = projectinfo.ProjectType;
  744.             //parameters[46].Value = projectinfo.Wi_Id;
  745.             //parameters[47].Value = projectinfo.ProjectSort;
  746.             //parameters[48].Value = projectinfo.Dynamic_Wi_ID;
  747.             //parameters[49].Value = projectinfo.Status;
  748.             //parameters[50].Value = projectinfo.ProjectNumber;
  749.             //parameters[51].Value = projectinfo.CurrentDate;
  750.             //parameters[52].Value = projectinfo.FactCharge;
  751.             //parameters[53].Value = projectinfo.Memo;
  752.             //parameters[54].Value = projectinfo.PlanCharge;
  753.             //parameters[55].Value = projectinfo.SuccessedDate;
  754.             //parameters[56].Value = projectinfo.TakeDepartment;
  755.             //parameters[57].Value = projectinfo.ProjcetLsh;
  756.             //parameters[58].Value = projectinfo.Jqb_TransactorSignature;
  757.             //parameters[59].Value = projectinfo.Jqb_Idea;
  758.             //parameters[60].Value = projectinfo.cw_TransactorSignature;
  759.             //parameters[61].Value = projectinfo.cw_Idea;
  760.             //parameters[62].Value = projectinfo.Jqb_Idea;
  761.             //parameters[63].Value = projectinfo.cw_TransactorSignature;
  762.             //parameters[64].Value = projectinfo.cw_Idea;
  763.             //parameters[65].Direction = ParameterDirection.ReturnValue;
  764.             int rv = 0;
  765.             //try
  766.             //{
  767.             //    SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "P_Project_Updata", parameters);
  768.             //    rv = Convert.ToInt32(parameters[65].Value.ToString().Trim());
  769.             //}
  770.             //catch
  771.             //{
  772.             //    rv = 0;
  773.             //}
  774.           
  775.             return rv;
  776.         }
  777.         /// <summary>
  778.         /// 添加工作流活动记录
  779.         /// </summary>
  780.         /// <param name="wfinstanceinfo"></param>
  781.         /// <returns></returns>
  782.         public int WFActivityADD(WFActivityInfo wfactivityinfo)
  783.         {
  784.             SqlParameter[] parameters ={ 
  785.                 new SqlParameter ("@ActivityID",SqlDbType.Int,4),
  786.                 new SqlParameter ("@Unit",SqlDbType.VarChar ,200),
  787.                 new SqlParameter ("@UnitType",SqlDbType.Int ,4),
  788.                 new SqlParameter ("@ActDesc",SqlDbType.VarChar ,200),
  789.                 new SqlParameter ("@ActName",SqlDbType.VarChar ,200),
  790.                 new SqlParameter ("@WorkFlowID",SqlDbType.Int ,4),
  791.                 new SqlParameter ("@PageID",SqlDbType.Int,4),
  792.                 new SqlParameter ("@DecisionTitle",SqlDbType.VarChar ,200),
  793.                 new SqlParameter ("@DecisionName",SqlDbType.VarChar ,200),
  794.                 new SqlParameter ("@StartEnd",SqlDbType.Int ,4),
  795.                 new SqlParameter ("@BlockFlag",SqlDbType.Int ,4),
  796.                 new SqlParameter ("@ShuntFlag",SqlDbType.Int ,4),
  797.                 new SqlParameter ("@ModeFlag",SqlDbType.Int ,4),
  798.             };
  799.             parameters[0].Direction = ParameterDirection.Output;
  800.             parameters[1].Value = wfactivityinfo.Unit;
  801.             parameters[2].Value = wfactivityinfo.UnitType;
  802.             parameters[3].Value = wfactivityinfo.ActDesc;
  803.             parameters[4].Value = wfactivityinfo.ActName;
  804.             parameters[5].Value = wfactivityinfo.WorkFlowID;
  805.             parameters[6].Value = wfactivityinfo.PageID;
  806.             parameters[7].Value = wfactivityinfo.DecisionTitle;
  807.             parameters[8].Value = wfactivityinfo.DecisionName;
  808.             parameters[9].Value = wfactivityinfo.StartEnd;
  809.             parameters[10].Value = wfactivityinfo.BlockFlag;
  810.             parameters[11].Value = wfactivityinfo.ShuntFlag;
  811.             parameters[12].Value = wfactivityinfo.ModeFlag;
  812.             //  MSDA.Open();
  813.             //  DataTable dataTable = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_Instance_ADD", parameters);
  814.             //  int WFInstanceID = Convert.ToInt32(parameters[0].Value.ToString().Trim());
  815.             int ActivityID =0;
  816.             try
  817.             {
  818.                 SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_Activity_ADD", parameters);
  819.                 ActivityID = Convert.ToInt32(parameters[0].Value.ToString().Trim());
  820.             }
  821.             catch
  822.             { 
  823.                 ActivityID = 0;
  824.             }
  825.             return ActivityID;
  826.         }
  827.         /// <summary>
  828.         /// 添加工作流活动实例记录
  829.         /// </summary>
  830.         /// <param name="wfinstanceinfo"></param>
  831.         /// <returns></returns>
  832.         public int WFActInsADD(WFActInsInfo wfactinsinfo)
  833.         {
  834.             SqlParameter[] parameters ={ 
  835.                 new SqlParameter ("@ActInsID",SqlDbType.Int,4),
  836.                 new SqlParameter ("@ActivityID",SqlDbType.Int ,4),
  837.                 new SqlParameter ("@CreateDate",SqlDbType.DateTime ,8),
  838.                 new SqlParameter ("@RealEndDate",SqlDbType.DateTime ,8),
  839.                 new SqlParameter ("@Status",SqlDbType.Int ,2),
  840.                 new SqlParameter ("@TheoryEndDate",SqlDbType.DateTime ,8),
  841.                 new SqlParameter ("@WfInstanceID",SqlDbType.Int,4),
  842.                 new SqlParameter ("@BlockReason",SqlDbType.VarChar ,2000),
  843.                 new SqlParameter ("@UserID",SqlDbType.Int ,4),
  844.                 new SqlParameter ("@RoleID",SqlDbType.Int ,4),
  845.             };
  846.             parameters[0].Direction = ParameterDirection.Output;
  847.             parameters[1].Value = wfactinsinfo.ActivityID;
  848.             parameters[2].Value = wfactinsinfo.CreateDate;
  849.             parameters[3].Value = wfactinsinfo.RealEndDate;
  850.             parameters[4].Value = wfactinsinfo.Status;
  851.             parameters[5].Value = wfactinsinfo.TheoryEndDate;
  852.             parameters[6].Value = wfactinsinfo.WfInstanceID;
  853.             parameters[7].Value = wfactinsinfo.BlockReason;
  854.             parameters[8].Value = wfactinsinfo.UserID;
  855.             parameters[9].Value = wfactinsinfo.RoleID;
  856.             //  MSDA.Open();
  857.              int ActInsID =0;
  858.             try
  859.             {
  860.                 SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_ActIns_ADD", parameters);
  861.                  ActInsID = Convert.ToInt32(parameters[0].Value.ToString().Trim());
  862.             }
  863.             catch
  864.             {
  865.                 ActInsID = 0;
  866.             }
  867.             return ActInsID;
  868.         }
  869.         /// <summary>
  870.         /// 改变当前工作流活动实例状态
  871.         /// </summary>
  872.         /// <param name="wfinstanceinfo"></param>
  873.         /// <returns></returns>
  874.         public bool WFActInsUpdata(int actinsid,int userid, int status)
  875.         {
  876.             QueryParameterCollection Params = new QueryParameterCollection();
  877.             Params.Clear();
  878.             Params.Add("@actinsid", actinsid);
  879.             Params.Add("@UserID", userid);
  880.             Params.Add("@status", status);
  881.             string sSQL = "update  tb_WF_ActIns  Set Status=@status,UserID=@UserID  where  ActInsID=@actinsid";
  882.             MSDA.Open();
  883.             NewObj newobject = new NewObj();
  884.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  885.             MSDA.Close();
  886.             return returnvalue;
  887.           
  888.         }
  889.         /// <summary>
  890.         /// 获到当前活动实例对的活动
  891.         /// </summary>
  892.         /// <returns></returns>
  893.         public DataView GetWFAct(int actinsid)
  894.         {
  895.             string sSQL = "select * from  tb_WF_ActIns  where ActInsID=" + actinsid;
  896.             DataView dv = null;
  897.             try
  898.             {
  899.                 NewObj newobject = new NewObj();
  900.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  901.             }
  902.             catch
  903.             {
  904.                 dv = null;
  905.             }
  906.             finally
  907.             {
  908.                 MSDA.Close();
  909.             }
  910.             return dv;
  911.         }
  912.         /// <summary>
  913.         /// 改变当前工作流活动实例状态
  914.         /// </summary>
  915.         /// <param name="wfinstanceinfo"></param>
  916.         /// <returns></returns>
  917.         public bool WFActInsUpdata(int actinsid, int status)
  918.         {
  919.             QueryParameterCollection Params = new QueryParameterCollection();
  920.             Params.Clear();
  921.             Params.Add("@actinsid", actinsid);
  922.             Params.Add("@status", status);
  923.             string sSQL = "update  tb_WF_ActIns  Set Status=@status where  ActInsID=@actinsid";
  924.             MSDA.Open();
  925.             NewObj newobject = new NewObj();
  926.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  927.             MSDA.Close();
  928.             return returnvalue;
  929.         } 
  930.       /// <summary>
  931.       /// 根据当前活动id获取当前部门与上级角色 
  932.       /// </summary>
  933.       /// <param name="activityid">活动ID</param>
  934.       /// <returns></returns>
  935.         public DataView ColonyUserGetByActId(int actid)
  936.         {
  937.             //string sSQL = "select a.ActivityID CurrentActID,a.RoleID CurrentRoleID,b.ActivityID ParentActID,b.RoleID ParentRoleID  " +
  938.             //            "   from tb_Colony_User a,tb_Colony_User  b  where a.ActivityID='" + actid + "'  and a.ActivityID=b.ParentActID";
  939.             SqlParameter parameter = new SqlParameter("@ActivityID", SqlDbType.Int, 4);
  940.             parameter.Value = actid;
  941.             DataView dv = null;
  942.             try
  943.             {
  944.                 MSDA.Open();
  945.                 dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_Activity_GetByActID", parameter).DefaultView;  
  946.                 MSDA.Close();
  947.             }
  948.             catch
  949.             {
  950.                   dv = null;
  951.             }
  952.             return dv;
  953.         }
  954.         public string GetEmpType(int EmpID)
  955.         {
  956.             string strEmpType = "";
  957.             DataView dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, "select [EmpType] from [Tb_Sys_Employee] where [EmpID]=" + EmpID, null).DefaultView;
  958.             if (dv.Count > 0)
  959.             {
  960.                 strEmpType = dv[0]["EmpType"].ToString();
  961.             }
  962.             return strEmpType;
  963.         }
  964.         /// <summary>
  965.         /// 根据当前活动id获取下级活动 
  966.         /// </summary>
  967.         /// <param name="actid">活动ID</param>
  968.         /// <returns></returns>
  969.         public DataView ColonyUserGetByAct(int actid)
  970.         {
  971.             string sSQL = "select CU2.ActivityID,CU2.ParentActID,CU2.RoleID  from  tb_Colony_User CU1,tb_Colony_User CU2 where CU1.ParentActID=CU2.ActivityID and CU1.ActivityID='" + actid + "' ";
  972.             DataView dv = null;
  973.             try
  974.             {
  975.                 NewObj newobject = new NewObj();
  976.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  977.             }
  978.             catch
  979.             {
  980.                 dv = null;
  981.             }
  982.             finally
  983.             {
  984.                 MSDA.Close();
  985.             }
  986.             return dv;
  987.         }
  988.         /// <summary>
  989.         /// 获取某一工作流的起始活动
  990.         /// </summary>
  991.         /// <param name="wfid"></param>
  992.         /// <returns></returns>
  993.         public DataView GetActivityByWFID(int wfid)
  994.         {
  995.             string sSQL = "select  ActivityID from tb_WF_Activity where StartEnd='0' and WorkFlowID='" + wfid + "' ";
  996.             DataView dv = null;
  997.             try
  998.             {
  999.                 NewObj newobject = new NewObj();
  1000.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1001.                
  1002.             }
  1003.             catch
  1004.             {
  1005.                 dv = null;
  1006.             }
  1007.             finally
  1008.             {
  1009.                 MSDA.Close();
  1010.             }
  1011.             return dv;
  1012.         }
  1013.         /// <summary>
  1014.         /// 获取某一角色所应启动的活动
  1015.         /// </summary>
  1016.         /// <param name="wfid"></param>
  1017.         /// <returns></returns>
  1018.        public DataView GetActivityPage(int wfid,int roleid)
  1019.         {
  1020.            // string sSQL = "select *  from tb_WF_Activity  where WorkFlowID='" + wfid +"'  and ActivityID in(select ActivityID from tb_Colony_User  where RoleID='" + roleid +"')";
  1021.             string sSQL = "select *  from tb_WF_Activity a,tb_WF_StaticPage s  where WorkFlowID='" +  wfid + "' and s.StaticPageID=a.PageID and ActivityID" + 
  1022.                          "  in(select ActivityID from tb_Colony_User  where RoleID='" + roleid+"') ";
  1023.             DataView dv = null;
  1024.             try
  1025.             {
  1026.                 MSDA.Open();
  1027.                 NewObj newobject = new NewObj();
  1028.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1029.                 MSDA.Close();
  1030.             }
  1031.             catch
  1032.             {
  1033.                 dv = null;
  1034.             }
  1035.             return dv;
  1036.         }
  1037.         /// <summary>
  1038.         /// 基层部门提交
  1039.         /// </summary>
  1040.         /// <returns>返回bool类型参数</returns>
  1041.         public bool Project_JC(int projectid,string JcFName, int status)
  1042.         {
  1043.             QueryParameterCollection Params = new QueryParameterCollection();
  1044.             Params.Clear();
  1045.             Params.Add("@projectid", projectid);
  1046.             Params.Add("@JcFName", JcFName);
  1047.             Params.Add("@status", status);
  1048.             string sSQL = "update  tb_Project Set JcFName=@JcFName,Status=@status  where ProjectID=@projectid";
  1049.             MSDA.Open();
  1050.             NewObj newobject = new NewObj();
  1051.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1052.             MSDA.Close();
  1053.             return returnvalue;
  1054.         }
  1055.         /// <summary>
  1056.         /// 主管部门提交
  1057.         /// </summary>
  1058.         /// <returns>返回bool类型参数</returns>
  1059.         public bool Project_Zg(int projectid, string ZgTransactor,
  1060.                      string ZgFName, int status)
  1061.         {
  1062.             QueryParameterCollection Params = new QueryParameterCollection();
  1063.             Params.Clear();
  1064.             Params.Add("@projectid", projectid);
  1065.             Params.Add("@ZgTransactor", ZgTransactor);
  1066.             Params.Add("@ZgFName", ZgFName);
  1067.             Params.Add("@status", status);
  1068.             string sSQL = "update  tb_Project Set ZgTransactor=@ZgTransactor,ZgFName=@ZgFName,Status=@status  where ProjectID=@projectid";
  1069.             MSDA.Open();
  1070.             NewObj newobject = new NewObj();
  1071.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1072.             MSDA.Close();
  1073.             return returnvalue;
  1074.         }
  1075.         /// <summary>
  1076.         /// 计企部项目汇总
  1077.         /// </summary>
  1078.         /// <returns>返回bool类型参数</returns>
  1079.         public bool Project_JqbX(int projectid, string JqbXTransactor,
  1080.                         string JqbXFName, int status)
  1081.         {
  1082.             QueryParameterCollection Params = new QueryParameterCollection();
  1083.             Params.Clear();
  1084.             Params.Add("@projectid", projectid);
  1085.             Params.Add("@JqbXTransactor", JqbXTransactor);
  1086.             Params.Add("@JqbXFName", JqbXFName);
  1087.        
  1088.             Params.Add("@status", status);
  1089.             string sSQL = "update  tb_Project Set JqbXTransactor=@JqbXTransactor,JqbXFName=@JqbXFName,Status=@status where ProjectID=@projectid";
  1090.             MSDA.Open();
  1091.             NewObj newobject = new NewObj();
  1092.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1093.             MSDA.Close();
  1094.             return returnvalue;
  1095.         }
  1096.         /// <summary>
  1097.         /// 职能部门回退
  1098.         /// </summary>
  1099.         /// <returns>返回bool类型参数</returns>
  1100.         public bool Project_FG_Untread(int projectid, string fg_transactoridea, string fg_transactorsignature, int status)
  1101.         {
  1102.             QueryParameterCollection Params = new QueryParameterCollection();
  1103.             Params.Clear();
  1104.             Params.Add("@projectid", projectid);
  1105.            
  1106.             Params.Add("@fg_transactoridea", fg_transactoridea);
  1107.             Params.Add("@fg_transactorsignature", fg_transactorsignature);
  1108.             Params.Add("@status", status);
  1109.             string sSQL = "update  tb_Project Set  Fg_TransactorIdea=@fg_transactoridea,Fg_TransactorSignature=@fg_transactorsignature,Status=@status where ProjectID=@projectid";
  1110.             MSDA.Open();
  1111.             NewObj newobject = new NewObj();
  1112.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1113.             MSDA.Close();
  1114.             return returnvalue;
  1115.         }
  1116.         /// <summary>
  1117.         ///计企部计划清单
  1118.         /// </summary>
  1119.         /// <returns>返回bool类型参数</returns>
  1120.         public bool Project_JqbB(int projectid, string JqbBTransactor, string JqbBFName, int status)
  1121.         {
  1122.             QueryParameterCollection Params = new QueryParameterCollection();
  1123.             Params.Clear();
  1124.             Params.Add("@projectid", projectid);
  1125.             Params.Add("@JqbBTransactor", JqbBTransactor);
  1126.             Params.Add("@JqbBFName", JqbBFName);
  1127.             Params.Add("@status", status);
  1128.             string sSQL = "update  tb_Project Set   JqbBTransactor=@JqbBTransactor,JqbBFName=@JqbBFName,status=@status   where ProjectID=@projectid";
  1129.             MSDA.Open();
  1130.             NewObj newobject = new NewObj();
  1131.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1132.             MSDA.Close();
  1133.             return returnvalue;
  1134.         }
  1135.         /// <summary>
  1136.         ///财务部回退
  1137.         /// </summary>
  1138.         /// <returns>返回bool类型参数</returns>
  1139.         public bool Project_CW_Untread(int projectid, string cw_TransactorSignature, string cw_Idea)
  1140.         {
  1141.             QueryParameterCollection Params = new QueryParameterCollection();
  1142.             Params.Clear();
  1143.             Params.Add("@projectid", projectid);
  1144.             Params.Add("@cw_TransactorSignature", cw_TransactorSignature);
  1145.             Params.Add("@cw_Idea", cw_Idea);
  1146.             string sSQL = "update  tb_Project Set   cw_TransactorSignature=@cw_TransactorSignature,cw_Idea=@cw_Idea where ProjectID=@projectid";
  1147.             MSDA.Open();
  1148.             NewObj newobject = new NewObj();
  1149.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1150.             MSDA.Close();
  1151.             return returnvalue;
  1152.         }
  1153.         /// <summary>
  1154.         /// 分管领导审核
  1155.         /// </summary>
  1156.         /// <returns>返回bool类型参数</returns>
  1157.         public bool Project_Gcgl(int projectid, string GcglHTransactor, string GcglHFName, int status)
  1158.         {
  1159.             QueryParameterCollection Params = new QueryParameterCollection();
  1160.             Params.Clear();
  1161.             Params.Add("@projectid", projectid);
  1162.             Params.Add("@GcglHTransactor", GcglHTransactor);
  1163.             Params.Add("@GcglHFName", GcglHFName);
  1164.             Params.Add("@status", status);
  1165.             string sSQL = "update  tb_Project Set  GcglHTransactor=@GcglHTransactor,GcglHFName=@GcglHFName,Status=@status where ProjectID=@projectid";
  1166.             MSDA.Open();
  1167.             NewObj newobject = new NewObj();
  1168.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1169.             MSDA.Close();
  1170.             return returnvalue;
  1171.         }
  1172.         /// <summary>
  1173.         /// 分管领导回退
  1174.         /// </summary>
  1175.         /// <returns>返回bool类型参数</returns>
  1176.         public bool Project_ZJL_Untread(int projectid, string zjl_transactoridea, string zjl_transactorsignature, int status)
  1177.         {
  1178.             QueryParameterCollection Params = new QueryParameterCollection();
  1179.             Params.Clear();
  1180.             Params.Add("@projectid", projectid);
  1181.            
  1182.             Params.Add("@zjl_transactoridea", zjl_transactoridea);
  1183.             Params.Add("@zjl_transactorsignature", zjl_transactorsignature);
  1184.             Params.Add("@status", status);
  1185.             string sSQL = "update  tb_Project Set Zjl_TransactorIdea=@zjl_transactoridea,Zjl_TransactorSignature=@zjl_transactorsignature,Status=@status where ProjectID=@projectid";
  1186.             MSDA.Open();
  1187.             NewObj newobject = new NewObj();
  1188.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1189.             MSDA.Close();
  1190.             return returnvalue;
  1191.         }
  1192.         /// <summary>
  1193.         ///分管领导审核
  1194.         /// </summary>
  1195.         /// <returns>返回bool类型参数</returns>
  1196.         public bool Project_Fg(int projectid, string FgTransactor, string FgIdea, int status)
  1197.         {
  1198.             QueryParameterCollection Params = new QueryParameterCollection();
  1199.             Params.Clear();
  1200.             Params.Add("@projectid", projectid);
  1201.             Params.Add("@FgTransactor", FgTransactor);
  1202.             Params.Add("@FgIdea", FgIdea);
  1203.             Params.Add("@status", status);
  1204.             string sSQL = "update  tb_Project Set  FgTransactor=@FgTransactor,FgIdea=@FgIdea,status=@status where ProjectID=@projectid";
  1205.             MSDA.Open();
  1206.             NewObj newobject = new NewObj();
  1207.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1208.             MSDA.Close();
  1209.             return returnvalue;
  1210.         }
  1211.         /// <summary>
  1212.         ///工程预算委员会审批
  1213.         /// </summary>
  1214.         /// <returns>返回bool类型参数</returns>
  1215.         public bool Project_Zjwyh(int projectid, string ZjwyhTransactor, string ZjwyhIdea, int status)
  1216.         {
  1217.             QueryParameterCollection Params = new QueryParameterCollection();
  1218.             Params.Clear();
  1219.             Params.Add("@projectid", projectid);
  1220.             Params.Add("@ZjwyhTransactor", ZjwyhTransactor);
  1221.             Params.Add("@ZjwyhIdea", ZjwyhIdea);
  1222.             Params.Add("@status", status);
  1223.             string sSQL = "update  tb_Project Set  ZjwyhTransactor=@ZjwyhTransactor,ZjwyhIdea=@ZjwyhIdea,status=@status where ProjectID=@projectid";
  1224.             MSDA.Open();
  1225.             NewObj newobject = new NewObj();
  1226.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1227.             MSDA.Close();
  1228.             return returnvalue;
  1229.         }
  1230.         /// <summary>
  1231.         ///公司领导回退
  1232.         /// </summary>
  1233.         /// <returns>返回bool类型参数</returns>
  1234.         public bool Project_LD_Untread(int projectid, string Ld_TransactorSignature, string Ld_Idea)
  1235.         {
  1236.             QueryParameterCollection Params = new QueryParameterCollection();
  1237.             Params.Clear();
  1238.             Params.Add("@projectid", projectid);
  1239.             Params.Add("@Ld_TransactorSignature", Ld_TransactorSignature);
  1240.             Params.Add("@Ld_Idea", Ld_Idea);
  1241.             string sSQL = "update  tb_Project Set  Ld_TransactorSignature=@Ld_TransactorSignature,Ld_Idea=@Ld_Idea where ProjectID=@projectid";
  1242.             MSDA.Open();
  1243.             NewObj newobject = new NewObj();
  1244.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1245.             MSDA.Close();
  1246.             return returnvalue;
  1247.         }
  1248.         /// <summary>
  1249.         ///计企部初次审核
  1250.         /// </summary>
  1251.         /// <returns>返回bool类型参数</returns>
  1252.         public bool Project_JQP_GcglX(int projectid, string GcglXTransactor, string GcglXFName, int  status)
  1253.         {
  1254.             QueryParameterCollection Params = new QueryParameterCollection();
  1255.             Params.Clear();
  1256.             Params.Add("@projectid", projectid);
  1257.             Params.Add("@GcglXTransactor", GcglXTransactor);
  1258.             Params.Add("@GcglXFName", GcglXFName);
  1259.             Params.Add("@status", status);
  1260.             string sSQL = "update  tb_Project Set  GcglXTransactor=@GcglXTransactor,GcglXFName=@GcglXFName,status=@status where ProjectID=@projectid";
  1261.             MSDA.Open();
  1262.             NewObj newobject = new NewObj();
  1263.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1264.             MSDA.Close();
  1265.             return returnvalue;
  1266.         }
  1267.         /// <summary>
  1268.         ///计企部回退
  1269.         /// </summary>
  1270.         /// <returns>返回bool类型参数</returns>
  1271.         public bool Project_JQP_Untread(int projectid, string Jqb_TransactorSignature, string Jqb_Idea)
  1272.         {
  1273.             QueryParameterCollection Params = new QueryParameterCollection();
  1274.             Params.Clear();
  1275.             Params.Add("@projectid", projectid);
  1276.             Params.Add("@Jqb_TransactorSignature", Jqb_TransactorSignature);
  1277.             Params.Add("@Jqb_Idea", Jqb_Idea);
  1278.             string sSQL = "update  tb_Project Set  Jqb_TransactorSignature=@Jqb_TransactorSignature,Jqb_Idea=@Jqb_Idea where ProjectID=@projectid";
  1279.             MSDA.Open();
  1280.             NewObj newobject = new NewObj();
  1281.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1282.             MSDA.Close();
  1283.             return returnvalue;
  1284.         }
  1285.         /// <summary>
  1286.         ///公司领导审批
  1287.         /// </summary>
  1288.         /// <returns>返回bool类型参数</returns>
  1289.         public bool Project_Gs(int projectid, string GsTransactor, string GsIdea, int status)
  1290.         {
  1291.             QueryParameterCollection Params = new QueryParameterCollection();
  1292.             Params.Clear();
  1293.             Params.Add("@projectid", projectid);
  1294.             Params.Add("@GsTransactor", GsTransactor);
  1295.             Params.Add("@GsIdea", GsIdea);
  1296.             Params.Add("@status", status);
  1297.             string sSQL = "update  tb_Project Set GsTransactor=@GsTransactor,GsIdea=@GsIdea,Status=@status where ProjectID=@projectid";
  1298.             MSDA.Open();
  1299.             NewObj newobject = new NewObj();
  1300.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1301.             MSDA.Close();
  1302.             return returnvalue;
  1303.         }
  1304.         /// <summary>
  1305.         ///工程办公室领导审批
  1306.         /// </summary>
  1307.         /// <returns>返回bool类型参数</returns>
  1308.         public bool Project_GcglQ(int projectid, string GcglQTransactor, string GcglQIdea, int status)
  1309.         {
  1310.             QueryParameterCollection Params = new QueryParameterCollection();
  1311.             Params.Clear();
  1312.             Params.Add("@projectid", projectid);
  1313.             Params.Add("@GcglQTransactor", GcglQTransactor);
  1314.             Params.Add("@GcglQIdea", GcglQIdea);
  1315.             Params.Add("@status", status);
  1316.             string sSQL = "update  tb_Project Set GcglQTransactor=@GcglQTransactor,GcglQIdea=@GcglQIdea,Status=@status where ProjectID=@projectid";
  1317.             MSDA.Open();
  1318.             NewObj newobject = new NewObj();
  1319.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1320.             MSDA.Close();
  1321.             return returnvalue;
  1322.         }
  1323.         /// <summary>
  1324.         ///计企部正式发文
  1325.         /// </summary>
  1326.         /// <returns>返回bool类型参数</returns>
  1327.         public bool Project_JqbZ(int projectid, string JqbZTransactor, string JqbZFName, int status)
  1328.         {
  1329.             QueryParameterCollection Params = new QueryParameterCollection();
  1330.             Params.Clear();
  1331.             Params.Add("@projectid", projectid);
  1332.             Params.Add("@JqbZTransactor", JqbZTransactor);
  1333.             Params.Add("@JqbZFName", JqbZFName);
  1334.             Params.Add("@status", status);
  1335.             string sSQL = "update  tb_Project Set JqbZTransactor=@JqbZTransactor,JqbZFName=@JqbZFName,Status=@status where ProjectID=@projectid";
  1336.             MSDA.Open();
  1337.             NewObj newobject = new NewObj();
  1338.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1339.             MSDA.Close();
  1340.             return returnvalue;
  1341.         }
  1342.         /// <summary>
  1343.         /// 获取上级活动记录
  1344.         /// </summary>
  1345.         /// <param name="activityid">当前活动事例ID</param>
  1346.         /// <returns></returns>
  1347.         public DataView ActivityGetByActInsId(int ActInsID)
  1348.         {
  1349.             string sSQL = " select AC1.ActivityID PreviousActID,AC1.UserID PreviousUserID,AC1.RoleID  PreviousRoleID,AC1.ActInsID PreviousActInsID from tb_wf_actins AC1 where AC1.ActivityID in( " +
  1350.                   "select ActivityID   from tb_Colony_User where  ParentActID in(" +
  1351.                   "select AC.ActivityID from tb_wf_actins AC where AC.ActInsID='" + ActInsID+ "')) and AC1.WfInstanceID in" +
  1352.                    "(select AC2.WfInstanceID from tb_wf_actins AC2 where AC2.ActInsID='" + ActInsID + "')";
  1353.             DataView dv = null;
  1354.             try
  1355.             {
  1356.                 MSDA.Open();
  1357.                 dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text,sSQL, null).DefaultView;
  1358.                 MSDA.Close();
  1359.             }
  1360.             catch
  1361.             {
  1362.                 dv = null;
  1363.             }
  1364.             return dv;
  1365.         }
  1366.         /// <summary>
  1367.         /// 获取基层部门员工提交申请人业务角色
  1368.         /// </summary>
  1369.         /// <param name="activityid">当前活动ID</param>
  1370.         /// <returns></returns>
  1371.         public DataView ActDeptIDGetByActId(int ActID)
  1372.         {
  1373.             string sSQL = "  select CU1.ActivityID,CU1.RoleID   from tb_Colony_User CU1,tb_Colony_User CU2  " +
  1374.                       " where CU1.ActivityID=CU2.ParentActID and CU2.ActivityID='" + ActID + "' ";
  1375.             DataView dv = null;
  1376.             try
  1377.             {
  1378.                 MSDA.Open();
  1379.                 dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, sSQL, null).DefaultView;
  1380.                 MSDA.Close();
  1381.             }
  1382.             catch
  1383.             {
  1384.                 dv = null;
  1385.             }
  1386.             return dv;
  1387.         }
  1388.         /// <summary>
  1389.         /// 退回时,改变前一活动状态
  1390.         /// </summary>
  1391.         /// <param name="Status">0、正常;1、完成;2、回退;3、回退并完成;4、作废</param>
  1392.         /// <returns></returns>
  1393.         public bool ActInsStatusChange(int WfInstanceID, int ActivityID, int Status)
  1394.         {
  1395.             QueryParameterCollection Params = new QueryParameterCollection();
  1396.             Params.Clear();
  1397.             Params.Add("@WfInstanceID", WfInstanceID);
  1398.             Params.Add("@ActivityID", ActivityID);
  1399.             Params.Add("@Status", Status);
  1400.             string sSQL = "update tb_WF_ACtIns set Status=@Status  where WfInstanceID=@WfInstanceID and ActivityID=@ActivityID";
  1401.             MSDA.Open();
  1402.             NewObj newobject = new NewObj();
  1403.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1404.             MSDA.Close();
  1405.             return returnvalue;
  1406.         }
  1407.         ///// <summary>
  1408.         ///// 获取物资第一下拉列表
  1409.         ///// </summary>
  1410.         //public SqlDataReader WZGetAll()
  1411.         //{
  1412.         //    string connStr = ConfigurationSettings.AppSettings["SqlConnection2"].ToString();
  1413.         //    SqlConnection conn = new SqlConnection(connStr);
  1414.         //    //  绑定第一级下拉列表
  1415.         //    string commStr1 = string.Format("select wz_code1,wz_namecode1 from wz_code1");
  1416.         //    SqlCommand comm1 = new SqlCommand(commStr1, conn);
  1417.         //    conn.Open();
  1418.         //    //DataView dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, commStr1, null).DefaultView;
  1419.         
  1420.         //    SqlDataReader dr = comm1.ExecuteReader();
  1421.           
  1422.             
  1423.         //    return dr;
  1424.          
  1425.         //}
  1426.         ///// <summary>
  1427.         ///// 获取物资第一下拉列表
  1428.         ///// </summary>
  1429.         //public SqlDataReader WZGetByCode1(int wz_code1)
  1430.         //{
  1431.         //    string connStr = ConfigurationSettings.AppSettings["SqlConnection2"].ToString();
  1432.         //    string sSQL = "select wz_code1,wz_namecode2 from wz_code2 where wz_code1='" + wz_code1 + "'";
  1433.         //    SqlConnection conn = new SqlConnection(connStr);
  1434.         //    SqlCommand comm1 = new SqlCommand(sSQL, conn);
  1435.         //    conn.Open();
  1436.         //    SqlDataReader dr = comm1.ExecuteReader();
  1437.         //    return dr;
  1438.         //}
  1439.         /// <summary>
  1440.         /// 添加设备费记录
  1441.         /// </summary>
  1442.         /// <returns>返回一bool类型值</returns>
  1443.         public bool ProEquAdd(string UnitName, int wz_id, string EquipmentName, int Number, int ProjectID, decimal Price, string EquipmentSize, string NumberHistory, string PriceHistory)
  1444.         {
  1445.             string sSQL = "insert into tb_Project_Equipment([UnitName],[wz_id],[EquipmentName],[Number],[ProjectID],[Price],[EquipmentSize],[NumberHistory],[PriceHistory]) values  " +
  1446.                 "('" + UnitName + "', '" + wz_id + "','" + EquipmentName + "','" + Number + "','" + ProjectID + "','" + Price + "','" + EquipmentSize + "','" + NumberHistory + "','" + PriceHistory + "')";
  1447.             MSDA.Open();
  1448.             NewObj newobject = new NewObj();
  1449.             bool returnvalue = newobject.insert(sSQL, null, CommandType.Text);
  1450.             MSDA.Close();
  1451.             return returnvalue;
  1452.         }
  1453.         /// <summary>
  1454.         /// 修改设备费记录
  1455.         /// </summary>
  1456.         /// <returns>返回一bool类型值</returns>
  1457.         public bool ProEquUpdata(int EquipmentID,string UnitName, int wz_id, string EquipmentName, int Number, int ProjectID, decimal Price, string EquipmentSize, string NumberHistory, string PriceHistory)
  1458.         {
  1459.             string sSQL = "update  tb_Project_Equipment Set UnitName='" + UnitName + "'," + "wz_id='" + wz_id + "'," + "EquipmentName='" + EquipmentName + "'," + "Number='" + Number + "'," +
  1460.                       "ProjectID='" + ProjectID + "'," + "Price='" + Price + "'," + "EquipmentSize='" + EquipmentSize + "'," + "NumberHistory='" +
  1461.                       NumberHistory + "'," + "PriceHistory='" + PriceHistory + "'   where  EquipmentID='" + EquipmentID + "'";
  1462.             
  1463.             MSDA.Open();
  1464.             NewObj newobject = new NewObj();
  1465.             bool returnvalue = newobject.Update(sSQL, null, CommandType.Text);
  1466.             MSDA.Close();
  1467.             return returnvalue;
  1468.         }
  1469.         /// <summary>
  1470.         /// 获取设备费记录
  1471.         /// </summary>
  1472.         //////public DataView ProEquGetById(int ProjectID)
  1473.         //////{
  1474.         //////    string sSQL = "select * from tb_Project_Equipment  where ProjectID='" + ProjectID + "'";
  1475.         //////    MSDA.Open();
  1476.         //////    NewObj newobject = new NewObj();
  1477.         //////    DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1478.         //////    MSDA.Close();
  1479.         //////    return dv;
  1480.         //////}
  1481.         /// <summary>
  1482.         /// 删除设备费记录
  1483.         /// </summary>
  1484.         /// <param name="userid">设备ID</param>
  1485.         public bool ProEquDelete(int EquipmentID)
  1486.         {
  1487.             string sSQL = "delete from tb_Project_Equipment where [EquipmentID]=" + EquipmentID;
  1488.             bool bl = false;
  1489.             try
  1490.             {
  1491.                 MSDA.Open();
  1492.                 MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
  1493.                 bl = true;
  1494.             }
  1495.             catch (Exception ex)
  1496.             {
  1497.                 throw ex;
  1498.             }
  1499.             finally
  1500.             {
  1501.                 MSDA.Close();
  1502.             }
  1503.             return bl;
  1504.         }
  1505.         /// <summary>
  1506.         /// 添加材料费记录
  1507.         /// </summary>
  1508.         /// <returns>返回一bool类型值</returns>
  1509.         public bool ProMaterialAdd(decimal BudGetPrice, decimal DifferencePrice, decimal DifferencePriceSum, decimal MarketPrice,
  1510.                                       string Memo, string MeterialName, int Number, string UnitName,int  ProjectID)
  1511.         {
  1512.             string sSQL = "insert into tb_Project_Material([BudGetPrice],[DifferencePrice],[DifferencePriceSum],[MarketPrice],[Memo],[MeterialName],[Number],[UnitName],[ProjectID]) values  " +
  1513.                 "('" + BudGetPrice + "', '" + DifferencePrice + "','" + DifferencePriceSum + "','" + MarketPrice + "','" + Memo + "','" + MeterialName + "','" + Number + "','" + UnitName + "','" + ProjectID + "')";
  1514.             MSDA.Open();
  1515.             NewObj newobject = new NewObj();
  1516.             bool returnvalue = newobject.insert(sSQL, null, CommandType.Text);
  1517.             MSDA.Close();
  1518.             return returnvalue;
  1519.         }
  1520.         /// <summary>
  1521.         /// 修改材料费记录
  1522.         /// </summary>
  1523.         /// <returns>返回一bool类型值</returns>
  1524.         public bool ProMaterialUpdata(int MaterialID, decimal BudGetPrice, decimal DifferencePrice, decimal DifferencePriceSum, decimal MarketPrice,
  1525.                                       string Memo, string MeterialName, int Number, string UnitName, int ProjectID)
  1526.         {
  1527.             string sSQL = "update  tb_Project_Material Set BudGetPrice='" + BudGetPrice + "'," + "DifferencePrice='" + DifferencePrice + "'," + "DifferencePriceSum='" + DifferencePriceSum + "'," + "MarketPrice='" + MarketPrice + "'," +
  1528.                       "Memo='" + Memo + "'," + "MeterialName='" + MeterialName + "'," + "Number='" + Number + "'," + "UnitName='" +
  1529.                       UnitName + "'," + "ProjectID='" + ProjectID + "'   where  MaterialID='" + MaterialID + "'";
  1530.             MSDA.Open();
  1531.             NewObj newobject = new NewObj();
  1532.             bool returnvalue = newobject.Update(sSQL, null, CommandType.Text);
  1533.             MSDA.Close();
  1534.             return returnvalue;
  1535.         }
  1536.         /// <summary>
  1537.         /// 删除材料费记录
  1538.         /// </summary>
  1539.         /// <param name="userid">设备ID</param>
  1540.         public bool ProMaterialDelete(int MaterialID)
  1541.         {
  1542.             string sSQL = "delete from tb_Project_Material where [MaterialID]=" + MaterialID;
  1543.             bool bl = false;
  1544.             try
  1545.             {
  1546.                 MSDA.Open();
  1547.                 MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
  1548.                 bl = true;
  1549.               }
  1550.             catch (Exception ex)
  1551.             {
  1552.                 throw ex;
  1553.             }
  1554.             finally
  1555.             {
  1556.                 MSDA.Close();
  1557.             }
  1558.             return bl;
  1559.               
  1560.         }
  1561.   
  1562.         /// <summary>
  1563.         /// 材料费记录
  1564.         /// </summary>
  1565.         public DataView ProMaterialGetById(int ProjectID)
  1566.         {
  1567.             string sSQL = "select * from tb_Project_Material  where ProjectID=" + ProjectID;
  1568.             MSDA.Open();
  1569.             NewObj newobject = new NewObj();
  1570.             DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1571.             MSDA.Close();
  1572.             return dv;
  1573.         }
  1574.         ///// <summary>
  1575.         ///// 获取材料费记录
  1576.         ///// </summary>
  1577.         //public string BudGetPriceGetByWzId(int wzid)
  1578.         //{
  1579.         //    string connStr = ConfigurationSettings.AppSettings["SqlConnection2"].ToString();
  1580.         //    string sSQL = "select * from material_name where wz_id='" + wzid + "'";
  1581.         //    SqlConnection conn = new SqlConnection(connStr);
  1582.         //    SqlCommand comm1 = new SqlCommand(sSQL, conn);
  1583.         //    conn.Open();
  1584.         //    SqlDataReader dr = comm1.ExecuteReader();
  1585.         //    string wz_plan = "";
  1586.         //    while (dr.Read())
  1587.         //    {
  1588.         //        wz_plan=dr["wz_plan"].ToString();
  1589.         //    }
  1590.         //    dr.Close();
  1591.         //    return wz_plan;
  1592.         //}
  1593.         /// <summary>
  1594.         /// 添加其它费用记录
  1595.         /// </summary>
  1596.         /// <returns>返回一bool类型值</returns>
  1597.         public bool ProOtherAdd(string Explain, string OtherName, string Memo, decimal Price, int ProjectID)
  1598.         {
  1599.             string sSQL = "insert into tb_Project_Other([Explain],[OtherName],[Memo],[Price],[ProjectID]) values  " +
  1600.                 "('" + Explain + "', '" + OtherName + "','" + Memo + "','" + Price + "','" + ProjectID + "')";
  1601.             MSDA.Open();
  1602.             NewObj newobject = new NewObj();
  1603.             bool returnvalue = newobject.insert(sSQL, null, CommandType.Text);
  1604.             MSDA.Close();
  1605.             return returnvalue;
  1606.         }
  1607.         /// <summary>
  1608.         /// 修改其它费用记录
  1609.         /// </summary>
  1610.         /// <returns>返回一bool类型值</returns>
  1611.         public bool ProOtherUpdata(int OtherID, string Explain, string OtherName, string Memo, decimal Price, int ProjectID)
  1612.         {
  1613.             string sSQL = "update  tb_Project_Other Set Explain='" + Explain + "'," + "OtherName='" + OtherName + "'," + "Memo='" + Memo + "'," + "Price='" + Price + "'," +
  1614.                       "ProjectID='" + ProjectID + "'   where  OtherID='" + OtherID + "'";
  1615.             MSDA.Open();
  1616.             NewObj newobject = new NewObj();
  1617.             bool returnvalue = newobject.Update(sSQL, null, CommandType.Text);
  1618.             MSDA.Close();
  1619.             return returnvalue;
  1620.         }
  1621.         /// <summary>
  1622.         /// 删除其它费用记录
  1623.         /// </summary>
  1624.         /// <param name="userid">设备ID</param>
  1625.         public void ProOtherDelete(int OtherID)
  1626.         {
  1627.             string sSQL = "delete from tb_Project_Other where [OtherID]='" + OtherID + "'";
  1628.             MSDA.Open();
  1629.             MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
  1630.             MSDA.Close();
  1631.         }
  1632.         /// <summary>
  1633.         /// 其它费用记录集合
  1634.         /// </summary>
  1635.         public DataView ProOtherGetAll(int ProjectID)
  1636.         {
  1637.             string sSQL = "select * from tb_Project_Other  where ProjectID='" + ProjectID + "'";
  1638.             MSDA.Open();
  1639.             NewObj newobject = new NewObj();
  1640.             DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1641.             MSDA.Close();
  1642.             return dv;
  1643.         }
  1644.         /// <summary>
  1645.         /// 其它费用单条记录
  1646.         /// </summary>
  1647.         public DataView ProOtherGetById(int OtherID)
  1648.         {
  1649.             string sSQL = "select * from tb_Project_Other  where OtherID='" + OtherID + "'";
  1650.             MSDA.Open();
  1651.             NewObj newobject = new NewObj();
  1652.             DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1653.             MSDA.Close();
  1654.             return dv;
  1655.         }
  1656.         /// <summary>
  1657.         /// 查找设备费用
  1658.         /// </summary>
  1659.         /// <param name="projectid">项目ID</param>
  1660.         /// <param name="WZType">查找类型,1:物资代码;2:规格型号</param>
  1661.         /// <param name="searchContent">查找内容</param>
  1662.         /// <returns></returns>
  1663.         public DataView GetWZByConditions(int projectid, string WZType, string searchContent)
  1664.         {
  1665.             string strSqlText = "select * from tb_Project_Equipment  where  ProjectID='" + projectid +"'  " ;
  1666.             switch (WZType)
  1667.             {
  1668.                 case "1":
  1669.                     strSqlText = strSqlText + "  and wz_id  like  '%" + searchContent + "%'";
  1670.                     goto Label_00B9;
  1671.                 case "2":
  1672.                     strSqlText = strSqlText + "   and EquipmentSize  like  '%" + searchContent + "%'";
  1673.                     goto Label_00B9;
  1674.                 }
  1675.            
  1676.            
  1677.         Label_00B9:
  1678.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null).DefaultView;
  1679.         }
  1680.         /// <summary>
  1681.         /// 获取当前用户所在部门OrgcID记录
  1682.         /// </summary>
  1683.         /// <param name="OrgID"></param>
  1684.         /// <returns></returns>
  1685.         public string GetOrgcID(int UserID)
  1686.         {
  1687.             SqlParameter parameter = new SqlParameter("@UserID", SqlDbType.Int, 4);
  1688.             parameter.Value = UserID;
  1689.             string str = "";
  1690.             try
  1691.             {
  1692.                 DataView dv = null;
  1693.                 dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_GetOrgcID", parameter).DefaultView;
  1694.                 str = dv[0]["OrgcID"].ToString();
  1695.             }
  1696.             catch
  1697.             {
  1698.                 str = "";
  1699.             }
  1700.             finally
  1701.             {
  1702.                 MSDA.Close();
  1703.             }
  1704.             return str;
  1705.         }
  1706.         /// <summary>
  1707.         /// 工作流任务完成
  1708.         /// </summary>
  1709.         /// <returns>返回一bool类型值</returns>
  1710.         public bool WF_End(string EndDesc, string EndName, int EndX, int EndY, int WorkFlowID, int STATUS, int PrjID)
  1711.         {
  1712.             string sSQL = "insert into tb_WF_End([EndDesc],[EndName],[EndX],[EndY],[WorkFlowID],[STATUS],[PrjID]) values  " +
  1713.                 "('" + EndDesc + "', '" + EndName + "','" + EndX + "','" + EndY + "','" + WorkFlowID + "','" + STATUS + "','" + PrjID + "')";
  1714.             bool returnvalue=false;
  1715.             try
  1716.             {
  1717.                 MSDA.Open();
  1718.                 NewObj newobject = new NewObj();
  1719.                 returnvalue = newobject.insert(sSQL, null, CommandType.Text);
  1720.             }
  1721.             catch
  1722.             {
  1723.                 returnvalue = false;
  1724.             }
  1725.             finally 
  1726.             { 
  1727.               MSDA.Close();
  1728.             }
  1729.            
  1730.             return returnvalue;
  1731.         }
  1732.        /// <summary>
  1733.        /// 获取某一普通员工的业务主管
  1734.        /// </summary>
  1735.        /// <returns></returns>
  1736.         public DataView GetParentEmp(int EmpID)
  1737.         {
  1738.            // string sSQL = "select * from Tb_Sys_Employee where  EmpID=" + EmpID; 
  1739.             string sSQL = "select * from tb_Sys_User where EmpID in (select ParentEmp from Tb_Sys_Employee where  EmpID=" + EmpID +")";
  1740.             DataView dv = null;
  1741.              MSDA.Open();
  1742.             try
  1743.             {
  1744.                 NewObj newobject = new NewObj();
  1745.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1746.             }
  1747.             catch (Exception ex)
  1748.             {
  1749.                 dv = null;
  1750.                 throw ex;
  1751.             }
  1752.             finally
  1753.             {
  1754.                 MSDA.Close(); 
  1755.             }
  1756.             return dv;
  1757.         }
  1758.         /// <summary>
  1759.         ///判断某一员工是否是业务主管
  1760.         /// </summary>
  1761.         /// <returns>返回bool类型</returns>
  1762.         public bool ParentEmp(int UserID)
  1763.         {
  1764.             string sSQL = "select * from tb_sys_Employee  where ParentEmp=(select EmpID from tb_sys_user where userid=" + UserID + ")";
  1765.             DataView dv = null;
  1766.             MSDA.Open();
  1767.             try
  1768.             {
  1769.                 NewObj newobject = new NewObj();
  1770.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1771.                 if (dv.Count == 0)
  1772.                     dv = null;
  1773.             }
  1774.             catch (Exception ex)
  1775.             {
  1776.                 dv = null;
  1777.                 throw ex;
  1778.             }
  1779.             finally
  1780.             {
  1781.                 MSDA.Close();
  1782.             }
  1783.             if (dv != null)
  1784.                 return true;
  1785.             else
  1786.                 return false;
  1787.            
  1788.         }
  1789.         /// <summary>
  1790.         /// 获取领导名单
  1791.         /// </summary>
  1792.         /// <returns></returns>
  1793.         public DataView GetEmpLD(int OpID)
  1794.         {
  1795.             //string sSQL = "select  UserID,EmpID from tb_Sys_User where  EmpID in (select EmpID from tb_Sys_EmpOpRole where OpID=7)";
  1796.             string sSQL = "select UserID,EmpName from tb_Sys_User U,Tb_Sys_Employee E where  U.EmpID in (select EmpID from tb_Sys_EmpOpRole where OpID=" + OpID + ")  and U.EmpID=E.EmpID";
  1797.             DataView dv = null;
  1798.             MSDA.Open();
  1799.             try
  1800.             {
  1801.                 NewObj newobject = new NewObj();
  1802.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1803.             }
  1804.             catch (Exception ex)
  1805.             {
  1806.                 dv = null;
  1807.                 throw ex;
  1808.             }
  1809.             finally
  1810.             {
  1811.                 MSDA.Close();
  1812.             }
  1813.             return dv;
  1814.         }
  1815.         public DataTable GetWFPerissionList()
  1816.         {
  1817.            string strSqlText= "select p.[PermID],p.[DisplayName],p.[DefaultPage] from Tb_Sys_Permission p where ParentresCode='2'";
  1818.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  1819.         }
  1820.         /// <summary>
  1821.         ///返回某活动实例状态
  1822.         /// </summary>
  1823.         /// <returns></returns>
  1824.         public DataView GetActInsStatus(int actinsid)
  1825.         {
  1826.             string sSQL = "select * from tb_wf_actins  where ActInsID=" + actinsid;
  1827.             DataView dv = null;
  1828.             MSDA.Open();
  1829.             try
  1830.             {
  1831.                 NewObj newobject = new NewObj();
  1832.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1833.             }
  1834.             catch (Exception ex)
  1835.             {
  1836.                 dv = null;
  1837.                 throw ex;
  1838.             }
  1839.             finally
  1840.             {
  1841.                 MSDA.Close();
  1842.             }
  1843.             return dv;
  1844.         }
  1845.         /// <summary>
  1846.         ///返回某活动状态
  1847.         /// </summary>
  1848.         /// <returns></returns>
  1849.         public DataView GetActMustChooseItem(int actid)
  1850.         {
  1851.             string sSQL = "select * from tb_WF_Activity AC,tb_WF_StaticPage SP where AC.PageID=SP.StaticPageID and ActivityID=" + actid;
  1852.             DataView dv = null;
  1853.             MSDA.Open();
  1854.             try
  1855.             {
  1856.                 NewObj newobject = new NewObj();
  1857.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1858.             }
  1859.             catch (Exception ex)
  1860.             {
  1861.                 dv = null;
  1862.                 throw ex;
  1863.             }
  1864.             finally
  1865.             {
  1866.                 MSDA.Close();
  1867.             }
  1868.             return dv;
  1869.         }
  1870.         /// <summary>
  1871.         ///清除未提交申请
  1872.         /// </summary>
  1873.         /// <param name="ActivityID">起始活动</param>
  1874.         public void ProInit(int ActivityID)
  1875.         {
  1876.             string strSQL = "select ActInsID,CreateDate,WFInstanceID from  tb_WF_ActIns  where  ActivityID=" + ActivityID + " and Status=0";
  1877.             MSDA.Open();
  1878.             SqlTransaction tran = MSDA.BeginTransaction();
  1879.             try
  1880.             {
  1881.                 NewObj newobject = new NewObj();
  1882.                 DataView dv = null;
  1883.                 dv= newobject.Search(strSQL, null, CommandType.Text).Tables[0].DefaultView;
  1884.                 for (int i = 0; i < dv.Count; i++)
  1885.                 {
  1886.                     DateTime CreateDate = DateTime.Parse(dv[i]["CreateDate"].ToString().Trim());
  1887.                     TimeSpan ts = DateTime.Parse(DateTime.Now.ToShortDateString()) - CreateDate;
  1888.                     if ( ts.Days>= 7)
  1889.                     {
  1890.                         int WFInstanceID = Convert.ToInt16(dv[i]["WFInstanceID"].ToString().Trim());
  1891.                        
  1892.                         string strSQLIns = "select * from tb_WF_Instance  where  WFInstanceID=" + WFInstanceID;
  1893.                         DataView dvInstance = null;
  1894.                         dvInstance = newobject.Search(strSQLIns, null, CommandType.Text).Tables[0].DefaultView;
  1895.                         if (dvInstance.Count == 0)
  1896.                             continue;
  1897.                         int PrjID=Convert.ToInt16(dvInstance[0]["PrjID"].ToString().Trim());
  1898.                        //删除项目记录
  1899.                         string strSQLProject = "delete from tb_Project  where ProjectID=" + PrjID;
  1900.                         MSDA.ExecuteNonQuery(CommandType.Text, strSQLProject, null);
  1901.                        //删除设备费用记录
  1902.                         string strSQLPrjEquipment = "delete from tb_Project_Equipment where ProjectID=" + PrjID;
  1903.                         MSDA.ExecuteNonQuery(CommandType.Text, strSQLPrjEquipment, null);
  1904.                        //删除材料费用记录
  1905.                         string strSQLPrjMaterialt = "delete  from tb_Project_Material where ProjectID=" + PrjID;
  1906.                         MSDA.ExecuteNonQuery(CommandType.Text, strSQLPrjMaterialt, null);
  1907.                        //删除其它费用记录
  1908.                         string strSQLPrjOther = "delete from tb_Project_Other where ProjectID=" + PrjID;
  1909.                         MSDA.ExecuteNonQuery(CommandType.Text, strSQLPrjOther, null);
  1910.                         //删除工作流实例
  1911.                         string strSQLInstance = "delete from tb_WF_Instance  where  WFInstanceID=" + WFInstanceID;
  1912.                         MSDA.ExecuteNonQuery(CommandType.Text, strSQLInstance, null);
  1913.                         //删除活动实例
  1914.                         int ActInsID = Convert.ToInt16(dv[i]["ActInsID"].ToString().Trim());
  1915.                         string strSQLActIns = "delete  from  tb_WF_ActIns  where  ActInsID=" + ActInsID;
  1916.                         MSDA.ExecuteNonQuery(CommandType.Text, strSQLActIns, null);
  1917.                     }
  1918.                  }
  1919.               
  1920.               
  1921.                 tran.Commit();
  1922.             }
  1923.             catch (Exception ex)
  1924.             {
  1925.                 tran.Rollback();
  1926.                 throw ex;
  1927.             }
  1928.             finally
  1929.             {
  1930.                 MSDA.Close();
  1931.             }
  1932.         }
  1933.         /// <summary>
  1934.         ///返回项目分类情况
  1935.         /// </summary>
  1936.         /// <returns></returns>
  1937.         public DataView GetPrjSerial()
  1938.         {
  1939.             string sSQL = "select P.ProjectSort SerialName, count(*) num,sum(ChargeSum) ChargeSum  from tb_Project P,tb_Project_Serial PS  where  P.ProjectSort=PS.SerialName   group by  P.ProjectSort ";
  1940.             DataView dv = null;
  1941.             MSDA.Open();
  1942.             try
  1943.             {
  1944.                 NewObj newobject = new NewObj();
  1945.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1946.             }
  1947.             catch (Exception ex)
  1948.             {
  1949.                 dv = null;
  1950.                 throw ex;
  1951.             }
  1952.             finally
  1953.             {
  1954.                 MSDA.Close();
  1955.             }
  1956.             return dv;
  1957.         }
  1958.         /// <summary>
  1959.         ///返回工程项目预算表(电子文档)
  1960.         /// </summary>
  1961.         /// <returns></returns>
  1962.         public DataView GetSFileName(int activityid)
  1963.         {
  1964.             string sSQL = "select * from  tb_Colony_FileName  where ActivityID=" + activityid;
  1965.             DataView dv = null;
  1966.             MSDA.Open();
  1967.             try
  1968.             {
  1969.                 NewObj newobject = new NewObj();
  1970.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  1971.             }
  1972.             catch (Exception ex)
  1973.             {
  1974.                 dv = null;
  1975.                 throw ex;
  1976.             }
  1977.             finally
  1978.             {
  1979.                 MSDA.Close();
  1980.             }
  1981.             return dv;
  1982.         }
  1983.         /// <summary>
  1984.         /// 回退时,更改项目状态
  1985.         /// </summary>
  1986.         /// <returns>返回bool类型参数</returns>
  1987.         public bool Project_Untread(int projectid,int status)
  1988.         {
  1989.             QueryParameterCollection Params = new QueryParameterCollection();
  1990.             Params.Clear();
  1991.             Params.Add("@projectid", projectid);
  1992.             Params.Add("@status", status);
  1993.             string sSQL = "update  tb_Project Set Status=@status where ProjectID=@projectid";
  1994.             MSDA.Open();
  1995.             NewObj newobject = new NewObj();
  1996.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  1997.             MSDA.Close();
  1998.             return returnvalue;
  1999.         }
  2000.         ///// <summary>
  2001.         /////判断是否有同名项目
  2002.         ///// </summary>
  2003.         ///// <returns>返回bool类型值</returns>
  2004.         //public bool IfSnPrjName(string PrjName)
  2005.         //{
  2006.         //    string sSQL = "select * from tb_Project where ProjectName='" + PrjName + "'";
  2007.         //    DataView dv = null;
  2008.         //    bool re=true;
  2009.         //    MSDA.Open();
  2010.         //    try
  2011.         //    {
  2012.         //        NewObj newobject = new NewObj();
  2013.         //        dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  2014.         //        if (dv != null)
  2015.         //            re = true;
  2016.         //        else
  2017.         //            re = false;
  2018.         //    }
  2019.         //    catch (Exception ex)
  2020.         //    {
  2021.         //        re = true;
  2022.         //        throw ex;
  2023.         //    }
  2024.         //    finally
  2025.         //    {
  2026.         //        MSDA.Close();
  2027.         //    }
  2028.         //    return re;
  2029.         //}
  2030.         //项目查询根据状态和类型
  2031.         public DataView PrjQueryZ(int  PrjSort,int Status)
  2032.         {
  2033.             DataView dv = new DataView();
  2034.             string strSQL;
  2035.             MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
  2036.             if (PrjSort < -1 || PrjSort == 0)
  2037.             {
  2038.                 PrjSort = -212;              //没有数据
  2039.             }
  2040.             if (Status < -1)
  2041.             {
  2042.                 Status = -212;            //没有数据
  2043.             }
  2044.             strSQL = "select * from tb_Project";
  2045.             if (PrjSort != -1)
  2046.                 strSQL = strSQL + " where PrjSort=" + PrjSort;
  2047.             if (Status != -1)
  2048.             {
  2049.                 if (PrjSort != -1)
  2050.                     strSQL = strSQL + " and Status=" + Status;
  2051.                 else
  2052.                     strSQL = strSQL + " where Status=" + Status;
  2053.             }
  2054.             try
  2055.             {
  2056.                 MSDA.Open();
  2057.                 dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
  2058.             }
  2059.             catch (Exception ex)
  2060.             {
  2061.                 throw ex;
  2062.             }
  2063.             finally
  2064.             {
  2065.                 MSDA.Close();
  2066.             }
  2067.             return dv;
  2068.         }
  2069.        
  2070.         /// <summary>
  2071.         /// 起始活动.
  2072.         /// </summary>
  2073.         /// <returns></returns>
  2074.         public static  int ActivityIDGetByWFID(int WfId)
  2075.         {
  2076.             EtongZwf etongzwf = new EtongZwf();
  2077.             DataView dvActivity = etongzwf.GetActivityByWFID(WfId);
  2078.             if (dvActivity.Count != 0)
  2079.             {
  2080.                 int activity = Convert.ToInt32(dvActivity[0][0].ToString().Trim());
  2081.                 return activity;
  2082.             }
  2083.             else
  2084.                 return 0;
  2085.         }
  2086.         /// <summary>
  2087.         /// 用最新日期生成最新文档
  2088.         /// </summary>
  2089.         /// <param name="filename"></param>
  2090.         /// <returns></returns>
  2091.         public static string MakeNewFileNameWithDate(string filename)
  2092.         {
  2093.             if (filename.Length > 0)
  2094.             {
  2095.                 string[] a = filename.Split('.');
  2096.                 return a[0] + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + "." + a[1];
  2097.             }
  2098.             else
  2099.                 return "";
  2100.         }
  2101.         /// <summary>
  2102.         /// 得到指定活动的文档名称
  2103.         /// </summary>
  2104.         /// <param name="activityid"></param>
  2105.         /// <returns></returns>
  2106.         public static ArrayList GetDocumentFileName(int activityid)
  2107.         {
  2108.           //  string sql = "select [SFileName] from [tb_Colony_FileName] where [ActivityID]=" + activityid;
  2109.             string sql = "select * from [tb_Sys_FileName]  where [FID]  in (select FID  from  tb_Colony_FileName1 where ActivityID=" +activityid +")";
  2110.            // string tempfilename = "";
  2111.             DataView dv = SqlServer.GetDataView(sql);
  2112.             ArrayList al = new ArrayList();
  2113.             if (dv != null && dv.Count > 0)
  2114.             {
  2115.                 for (int i = 0; i < dv.Count; i++)
  2116.                 {
  2117.                     string filename = dv[i]["FName"].ToString();
  2118.                     if (filename.Length >= 5)
  2119.                     {
  2120.                        // tempfilename = filename.Substring(filename.LastIndexOf("\\") + 2);
  2121.                         al.Add(filename);
  2122.                     }
  2123.                 }
  2124.             }
  2125.             return al;
  2126.         }
  2127.         /// <summary>
  2128.         /// 获取当前活动状态
  2129.         /// </summary>
  2130.         /// <param name="ActID"></param>
  2131.         /// <returns></returns>
  2132.         public static string GetStatus(int ActID)
  2133.         {
  2134.             EtongZwf etongzwf = new EtongZwf();
  2135.             try
  2136.             {
  2137.                 DataView dvAct = etongzwf.GetWFAct(ActID);
  2138.                 string Status = dvAct[0]["Status"].ToString().Trim();
  2139.                 return Status;
  2140.             }
  2141.             catch
  2142.             { return ""; }
  2143.         }
  2144.         /// <summary>
  2145.         /// 获取 工程变更和调整 项目
  2146.         /// </summary>
  2147.         /// <param name="wfid"></param>
  2148.         /// <returns></returns>
  2149.         public DataView GetPrjAlert(int wfinstanceid)
  2150.         {
  2151.             //string sSQL = "select C.ConName,P.* from tb_construct C,tb_PrjAlert P where C.ConID  " +
  2152.             //        "in(select PrjID from tb_WF_Instance where WFInstanceID=" + wfinstanceid + ") and C.ConID=P.ConID";
  2153.             string sSQL = "select  * from tb_PrjAlert  where AlertID  in(select PrjID from tb_WF_Instance where WFInstanceID=" + wfinstanceid + ")";
  2154.             DataView dv = null;
  2155.             try
  2156.             {
  2157.                 MSDA.Open();
  2158.                 NewObj newobject = new NewObj();
  2159.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  2160.                 MSDA.Close();
  2161.             }
  2162.             catch
  2163.             {
  2164.                 dv = null;
  2165.             }
  2166.             return dv;
  2167.         }
  2168.         /// <summary>
  2169.         /// 获取 工程计划项目
  2170.         /// </summary>
  2171.         /// <param name="wfid"></param>
  2172.         /// <returns></returns>
  2173.         public DataView GetProject(int wfinstanceid)
  2174.         {
  2175.             string sSQL = "select  * from tb_Project  where PrjSort  in(select PrjID from tb_WF_Instance where WFInstanceID=" + wfinstanceid  + ")";
  2176.             DataView dv = null;
  2177.             try
  2178.             {
  2179.                 MSDA.Open();
  2180.                 NewObj newobject = new NewObj();
  2181.                 dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
  2182.                 MSDA.Close();
  2183.             }
  2184.             catch
  2185.             {
  2186.                 dv = null;
  2187.             }
  2188.             return dv;
  2189.         }
  2190.         /// <summary>
  2191.         ///工程变更和调整 基层部门
  2192.         /// </summary>
  2193.         /// <returns>返回bool类型参数</returns>
  2194.         public bool PrjAlert_JC(int AlertID, string JcTransactor, string JcFName, int status)
  2195.         {
  2196.             QueryParameterCollection Params = new QueryParameterCollection();
  2197.             Params.Clear();
  2198.             Params.Add("@AlertID", AlertID);
  2199.             Params.Add("@JcTransactor", JcTransactor);
  2200.             Params.Add("@JcFName", JcFName);
  2201.             Params.Add("@status", status);
  2202.             string sSQL = "update  tb_PrjAlert Set JcTransactor=@JcTransactor,JcFName=@JcFName,Status=@status where AlertID=@AlertID";
  2203.             MSDA.Open();
  2204.             NewObj newobject = new NewObj();
  2205.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  2206.             MSDA.Close();
  2207.             return returnvalue;
  2208.         }
  2209.         /// <summary>
  2210.         ///工程变更和调整 主管部门
  2211.         /// </summary>
  2212.         /// <returns>返回bool类型参数</returns>
  2213.         public bool PrjAlert_Zg(int AlertID, string ZgTransactor, string ZgFName, int status)
  2214.         {
  2215.             QueryParameterCollection Params = new QueryParameterCollection();
  2216.             Params.Clear();
  2217.             Params.Add("@AlertID", AlertID);
  2218.             Params.Add("@ZgTransactor", ZgTransactor);
  2219.             Params.Add("@ZgFName", ZgFName);
  2220.             Params.Add("@status", status);
  2221.             string sSQL = "update  tb_PrjAlert Set ZgTransactor=@ZgTransactor,ZgFName=@ZgFName,Status=@status where AlertID=@AlertID";
  2222.             MSDA.Open();
  2223.             NewObj newobject = new NewObj();
  2224.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  2225.             MSDA.Close();
  2226.             return returnvalue;
  2227.         }
  2228.         /// <summary>
  2229.         ///工程变更和调整 工程管理办公室
  2230.         /// </summary>
  2231.         /// <returns>返回bool类型参数</returns>
  2232.         public bool PrjAlert_Gcgl(int AlertID, string GcglTransactor, string GcglIdea, int status)
  2233.         {
  2234.             QueryParameterCollection Params = new QueryParameterCollection();
  2235.             Params.Clear();
  2236.             Params.Add("@AlertID", AlertID);
  2237.             Params.Add("@GcglTransactor", GcglTransactor);
  2238.             Params.Add("@GcglIdea", GcglIdea);
  2239.             Params.Add("@status", status);
  2240.             string sSQL = "update  tb_PrjAlert Set GcglTransactor=@GcglTransactor,GcglIdea=@GcglIdea,Status=@status where AlertID=@AlertID";
  2241.             MSDA.Open();
  2242.             NewObj newobject = new NewObj();
  2243.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  2244.             MSDA.Close();
  2245.             return returnvalue;
  2246.         }
  2247.         /// <summary>
  2248.         ///工程变更和调整 分管领导审批
  2249.         /// </summary>
  2250.         /// <returns>返回bool类型参数</returns>
  2251.         public bool PrjAlert_Fg(int AlertID, string FgTransactor, string FgIdea, int status)
  2252.         {
  2253.             QueryParameterCollection Params = new QueryParameterCollection();
  2254.             Params.Clear();
  2255.             Params.Add("@AlertID", AlertID);
  2256.             Params.Add("@FgTransactor", FgTransactor);
  2257.             Params.Add("@FgIdea", FgIdea);
  2258.             Params.Add("@status", status);
  2259.             string sSQL = "update  tb_PrjAlert Set FgTransactor=@FgTransactor,FgIdea=@FgIdea,Status=@status where AlertID=@AlertID";
  2260.             MSDA.Open();
  2261.             NewObj newobject = new NewObj();
  2262.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  2263.             MSDA.Close();
  2264.             return returnvalue;
  2265.         }
  2266.         /// <summary>
  2267.         /// 获取项目施工流程ID
  2268.         /// </summary>
  2269.         /// <param name="OrgID"></param>
  2270.         /// <returns></returns>
  2271.         public int  GetConWfID()
  2272.         {
  2273.             string sql = " select  WFID from  tb_WorkFlowRouter  where RouID=4";
  2274.             int wfid = -1;
  2275.             DataView dv = SqlServer.GetDataView(sql);
  2276.             if (dv != null && dv.Count > 0)
  2277.             {
  2278.                 wfid = Convert.ToInt16(dv[0]["WFID"].ToString().Trim());
  2279.             }
  2280.             return wfid;
  2281.         }
  2282.         /// <summary>
  2283.         /// 变更项目查询
  2284.         /// </summary>
  2285.         /// <returns>返回DataView类型</returns>
  2286.         public DataView StatusSearchPrjAlert()
  2287.         {
  2288.             DataView dv=null;
  2289.             try
  2290.             {
  2291.                 MSDA.Open();
  2292.                 DataSet ds = SqlHelper.ExecuteDataSet(SqlHelper.connectionString, CommandType.StoredProcedure, "P_GetStatusPrjAlert", null);
  2293.                 dv = ds.Tables[0].DefaultView;
  2294.             }
  2295.             catch
  2296.             {
  2297.                  dv=null;
  2298.             }
  2299.             finally
  2300.             {
  2301.                MSDA.Close();
  2302.             }
  2303.         
  2304.             return dv;
  2305.         }
  2306.         /// <summary>
  2307.         /// 查询PrjAlert
  2308.         /// </summary>
  2309.         /// <returns>返回一dataset类型值</returns>
  2310.         public DataView AllStatusSearchPrjAlert(int AlertID)
  2311.         {
  2312.             DataView dv = null;
  2313.             try
  2314.             {
  2315.                 MSDA.Open();
  2316.                 SqlParameter paramter = new SqlParameter("@PrjID", SqlDbType.Int, 4);
  2317.                 paramter.Value = AlertID;
  2318.                 DataSet ds = SqlHelper.ExecuteDataSet(SqlHelper.connectionString, CommandType.StoredProcedure, "P_GetAllStatusPrjAlert", paramter);
  2319.                 dv = ds.Tables[0].DefaultView;
  2320.             }
  2321.             catch
  2322.             {
  2323.                 dv = null;
  2324.             }
  2325.             finally
  2326.             {
  2327.                 MSDA.Close();
  2328.             }
  2329.             return dv;
  2330.         }
  2331.         public DataView AllStatusSearch(int PrjID)
  2332.         {
  2333.             DataView dv = null;
  2334.             try
  2335.             {
  2336.                 MSDA.Open();
  2337.                 SqlParameter paramter = new SqlParameter("@PrjID", SqlDbType.Int, 4);
  2338.                 paramter.Value = PrjID;
  2339.                 DataSet ds = SqlHelper.ExecuteDataSet(SqlHelper.connectionString, CommandType.StoredProcedure, "P_GetAllStatus",paramter);
  2340.                 dv = ds.Tables[0].DefaultView;
  2341.             }
  2342.             catch
  2343.             {
  2344.                 dv = null;
  2345.             }
  2346.             finally
  2347.             {
  2348.                 MSDA.Close();
  2349.             }
  2350.             return dv;
  2351.         }
  2352.         /// <summary>
  2353.         /// 获取指定流程的启始活动
  2354.         /// </summary>
  2355.         /// <param name="RouID">1:变更材料 4:施工工作流</param>
  2356.         /// <returns></returns>
  2357.         public DataView ActivityColony_User(int RouID)
  2358.         {
  2359.             string sSQL = "select * from tb_Colony_User where ActivityID in(select ActivityID from  tb_WF_Activity  where   "
  2360.             + "WorkFlowID in(select  WFID from  tb_WorkFlowRouter  where RouID=" + RouID + ")  and   StartEnd=0) ";
  2361.             DataView dv = null;
  2362.             try
  2363.             {
  2364.                 MSDA.Open();
  2365.                 dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, sSQL, null).DefaultView;
  2366.                 MSDA.Close();
  2367.             }
  2368.             catch
  2369.             {
  2370.                 dv = null;
  2371.             }
  2372.             return dv;
  2373.         }
  2374.         /// <summary>
  2375.         /// 获取指定活动所属类型
  2376.         /// </summary>
  2377.         /// <param name="RouID">1: 4:施工工作流</param>
  2378.         /// <returns></returns>
  2379.         public DataView ActInsSort(int actinsid)
  2380.         {
  2381.             string sSQL = "select * from  tb_WF_ActIns where ActInsID=" + actinsid;
  2382.             DataView dv = null;
  2383.             try
  2384.             {
  2385.                 MSDA.Open();
  2386.                 dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, sSQL, null).DefaultView;
  2387.                 MSDA.Close();
  2388.             }
  2389.             catch
  2390.             {
  2391.                 dv = null;
  2392.             }
  2393.             return dv;
  2394.         }
  2395.         /// <summary>
  2396.         /// 操作电子文档权限
  2397.         /// </summary>
  2398.         /// <param name="EmpID">员工ID</param>
  2399.         /// <returns></returns>
  2400.         public static ArrayList GetSFileNamePerm(int EmpID)
  2401.         {
  2402.             string sSQL = "select * from  tb_Sys_FileName where FID in(select FID from  tb_WF_RoleFName where OpID "
  2403.                         + " in(select OpID from   Tb_Sys_EmpOpRole where EmpID= " + EmpID + "))";
  2404.             DataView dv = SqlServer.GetDataView(sSQL);
  2405.             ArrayList al = new ArrayList();
  2406.             if (dv != null && dv.Count > 0)
  2407.             {
  2408.                 for (int i = 0; i < dv.Count; i++)
  2409.                 {
  2410.                     string FileId = dv[i]["FName"].ToString();
  2411.                     al.Add(FileId);
  2412.                 }
  2413.             }
  2414.             return al;
  2415.         }
  2416.         /// <summary>
  2417.         /// 获取某业务角色对应的类型
  2418.         /// </summary>
  2419.         /// <param name="opid">业务角色ID</param>
  2420.         /// <returns></returns>
  2421.         public static string  GetOpRole(int opid)
  2422.         {
  2423.             string str = "";
  2424.             string sSQL = "select * from   Tb_Sys_OpRole Where OpID=" + opid;
  2425.             try
  2426.             {
  2427.                 DataView dv = SqlServer.GetDataView(sSQL);
  2428.                 if (dv != null && dv.Count > 0)
  2429.                 {
  2430.                     str = dv[0]["OrgDesc"].ToString();
  2431.                 }
  2432.             }
  2433.             catch
  2434.             {
  2435.                 str = "";
  2436.             }
  2437.             return str;
  2438.         }
  2439.         /// <summary>
  2440.         /// 写数据到XML文件中
  2441.         /// </summary>
  2442.         /// <param name="XMLFileName">要打开的XML文件</param>
  2443.         /// <param name="DocFileName">写入DOC文件名</param>
  2444.         /// <param name="EmpName">操作人用户名</param>
  2445.         /// <param name="Date">操作日期时间</param>
  2446.         public void WriteXML(string XMLFileName, string DocFileName, string EmpName, string OpSort, string Date)
  2447.         {
  2448.             //初始化XML文档操作类
  2449.             XmlDocument mydoc = new XmlDocument();
  2450.             //加载指定的XML文件
  2451.             mydoc.Load(XMLFileName);
  2452.             //添加元素-DOC文件名
  2453.             XmlElement ele = mydoc.CreateElement("DocFileName");
  2454.             XmlText text = mydoc.CreateTextNode(DocFileName);
  2455.             //添加元素-操作人用户名
  2456.             XmlElement ele1 = mydoc.CreateElement("EmpName");
  2457.             XmlText text1 = mydoc.CreateTextNode(EmpName);
  2458.             //添加元素-操作人类型
  2459.             XmlElement ele3 = mydoc.CreateElement("OpSort");
  2460.             XmlText text3 = mydoc.CreateTextNode(OpSort);
  2461.             //添加元素-操作日期时间
  2462.             XmlElement ele2 = mydoc.CreateElement("Date");
  2463.             XmlText text2 = mydoc.CreateTextNode(Date);
  2464.         
  2465.             //添加文件的节点-msgrecord
  2466.             XmlNode newElem = mydoc.CreateNode("element", "XMLrecord", "");
  2467.             //在节点中添加元素
  2468.             newElem.AppendChild(ele);
  2469.             newElem.LastChild.AppendChild(text);
  2470.             newElem.AppendChild(ele1);
  2471.             newElem.LastChild.AppendChild(text1);
  2472.             newElem.AppendChild(ele3);
  2473.             newElem.LastChild.AppendChild(text3);
  2474.             newElem.AppendChild(ele2);
  2475.             newElem.LastChild.AppendChild(text2);
  2476.             //将节点添加到文档中
  2477.             XmlElement root = mydoc.DocumentElement;
  2478.             root.AppendChild(newElem);
  2479.             //保存所有修改
  2480.             mydoc.Save(XMLFileName);
  2481.         }
  2482.         /// <summary>
  2483.         /// 判断 (或同类型的) 上级活动实例是否产生
  2484.         /// </summary>
  2485.         /// <param name="Actid">当前活动ID</param>
  2486.         /// <param name="WfInstanceID">当前工作流实例</param>
  2487.         /// <param name="IOpsort">是否要据类型查找</param>
  2488.         /// <param name="Opsort">类型</param>
  2489.         /// <returns>返回bool类型值</returns>
  2490.         public bool CheckUpActCompleteActIns(int Actid, int WfInstanceID, bool IOpsort, string Opsort)
  2491.         {
  2492.             bool bl = true;
  2493.             DataView dv = new DataView();
  2494.             MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
  2495.             try
  2496.             {
  2497.                 string sSQL = "select  * from tb_WF_ActIns where ActivityID in (select ActivityID from tb_Colony_User where ParentActID=" + Actid + ") and WfInstanceID=" + WfInstanceID;
  2498.                 MSDA.Open();
  2499.                 if(IOpsort==true)
  2500.                     sSQL = "select  * from tb_WF_ActIns where ActivityID in (select ActivityID from tb_Colony_User where ParentActID=" + Actid + ") and WfInstanceID=" + WfInstanceID + " and BlockReason='"  + Opsort +"'";
  2501.                 
  2502.                 dv = MSDA.ExecuteDataView(CommandType.Text, sSQL, null);
  2503.                 if (dv.Table.Rows.Count > 0)
  2504.                 {
  2505.                     for (int i = 0; i < dv.Table.Rows.Count; i++)
  2506.                     {
  2507.                         if (Convert.ToInt32(dv.Table.Rows[i][0].ToString()) == 0) bl = false;
  2508.                     }
  2509.                 }
  2510.                 else
  2511.                 {
  2512.                     bl = false;
  2513.                 }
  2514.             }
  2515.             catch (Exception ex)
  2516.             {
  2517.                 bl = false;
  2518.                 throw ex;
  2519.             }
  2520.             finally
  2521.             {
  2522.                 MSDA.Close();
  2523.             }
  2524.             return bl;
  2525.         }
  2526.   
  2527.    #endregion
  2528.     }
  2529. }