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

.net编程

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Data.SqlClient;
  4. using com.etong.SqlDataConnect;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Collections;
  8. namespace com.etong.DAL.FC
  9. {
  10.     /// <summary>
  11.     /// 系统维护(职工和组织机构)
  12.     /// </summary>
  13.     public class EtongFlyChou
  14.     {
  15.         private MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
  16.         public EtongFlyChou()
  17.         {
  18.             //
  19.             // TODO: 在此处添加构造函数逻辑
  20.             //
  21.         }
  22.         /// <summary>
  23.         ///读取所有组织机构的数据
  24.         /// </summary>
  25.         /// <param name="sExcelFile">excel文件路径</param>
  26.         /// <param name="strXslSheet">sheet页名称</param>
  27.         /// <param name="SQLTableName">SQL中表名</param>
  28.         /// <param name="Arr">Excel中字段和SQL中表字段的对应,由ListItem组成的ArrayList</param>
  29.         public DataView ReadOrgData()
  30.         {
  31.             DataSet ds = new DataSet();
  32.             string strSQL = "select * from Tb_Sys_Organization order by OrgLevel,ParentOrgID,OrgID";
  33.             MSDA.Open();
  34.             MSDA.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  35.             MSDA.Close();
  36.             return ds.Tables[0].DefaultView;
  37.         }
  38.         /// <summary>
  39.         /// 读取职工树数据
  40.         /// </summary>
  41.         /// <returns>dataview</returns>
  42.         public DataView ReadEmpData()
  43.         {
  44.             DataSet ds = new DataSet();
  45.             string strSQL = "select EmpID,EmpName,PrimaryOrgID,OrgLevel from Tb_Sys_Employee,Tb_Sys_Organization where OrgID=PrimaryOrgID order by PrimaryOrgID";
  46.             MSDA.Open();
  47.             MSDA.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  48.             MSDA.Close();
  49.             return ds.Tables[0].DefaultView;
  50.         }
  51.         /// <summary>
  52.         /// 读取职工与组织机构的关系
  53.         /// </summary>
  54.         /// <returns></returns>
  55.         public DataView ReadEmpOrg()
  56.         {
  57.             DataSet ds = new DataSet();
  58.             string StrSQL = "select EmpName,OrgLevel,Tb_Sys_Organization.OrgID from Tb_Sys_Employee,Tb_Sys_EmpOrg,Tb_Sys_Organization where Tb_Sys_EmpOrg.EmpID=Tb_Sys_Employee.EmpID and Tb_Sys_Organization.OrgID=Tb_Sys_EmpOrg.OrgID order by PrimaryOrgID";
  59.             MSDA.Open();
  60.             MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  61.             MSDA.Close();
  62.             return ds.Tables[0].DefaultView;
  63.         }
  64.         /// <summary>
  65.         /// 获取职工编号
  66.         /// </summary>
  67.         /// <returns>int 职工编号</returns>
  68.         public int GetMaxEmpID()
  69.         {
  70.             string MaxEmp = "0";
  71.             int iMaxEmp;
  72.             string StrSQL = "select max(EmpID) as MaxEmp from Tb_Sys_Employee";
  73.             MSDA.Open();
  74.             SqlDataReader dr = MSDA.ExecuteReader(CommandType.Text, StrSQL, null);
  75.             if (dr.Read())
  76.             {
  77.                 if (dr["MaxEmp"] != null && dr["MaxEmp"].ToString().Trim() != "")
  78.                 {
  79.                     MaxEmp = dr["MaxEmp"].ToString().Trim();
  80.                 }
  81.                 else
  82.                 {
  83.                     MaxEmp = "0";
  84.                 }
  85.             }
  86.             iMaxEmp = Convert.ToInt32(MaxEmp) + 1;
  87.             dr.Close();
  88.             MSDA.Close();
  89.             return iMaxEmp;
  90.         }
  91.         /// <summary>
  92.         /// 获取组织机构编号
  93.         /// </summary>
  94.         /// <returns> int 组织机构编号</returns>
  95.         public int GetMaxOrgzationID()
  96.         {
  97.             string SMaxID = "0";
  98.             int iMaxID;
  99.             string StrSQL = "select max(OrgID) as SMaxID from Tb_Sys_Organization";
  100.             MSDA.Open();
  101.             SqlDataReader dr = MSDA.ExecuteReader(CommandType.Text, StrSQL, null);
  102.             if (dr.Read())
  103.             {
  104.                 if (dr["SMaxID"] != null && dr["SMaxID"].ToString().Trim() != "")
  105.                 {
  106.                     SMaxID = dr["SMaxID"].ToString().Trim();
  107.                 }
  108.                 else
  109.                 {
  110.                     SMaxID = "0";
  111.                 }
  112.             }
  113.             iMaxID = Convert.ToInt32(SMaxID) + 1;
  114.             dr.Close();
  115.             MSDA.Close();
  116.             return iMaxID;
  117.         }
  118.         /// <summary>
  119.         /// 新建职工
  120.         /// </summary>
  121.         /// <param name="EmpName">职工姓名</param>
  122.         /// <param name="OrgID">所属组织机构代码</param>
  123.         /// <param name="Email">Email(电子邮件)</param>
  124.         /// <param name="PhNum">电话号码</param>
  125.         /// <param name="TmpFlag">是否是临时员工(0、雇佣;1、临时职工)</param>
  126.         /// <returns>true:保存成功!false:保存失败!</returns>
  127.         public bool AddEmpData(string EmpName, string OrgID, string Email, string PhNum, int TmpFlag,int iType,ArrayList al,int iPEmpID)
  128.         {
  129.             bool bl=false;
  130.             if (TmpFlag != 0 && TmpFlag != 1) return bl;
  131.             int iOrgID, iEmpID;
  132.             iOrgID = Convert.ToInt32(OrgID);
  133.             iEmpID = GetMaxEmpID();
  134.             DateTime EditDate = new DateTime();
  135.             EditDate = System.DateTime.Now;
  136.             string StrSQL = "insert into Tb_Sys_Employee values(" + iEmpID + ",'" + EmpName + "'," +
  137.                 iOrgID + "," + iType + ",'" + Email + "','" + PhNum + "','" + EditDate + "'," + TmpFlag + "," + iPEmpID + ")";
  138.             MSDA.Open();
  139.             SqlTransaction tran = MSDA.BeginTransaction();
  140.             try
  141.             {
  142.                 MSDA.ExecuteNonQuery(CommandType.Text, StrSQL, null);
  143.                 for (int i = 0; i < al.Count; i++)
  144.                 {
  145.                     StrSQL = "insert into Tb_Sys_EmpOpRole values(" + iEmpID + "," + Convert.ToInt32(al[i].ToString()) + ")";
  146.                     MSDA.ExecuteNonQuery(CommandType.Text, StrSQL, null);
  147.                 }
  148.                 tran.Commit();
  149.                 bl= true;
  150.             }
  151.             catch (Exception ex)
  152.             {
  153.                 tran.Rollback();
  154.                 throw ex;
  155.             }
  156.             finally
  157.             {
  158.                 MSDA.Close();
  159.             }
  160.             return bl;
  161.             
  162.         }
  163.         /// <summary>
  164.         /// 等到所属组织机构代码
  165.         /// </summary>
  166.         /// <param name="sEmpID">职工代码</param>
  167.         /// <returns>string 组织机构代码</returns>
  168.         public string GetEmpParentOrgID(string sEmpID)
  169.         {
  170.             string StrParentOrg = "";
  171.             int iEmpID = 0;
  172.             iEmpID = Convert.ToInt32(sEmpID);
  173.             string StrSQL;
  174.             DataSet ds = new DataSet();
  175.             MSDA.Open();
  176.             if (iEmpID > 0)
  177.             {
  178.                 StrSQL = "select PrimaryOrgID from Tb_Sys_Employee where EmpID=" + iEmpID;
  179.                 ds.Clear();
  180.                 MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  181.                 StrParentOrg = ds.Tables[0].Rows[0][0].ToString();
  182.             }
  183.             MSDA.Close();
  184.             return StrParentOrg;
  185.         }
  186.         /// <summary>
  187.         /// 得到组织机构的全路径名
  188.         /// </summary>
  189.         /// <param name="SOrgID">组织机构ID</param>
  190.         /// <returns>组织机构的全路径</returns>
  191.         public string GetAddressName(string SOrgID)
  192.         {
  193.             string StrOrgPath = "";
  194.             int OrgID = 0;
  195.             OrgID = Convert.ToInt32(SOrgID);
  196.             string StrSQL;
  197.             DataSet ds = new DataSet();
  198.             MSDA.Open();
  199.             for (; OrgID > 0; )
  200.             {
  201.                 StrSQL = "select ParentOrgID,OrgName from Tb_Sys_Organization where OrgID=" + OrgID;
  202.                 ds.Clear();
  203.                 MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  204.                 OrgID = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
  205.                 if (StrOrgPath == "")
  206.                 {
  207.                     StrOrgPath = ds.Tables[0].Rows[0][1].ToString();
  208.                 }
  209.                 else
  210.                 {
  211.                     StrOrgPath = ds.Tables[0].Rows[0][1].ToString() + "/" + StrOrgPath;
  212.                 }
  213.             }
  214.             MSDA.Close();
  215.             return StrOrgPath;
  216.         }
  217.         /// <summary>
  218.         /// 得到组织机构名称
  219.         /// </summary>
  220.         /// <param name="SOrgID">组织机构ID</param>
  221.         /// <returns>组织机构名称</returns>
  222.         public string GetOrgzationName(string SOrgID)
  223.         {
  224.             string StrOrgName;
  225.             int OrgID;
  226.             OrgID = Convert.ToInt32(SOrgID);
  227.             string StrSQL = "select OrgName from Tb_Sys_Organization where OrgID=" + OrgID;
  228.             DataSet ds = new DataSet();
  229.             MSDA.Open();
  230.             MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  231.             if (ds.Tables[0].Rows.Count > 0)
  232.                 StrOrgName = ds.Tables[0].Rows[0][0].ToString();
  233.             else
  234.                 StrOrgName = "未知";
  235.             MSDA.Close();
  236.             return StrOrgName;
  237.         }
  238.         /// <summary>
  239.         /// 同名检测
  240.         /// </summary>
  241.         /// <param name="StrEmpName">职工名称</param>
  242.         /// <returns>相同为true,不同为false</returns>
  243.         public bool HomonymyCheck(string StrEmpName)
  244.         {
  245.             string StrSQL = "select EmpID from Tb_Sys_Employee where EmpName='" + StrEmpName + "'";
  246.             DataSet ds = new DataSet();
  247.             MSDA.Open();
  248.             ds = MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  249.             MSDA.Close();
  250.             if (ds.Tables[0].Rows.Count > 0)
  251.             {
  252.                 return false;
  253.             }
  254.             return true;
  255.         }
  256.         /// <summary>
  257.         /// 的到父节点树的内容
  258.         /// </summary>
  259.         /// <param name="StrOrgID">父节点id</param>
  260.         /// <returns>string</returns>
  261.         public string GetParentNode(string StrOrgID)
  262.         {
  263.             int iOrgID;
  264.             string StrSQL, StrOrgName;
  265.             DataSet ds = new DataSet();
  266.             iOrgID = Convert.ToInt32(StrOrgID);
  267.             StrSQL = "select OrgPath from Tb_Sys_Organization where OrgID=" + iOrgID;
  268.             MSDA.Open();
  269.             ds = MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  270.             MSDA.Close();
  271.             StrOrgName = ds.Tables[0].Rows[0][0].ToString();
  272.             return StrOrgName;
  273.         }
  274.         /// <summary>
  275.         /// 等到父节点树的内容
  276.         /// </summary>
  277.         /// <param name="StrOrgID">父节点id</param>
  278.         /// <returns>string</returns>
  279.         public string GetParentID(string StrOrgID)
  280.         {
  281.             int iOrgID;
  282.             string StrSQL, StrOrgName;
  283.             DataSet ds = new DataSet();
  284.             iOrgID = Convert.ToInt32(StrOrgID);
  285.             StrSQL = "select ParentOrgID from Tb_Sys_Organization where OrgID=" + iOrgID;
  286.             MSDA.Open();
  287.             ds = MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  288.             MSDA.Close();
  289.             StrOrgName = ds.Tables[0].Rows[0][0].ToString();
  290.             return StrOrgName;
  291.         }
  292.         /// <summary>
  293.         /// 新增组织机构
  294.         /// </summary>
  295.         /// <param name="ParentID">父ID</param>
  296.         /// <param name="OrgName">名称</param>
  297.         /// <param name="OrgDesc">描述</param>
  298.         /// <param name="Level">级别</param>
  299.         /// <param name="OrgPath">全路径</param>
  300.         /// <returns>bool</returns>
  301.         public void AddOrgzation(string ParentID, string OrgName, string OrgDesc, string Level, string OrgPath,string strCID)
  302.         {
  303.             int iParentID, iOrgID, iLevel;
  304.             string OrgType = "1";
  305.             iParentID = Convert.ToInt32(ParentID);
  306.             iOrgID = GetMaxOrgzationID();
  307.             iLevel = Convert.ToInt32(Level) + 1;
  308.             DateTime EditDate = new DateTime();
  309.             EditDate = System.DateTime.Now;
  310.             OrgPath = OrgPath + "/" + Convert.ToString(iOrgID);
  311.             //string scid = GetOrgMaxCID();
  312.             string StrSQL = "insert into Tb_Sys_Organization values(" + iOrgID + "," + iParentID + ",'" +
  313.                 OrgName + "','" + OrgDesc + "'," + 1 + "," + iLevel + ",'" + EditDate + "','" + OrgType + "','" +
  314.                 OrgPath + "','" + strCID + "')";
  315.             MSDA.Open();
  316.             SqlTransaction tran = MSDA.BeginTransaction();
  317.             try
  318.             {
  319.                 MSDA.ExecuteNonQuery(CommandType.Text, StrSQL, null);
  320.                 tran.Commit();
  321.             }
  322.             catch (Exception ex)
  323.             {
  324.                 tran.Rollback();
  325.                 throw ex;
  326.             }
  327.             finally
  328.             {
  329.                 MSDA.Close();
  330.             }
  331.         }
  332.         /// <summary>
  333.         /// 获取职工全部内容
  334.         /// </summary>
  335.         /// <param name="SEmpID">职工ID</param>
  336.         /// <returns>DataView</returns>
  337.         public DataView GetEmp(string SEmpID)
  338.         {
  339.             int iEmpID;
  340.             iEmpID = Convert.ToInt32(SEmpID);
  341.             DataSet ds = new DataSet();
  342.             string StrSQL = "select * from Tb_Sys_Employee where EmpID=" + iEmpID;
  343.             MSDA.Open();
  344.             MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  345.             MSDA.Close();
  346.             return ds.Tables[0].DefaultView;
  347.         }
  348.         /// <summary>
  349.         /// 修改职工信息
  350.         /// </summary>
  351.         /// <param name="iEmpID">职工ID</param>
  352.         /// <param name="EmpName">职工姓名</param>
  353.         /// <param name="PNum">电话号码</param>
  354.         /// <param name="Email">电子邮件</param>
  355.         /// <param name="iCheck">身份(临时或正式)</param>
  356.         /// <param name="iType">职工类型</param>
  357.         /// <returns>bool</returns>
  358.         public bool UpEmp(int iEmpID, string EmpName, string PNum, string Email, int iCheck,int iType,ArrayList al,int iPEmpID)
  359.         {
  360.             DateTime EditDate = new DateTime();
  361.             EditDate = System.DateTime.Now;
  362.             string StrSQL = "update Tb_Sys_Employee set EmpName='" + EmpName + "',EMail='" +
  363.                 Email + "',PhoneNumber='" + PNum + "',EditDate='" + EditDate + "',TempFlag=" +
  364.                 iCheck + ",EmpType=" + iType + ",ParentEmp=" + iPEmpID + " where EmpID = " + iEmpID;
  365.             MSDA.Open();
  366.             SqlTransaction tran = MSDA.BeginTransaction();
  367.             try
  368.             {
  369.                 MSDA.ExecuteNonQuery(CommandType.Text, StrSQL, null);
  370.                 StrSQL = "delete from Tb_Sys_EmpOpRole where EmpID=" + iEmpID;
  371.                 MSDA.ExecuteNonQuery(CommandType.Text, StrSQL, null);
  372.                 for (int i = 0; i < al.Count; i++)
  373.                 {
  374.                     StrSQL = "insert into Tb_Sys_EmpOpRole values(" + iEmpID + "," + Convert.ToInt32(al[i].ToString()) + ")";
  375.                     MSDA.ExecuteNonQuery(CommandType.Text, StrSQL, null);
  376.                 }
  377.                 tran.Commit();
  378.                 return true;
  379.             }
  380.             catch
  381.             {
  382.                 tran.Rollback();
  383.                 return false;
  384.             }
  385.             finally
  386.             {
  387.                 MSDA.Close();
  388.             }
  389.         }
  390.         /// <summary>
  391.         /// 通过组织机构ID获取组织机构全部信息
  392.         /// </summary>
  393.         /// <param name="sOrgID">组织机构ID</param>
  394.         /// <returns>DataView组织机构信息</returns>
  395.         public DataView GetOrganzation(string sOrgID)
  396.         {
  397.             int iOrgID;
  398.             iOrgID = Convert.ToInt32(sOrgID);
  399.             DataSet ds = new DataSet();
  400.             string StrSQL = "select * from Tb_Sys_Organization where OrgID=" + iOrgID;
  401.             MSDA.Open();
  402.             MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  403.             MSDA.Close();
  404.             return ds.Tables[0].DefaultView;
  405.         }
  406.         /// <summary>
  407.         /// 修改组织机构信息
  408.         /// </summary>
  409.         /// <param name="iOrgID">组织机构ID</param>
  410.         /// <param name="OrgName">组织机构名称</param>
  411.         /// <param name="OrgDesc">组织机构描述</param>
  412.         /// <returns>bool</returns>
  413.         public void UpOrg(int iOrgID, string OrgName, string OrgDesc, string strCID)
  414.         {
  415.             DateTime EditDate = new DateTime();
  416.             EditDate = System.DateTime.Now;
  417.             string StrSQL = "update Tb_Sys_Organization set OrgName='" + OrgName + "',OrgDesc='" +
  418.                 OrgDesc + "',OrgCID='" + strCID  + "' where OrgID = " + iOrgID;
  419.             MSDA.Open();
  420.             SqlTransaction tran = MSDA.BeginTransaction();
  421.             try
  422.             {
  423.                 MSDA.ExecuteNonQuery(CommandType.Text, StrSQL, null);
  424.                 tran.Commit();
  425.             }
  426.             catch (Exception ex)
  427.             {
  428.                 tran.Rollback();
  429.                 throw ex;
  430.             }
  431.             finally
  432.             {
  433.                 MSDA.Close();
  434.             }
  435.         }
  436.         /// <summary>
  437.         /// 删除职工信息
  438.         /// </summary>
  439.         /// <param name="iEmpID">职工ID</param>
  440.         /// <returns>bool</returns>
  441.         public bool DelEmp(int iEmpID)
  442.         {
  443.             string StrSQL = "delete from Tb_Sys_Employee where EmpID=" + iEmpID;
  444.             MSDA.Open();
  445.             SqlTransaction tran = MSDA.BeginTransaction();
  446.             try
  447.             {
  448.                 MSDA.ExecuteNonQuery(CommandType.Text, StrSQL, null);
  449.                 tran.Commit();
  450.                 return true;
  451.             }
  452.             catch
  453.             {
  454.                 tran.Rollback();
  455.                 return false;
  456.             }
  457.             finally
  458.             {
  459.                 MSDA.Close();
  460.             }
  461.         }
  462.         /// <summary>
  463.         /// 判断职工是否已被使用
  464.         /// </summary>
  465.         /// <param name="iEmpID">职工ID</param>
  466.         /// <returns>bool</returns>
  467.         public bool BlEmpUser(int iEmpID)
  468.         {
  469.             string StrSQL = "select * from Tb_Sys_User where EmpID=" + iEmpID;
  470.             DataSet ds = new DataSet();
  471.             MSDA.Open();
  472.             ds = MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  473.             MSDA.Close();
  474.             if (ds.Tables[0].Rows.Count > 0)
  475.             {
  476.                 ds.Clear();
  477.                 return false;
  478.             }
  479.             ds.Clear();
  480.             return true;
  481.         }
  482.         /// <summary>
  483.         /// 判断是否有子组织
  484.         /// </summary>
  485.         /// <param name="iOrgParent">组织机构ID</param>
  486.         /// <returns>bool</returns>
  487.         public bool BlOrgParent(int iOrgParent)
  488.         {
  489.             string StrSQL = "select * from Tb_Sys_Organization where ParentOrgID=" + iOrgParent;
  490.             DataSet ds = new DataSet();
  491.             MSDA.Open();
  492.             ds = MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  493.             MSDA.Close();
  494.             if (ds.Tables[0].Rows.Count > 0)
  495.             {
  496.                 ds.Clear();
  497.                 return false;
  498.             }
  499.             ds.Clear();
  500.             return true;
  501.         }
  502.         /// <summary>
  503.         /// 判断是否有子职工
  504.         /// </summary>
  505.         /// <param name="iEmpParent">所属组织机构代码</param>
  506.         /// <returns>bool</returns>
  507.         public bool BlEmpParent(int iEmpParent)
  508.         {
  509.             string StrSQL = "select * from Tb_Sys_Employee where PrimaryOrgID=" + iEmpParent;
  510.             DataSet ds = new DataSet();
  511.             MSDA.Open();
  512.             ds = MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  513.             MSDA.Close();
  514.             if (ds.Tables[0].Rows.Count > 0)
  515.             {
  516.                 ds.Clear();
  517.                 return false;
  518.             }
  519.             ds.Clear();
  520.             return true;
  521.         }
  522.         /// <summary>
  523.         /// 删除组织机构信息
  524.         /// </summary>
  525.         /// <param name="iOrgID">组织机构ID</param>
  526.         /// <returns>bool</returns>
  527.         public bool DelOrg(int iOrgID)
  528.         {
  529.             string StrSQL = "delete from Tb_Sys_Organization where OrgID=" + iOrgID;
  530.             MSDA.Open();
  531.             SqlTransaction tran = MSDA.BeginTransaction();
  532.             try
  533.             {
  534.                 MSDA.ExecuteNonQuery(CommandType.Text, StrSQL, null);
  535.                 tran.Commit();
  536.                 return true;
  537.             }
  538.             catch
  539.             {
  540.                 tran.Rollback();
  541.                 return false;
  542.             }
  543.             finally
  544.             {
  545.                 MSDA.Close();
  546.             }
  547.         }
  548.         /// <summary>
  549.         /// 职工转移组织机构
  550.         /// </summary>
  551.         /// <param name="iEmpID">职工ID</param>
  552.         /// <param name="iOrgID">组织机构ID</param>
  553.         /// <returns>bool</returns>
  554.         public bool UpEmpParent(int iEmpID, int iOrgID)
  555.         {
  556.             string StrSQL = "update Tb_Sys_Employee set PrimaryOrgID=" + iOrgID + " where EmpID=" + iEmpID;
  557.             MSDA.Open();
  558.             SqlTransaction tran = MSDA.BeginTransaction();
  559.             try
  560.             {
  561.                 MSDA.ExecuteNonQuery(CommandType.Text, StrSQL, null);
  562.                 tran.Commit();
  563.                 return true;
  564.             }
  565.             catch
  566.             {
  567.                 tran.Rollback();
  568.                 return false;
  569.             }
  570.             finally
  571.             {
  572.                 MSDA.Close();
  573.             }
  574.         }
  575.         /// <summary>
  576.         /// 获取角色名
  577.         /// </summary>
  578.         /// <param name="iRoleID">角色ID</param>
  579.         /// <returns>角色名</returns>
  580.         public string GetRoleName(int iRoleID)
  581.         {
  582.             string StrSQL, sRoleName;
  583.             StrSQL = "select RoleName from Tb_Sys_Role where RoleID=" + iRoleID;
  584.             MSDA.Open();
  585.             DataSet ds = new DataSet();
  586.             ds = MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  587.             MSDA.Close();
  588.             if (ds.Tables[0].Rows.Count > 0)
  589.             {
  590.                 sRoleName = ds.Tables[0].Rows[0][0].ToString();
  591.             }
  592.             else
  593.             {
  594.                 sRoleName = "未知";
  595.             }
  596.             return sRoleName;
  597.         }
  598.         /// <summary>
  599.         /// 获取组织机构字符ID
  600.         /// </summary>
  601.         /// <returns>组织机构字符ID</returns>
  602.         public string GetOrgMaxCID()
  603.         {
  604.             string MaxCID;
  605.             int iMax;
  606.             string strSQL = "select max(OrgcID) as MaxCID from Tb_Sys_Organization where len(OrgcID) > 1";
  607.             MSDA.Open();
  608.             SqlDataReader dr = MSDA.ExecuteReader(CommandType.Text, strSQL, null);
  609.             
  610.             if (dr.Read())
  611.             {
  612.                 if (dr["MaxCID"] != null && dr["MaxCID"].ToString().Trim() != "")
  613.                 {
  614.                     MaxCID = dr["MaxCID"].ToString().Trim();
  615.                     if (MaxCID.Substring(1, 1) == "z")
  616.                     {
  617.                         iMax = Convert.ToInt32(MaxCID.Substring(0, 1), 16) + 1;
  618.                         MaxCID = iMax.ToString() + MaxCID.Substring(1, 1).ToString();
  619.                     }
  620.                     else
  621.                     {
  622.                         
  623.                         iMax = Convert.ToInt32(MaxCID.Substring(1, 1), 16) + 1;
  624.                         //MaxCID =Convert.ToString( iMax & 0x00ff);
  625.                         MaxCID = MaxCID.Substring(0, 1).ToString() + GetCharString(iMax);
  626.                         
  627.                     }
  628.                     dr.Close();
  629.                     MSDA.Close();
  630.                     return MaxCID;
  631.                 }
  632.                 else
  633.                 {
  634.                     dr.Close();
  635.                     strSQL = "select max(OrgcID) as MaxCID from Tb_Sys_Organization";
  636.                     dr = MSDA.ExecuteReader(CommandType.Text, strSQL, null);
  637.                     if (dr.Read())
  638.                     {
  639.                         if (dr["MaxCID"] != null && dr["MaxCID"].ToString().Trim() != "")
  640.                         {
  641.                             MaxCID = dr["MaxCID"].ToString().Trim();
  642.                             if (MaxCID == "z")
  643.                             {
  644.                                 MaxCID = "aa";
  645.                             }
  646.                             else if (MaxCID == "0")
  647.                             {
  648.                                 MaxCID = "a";
  649.                             }
  650.                             else
  651.                             {
  652.                                 iMax = Convert.ToInt32(MaxCID, 16) + 1;
  653.                                 //MaxCID =Convert.ToString( iMax & 0x00ff);
  654.                                 MaxCID = GetCharString(iMax);
  655.                             }
  656.                         }
  657.                         else
  658.                         {
  659.                             MaxCID = "a";
  660.                         }
  661.                     }
  662.                     else
  663.                     {
  664.                         MaxCID = "a";
  665.                     }//end read
  666.                     dr.Close();
  667.                     MSDA.Close();
  668.                     return MaxCID;
  669.                 }
  670.             }//end dr
  671.             dr.Close();
  672.             MSDA.Close();
  673.             return MaxCID="a";
  674.         }
  675.         /// <summary>
  676.         /// int转换字符
  677.         /// </summary>
  678.         /// <param name="i">int</param>
  679.         /// <returns>字符串</returns>
  680.         public string GetCharString(int i)
  681.         {
  682.             string s = "";
  683.             switch (i)
  684.             {
  685.                 case 10:
  686.                     s = "a";
  687.                     break;
  688.                 case 11:
  689.                     s = "b";
  690.                     break;
  691.                 case 12:
  692.                     s = "c";
  693.                     break;
  694.                 case 13:
  695.                     s = "d";
  696.                     break;
  697.                 case 14:
  698.                     s = "e";
  699.                     break;
  700.                 case 15:
  701.                     s = "f";
  702.                     break;
  703.                 case 16:
  704.                     s = "g";
  705.                     break;
  706.                 case 17:
  707.                     s = "h";
  708.                     break;
  709.                 case 18:
  710.                     s = "i";
  711.                     break;
  712.                 case 19:
  713.                     s = "j";
  714.                     break;
  715.                 case 20:
  716.                     s = "k";
  717.                     break;
  718.                 case 21:
  719.                     s = "l";
  720.                     break;
  721.                 case 22:
  722.                     s = "m";
  723.                     break;
  724.                 case 23:
  725.                     s = "n";
  726.                     break;
  727.                 case 24:
  728.                     s = "o";
  729.                     break;
  730.                 case 25:
  731.                     s = "p";
  732.                     break;
  733.                 case 26:
  734.                     s = "q";
  735.                     break;
  736.                 case 27:
  737.                     s = "r";
  738.                     break;
  739.                 case 28:
  740.                     s = "s";
  741.                     break;
  742.                 case 29:
  743.                     s = "t";
  744.                     break;
  745.                 case 30:
  746.                     s = "u";
  747.                     break;
  748.                 case 31:
  749.                     s = "v";
  750.                     break;
  751.                 case 32:
  752.                     s = "w";
  753.                     break;
  754.                 case 33:
  755.                     s = "x";
  756.                     break;
  757.                 case 34:
  758.                     s = "y";
  759.                     break;
  760.                 case 35:
  761.                     s = "z";
  762.                     break;
  763.                 default:
  764.                     s=i.ToString();
  765.                     break;
  766.             }
  767.             return s;
  768.         }
  769.         public DataView GetAllEmp()
  770.         {
  771.             string strSQL = "select * from Tb_Sys_Employee ";
  772.             DataView dv = new DataView();
  773.             try
  774.             {
  775.                 MSDA.Open();
  776.                 dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
  777.             }
  778.             catch (Exception ex)
  779.             {
  780.                 throw ex;
  781.             }
  782.             finally
  783.             {
  784.                 MSDA.Close();
  785.             }
  786.             return dv;
  787.         }
  788.         public DataView GetEmpType()
  789.         {
  790.             string strSQL = "select * from tb_Sys_Sort ";
  791.             DataView dv = new DataView();
  792.             try
  793.             {
  794.                 MSDA.Open();
  795.                 dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
  796.             }
  797.             catch (Exception ex)
  798.             {
  799.                 throw ex;
  800.             }
  801.             finally
  802.             {
  803.                 MSDA.Close();
  804.             }
  805.             return dv;
  806.         }
  807.         public int GetEmpTypeEmp(int iEmpID)
  808.         {
  809.             string strSQL = "select EmpType from Tb_Sys_Employee where EmpID=" + iEmpID;
  810.             DataView dv = new DataView();
  811.             try
  812.             {
  813.                 MSDA.Open();
  814.                 dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
  815.             }
  816.             catch (Exception ex)
  817.             {
  818.                 throw ex;
  819.             }
  820.             finally
  821.             {
  822.                 MSDA.Close();
  823.             }
  824.             return dv.Table.Rows.Count > 0 ? Convert.ToInt32(dv.Table.Rows[0][0].ToString()):-1;
  825.         }
  826.     }
  827.     /// <summary>
  828.     /// 工作流
  829.     /// </summary>
  830.     public class EtongFlyChouWF
  831.     {
  832.         private MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
  833.         private QueryParameterCollection Params = new QueryParameterCollection();
  834.         public EtongFlyChouWF()
  835.         {
  836.             //
  837.             // TODO: 在此处添加构造函数逻辑
  838.             //
  839.         }
  840.         /// <summary>
  841.         /// 获取启动工作流的内容
  842.         /// </summary>
  843.         /// <returns>工作流的名称、描述、状态和地址dataview</returns>
  844.         public DataView GetWFStartData(int iEmpID)
  845.         {
  846.             DataSet ds = new DataSet();
  847.             string StrSQL = "select distinct(WFID),KindName,WFName,WFDesc,Status,PageUrl,activityid,s.MustChooseItem,StartUpType from tb_WF_Kind k,tb_workflow w,tb_WF_Activity a,tb_WF_StaticPage s";
  848.             StrSQL = StrSQL + " where w.Status=1 and k.KindID=w.KindID and a.workflowid=w.wfid and a.StartEnd=0 and s.StaticPageID=a.PageID and w.StartUpType in (";
  849.             StrSQL = StrSQL + "select OpID from Tb_Sys_EmpOpRole where EmpID =" + iEmpID + ")";
  850.             MSDA.Open();
  851.             ds = MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  852.             MSDA.Close();
  853.             return ds.Tables[0].DefaultView;
  854.         }
  855.         /// <summary>
  856.         /// 获取待办事宜和公共事宜等
  857.         /// 1、待办;2、公共;3、其他
  858.         /// </summary>
  859.         /// <param name="iUserID">用户ID</param>
  860.         /// <param name="iStatus">工作状态</param>
  861.         /// <returns>DataView工作流的事宜信息</returns>
  862.         public DataView GetWFWaitData(int UserIDflag, int iUserID, int Roleid, int iStatus0, int Status2,int iEmpType)
  863.         {
  864.             Params.Clear();
  865.             Params.Add("@Param_UserIDflag", UserIDflag);
  866.             Params.Add("@Param_UserID", iUserID);
  867.             Params.Add("@Param_RoleID", Roleid);
  868.             Params.Add("@Param_Status0", iStatus0);
  869.             Params.Add("@Param_Status2", Status2);
  870.             Params.Add("@Param_EmpType", iEmpType);
  871.             string strSQL = "P_GetWaitProject";
  872.             DataView dv = new DataView();
  873.             MSDA.Open();
  874.             dv = MSDA.ExecuteDataView(CommandType.StoredProcedure, strSQL, Params);
  875.             MSDA.Close();
  876.             return dv;
  877.         }
  878.         /// <summary>
  879.         /// 获取工作流种类
  880.         /// </summary>
  881.         /// <returns>工作流种类编号和名称</returns>
  882.         public DataView GetWFKind()
  883.         {
  884.             string strSQL = "P_GetWFKind";
  885.             DataView dv = new DataView();
  886.             MSDA.Open();
  887.             dv = MSDA.ExecuteDataView(CommandType.StoredProcedure, strSQL, null);
  888.             MSDA.Close();
  889.             return dv;
  890.         }
  891.         /// <summary>
  892.         /// 获取工作流页面
  893.         /// </summary>
  894.         /// <returns>页面编号和页面</returns>
  895.         public DataView GetWFStaticPage()
  896.         {
  897.             string strSQL = "P_GetWFStaticPage";
  898.             DataView dv = new DataView();
  899.             MSDA.Open();
  900.             dv = MSDA.ExecuteDataView(CommandType.StoredProcedure, strSQL, null);
  901.             MSDA.Close();
  902.             return dv;
  903.         }
  904.         /// <summary>
  905.         /// 获取页面名称
  906.         /// </summary>
  907.         /// <param name="iPage">页面ID</param>
  908.         /// <returns>DataView</returns>
  909.         public string GetWFStaticPageName(int iPage)
  910.         {
  911.             string strSQL, strName;
  912.             strSQL = "select PageName from tb_WF_StaticPage where StaticPageID=" + iPage ;
  913.             DataSet ds = new DataSet();
  914.             MSDA.Open();
  915.             ds = MSDA.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  916.             MSDA.Close();
  917.             if (ds.Tables[0].Rows.Count > 0)
  918.             {
  919.                 strName = ds.Tables[0].Rows[0][0].ToString();
  920.             }
  921.             else
  922.             {
  923.                 strName = "未知";
  924.             }
  925.             return strName;
  926.         }
  927.         /// <summary>
  928.         /// 更新工作流定义
  929.         /// </summary>
  930.         /// <param name="iWFID">工作流ID(-1:新增)</param>
  931.         /// <param name="sWFDesc">工作流描述</param>
  932.         /// <param name="sWFName">工作流名称</param>
  933.         /// <param name="iStatus">工作流状态</param>
  934.         /// <param name="sUnit">工作流使用单位</param>
  935.         /// <param name="iKindID">工作流所属种类</param>
  936.         /// <param name="iStartRouterID">起始页(-1:新增和修改)</param>
  937.         /// <param name="sStartDesc">关联表单</param>
  938.         /// <param name="iStartUpType">工作流启动类型</param>
  939.         /// <param name="iReadIncColonyID">同类型ID</param>
  940.         /// <param name="iReadtype">是否读取同类型ID</param>
  941.         /// <returns>bool</returns>
  942.         public bool InsertUpWF(int iWFID, string sWFDesc, string sWFName, int iStatus, string sUnit, int iKindID, int iStartRouterID, string sStartDesc, int iStartUpType, int iReadIncColonyID, int iReadtype)
  943.         {
  944.             DateTime LastUpdateDate = new DateTime();
  945.             DateTime CreateDate = new DateTime();
  946.             int OwnExcColonyID = 0, OwnIncColonyID =0, ReadExcColonyID = 0;
  947.             string sStartName="开始";
  948.             int StartX = 0, StartY =0, PanelY = 0,PanelX=0;
  949.             string sCodeName="01";
  950.             string strSQL = "";
  951.             LastUpdateDate = System.DateTime.Now;
  952.             if (iWFID == -1)  //insert
  953.             {
  954.                 CreateDate = System.DateTime.Now;
  955.                 strSQL = "insert into tb_WorkFlow values('" + LastUpdateDate + "','" + sWFDesc + "','" + sWFName + "'," +
  956.                     iStatus + ",'" + CreateDate + "'," + iStartUpType + ",'" + sUnit + "'," + OwnExcColonyID + "," +
  957.                     OwnIncColonyID + "," + ReadExcColonyID + "," + iReadIncColonyID + "," + iReadtype + "," + iKindID + ",'" +
  958.                     sStartDesc + "','" + sStartName + "'," + StartX + "," + StartY + "," + iStartRouterID + "," +
  959.                     PanelX + "," + PanelY + ",'" + sCodeName + "')";
  960.             }
  961.             else
  962.             {
  963.                 if (iStartRouterID != -1)
  964.                 {
  965.                     strSQL = "update tb_WorkFlow set StartRouterID=" + iStartRouterID + " where WFID=" + iWFID;
  966.                 }
  967.                 else
  968.                 {
  969.                     strSQL = "update tb_WorkFlow set LastUpdateDate='" + LastUpdateDate + "',WFDesc='" + sWFDesc
  970.                         + "',WFName='" + sWFName + "',StartUpType=" + iStartUpType + ",Unit='" + sUnit + "',KindID="
  971.                         + iKindID + ",StartDesc='" + sStartDesc + "',Status=" + iStatus + " where WFID=" + iWFID;
  972.                 }
  973.             }
  974.             if (strSQL == "" || strSQL == null)
  975.             {
  976.                 return false;
  977.             }
  978.             MSDA.Open();
  979.             SqlTransaction tran = MSDA.BeginTransaction();
  980.             try
  981.             {
  982.                 MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
  983.                 tran.Commit();
  984.                 return true;
  985.             }
  986.             catch
  987.             {
  988.                 tran.Rollback();
  989.                 return false;
  990.             }
  991.             finally
  992.             {
  993.                 MSDA.Close();
  994.             }
  995.         }
  996.         /// <summary>
  997.         /// 返回关联表单
  998.         /// </summary>
  999.         /// <param name="scode">表单类型</param>
  1000.         /// <returns>dataview</returns>
  1001.         public DataView GetWFDataTable(string scode)
  1002.         {
  1003.             if (scode != "1" && scode != "0")
  1004.             {
  1005.                 scode = "1";
  1006.             }
  1007.             Params.Clear();
  1008.             Params.Add("@Param_IsCode", scode);
  1009.             string strSQL = "P_GetDataTable";
  1010.             DataView dv = new DataView();
  1011.             MSDA.Open();
  1012.             dv = MSDA.ExecuteDataView(CommandType.StoredProcedure, strSQL, Params);
  1013.             MSDA.Close();
  1014.             return dv;
  1015.         }
  1016.         /// <summary>
  1017.         /// 获取已存在的表单信息
  1018.         /// </summary>
  1019.         /// <param name="iDtID">表单ID</param>
  1020.         /// <param name="scode">表单ID</param>
  1021.         /// <returns>DataView</returns>
  1022.         public DataView GetWFOldTable(int iDtID, string scode)
  1023.         {
  1024.             if (scode != "1" && scode != "0")
  1025.             {
  1026.                 scode = "1";
  1027.             }
  1028.             Params.Clear();
  1029.             Params.Add("@Param_IsCode", scode);
  1030.             Params.Add("@Param_DTID", iDtID);
  1031.             string strSQL = "P_GetOldTable";
  1032.             DataView dv = new DataView();
  1033.             MSDA.Open();
  1034.             dv = MSDA.ExecuteDataView(CommandType.StoredProcedure, strSQL, Params);
  1035.             MSDA.Close();
  1036.             return dv;
  1037.         }
  1038.         /// <summary>
  1039.         /// 获取已存在工作流
  1040.         /// </summary>
  1041.         /// <returns>dataview工作流要素</returns>
  1042.         public DataView GetWFNewData()
  1043.         {
  1044.             DataSet ds = new DataSet();
  1045.             string StrSQL = "select WFID,KindName,WFName,WFDesc,Status from tb_WF_Kind,tb_workflow";
  1046.             StrSQL = StrSQL + " where tb_workflow.KindID=tb_WF_Kind.KindID";
  1047.             MSDA.Open();
  1048.             ds = MSDA.ExecuteDataset(CommandType.Text, StrSQL, null, ds, "");
  1049.             MSDA.Close();
  1050.             return ds.Tables[0].DefaultView;
  1051.         }
  1052.         /// <summary>
  1053.         /// 获取指定工作流信息
  1054.         /// </summary>
  1055.         /// <param name="iWFID"></param>
  1056.         /// <returns></returns>
  1057.         public DataView GetWFOldData(int iWFID)
  1058.         {
  1059.             string strSQL;
  1060.             strSQL = "select WFID,KindName,WFName,WFDesc,Status,Unit,StartUpType,ReadIncColonyID,Readtype,StartDesc from tb_workflow,tb_WF_Kind";
  1061.             strSQL = strSQL + " where tb_workflow.KindID=tb_WF_Kind.KindID and WFID=" + iWFID;
  1062.             DataSet ds = new DataSet();
  1063.             MSDA.Open();
  1064.             ds = MSDA.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  1065.             MSDA.Close();
  1066.             return ds.Tables[0].DefaultView;
  1067.         }
  1068.         /// <summary>
  1069.         /// 获取工作流活动
  1070.         /// </summary>
  1071.         /// <param name="iWFID">工作流ID</param>
  1072.         /// <returns>Dataview</returns>
  1073.         public DataView GetActivityContent(int iWFID)
  1074.         {
  1075.             Params.Clear();
  1076.             Params.Add("@Param_WFID", iWFID);
  1077.             string strSQL = "P_ZFGetWFTask";
  1078.             DataView dv = new DataView();
  1079.             MSDA.Open();
  1080.             dv = MSDA.ExecuteDataView(CommandType.StoredProcedure, strSQL, Params);
  1081.             MSDA.Close();
  1082.             return dv;
  1083.         }
  1084.         /// <summary>
  1085.         /// 分页使用
  1086.         /// </summary>
  1087.         /// <param name="iWFID"></param>
  1088.         /// <param name="PageNum"></param>
  1089.         /// <param name="RowInPage"></param>
  1090.         /// <returns></returns>
  1091.         public DataView GetActivityContentPage(int iWFID, int PageNum, int RowInPage)
  1092.         {
  1093.             Params.Clear();
  1094.             Params.Add("@Param_WFID", iWFID);
  1095.             Params.Add("@page_num", PageNum);
  1096.             Params.Add("@row_in_page", RowInPage);
  1097.             string strSQL = "P_ZFGetWFTaskPage";
  1098.             DataView dv = new DataView();
  1099.             MSDA.Open();
  1100.             dv = MSDA.ExecuteDataView(CommandType.StoredProcedure, strSQL, Params);
  1101.             MSDA.Close();
  1102.             //for (int i = (PageNum - 1) * RowInPage; i > 0; i--)
  1103.             //{
  1104.             //    dv.Delete(i-1);
  1105.             //}
  1106.             return dv;
  1107.         }
  1108.         /// <summary>
  1109.         /// 获取活动名
  1110.         /// </summary>
  1111.         /// <param name="iActID">活动ID</param>
  1112.         /// <returns>活动名称</returns>
  1113.         public string GetActivityName(int iActID)
  1114.         {
  1115.             string strSQL,strName;
  1116.             strSQL = "select ActName from tb_WF_Activity where ActivityID=" + iActID;
  1117.             DataSet ds = new DataSet();
  1118.             MSDA.Open();
  1119.             ds = MSDA.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  1120.             MSDA.Close();
  1121.             if (ds.Tables[0].Rows.Count > 0)
  1122.             {
  1123.                 strName = ds.Tables[0].Rows[0][0].ToString();
  1124.             }
  1125.             else
  1126.             {
  1127.                 strName = "";
  1128.             }
  1129.             return strName;
  1130.         }
  1131.         /// <summary>
  1132.         /// 获取工作流任务的所有任务
  1133.         /// </summary>
  1134.         /// <param name="iWFID">工作流ID</param>
  1135.         /// <param name="iMode">协调方式</param>
  1136.         /// <returns></returns>
  1137.         public DataView GetParentAcivity(int iWFID,int iMode)
  1138.         {
  1139.             Params.Clear();
  1140.             Params.Add("@Param_WFID", iWFID);
  1141.             Params.Add("@Param_ModeFlag", iMode);
  1142.             string strSQL;
  1143.             strSQL = "P_ZFGetParentTask2";
  1144.             DataSet ds = new DataSet();
  1145.             MSDA.Open();
  1146.             ds = MSDA.ExecuteDataset(CommandType.StoredProcedure, strSQL, Params, ds, "");
  1147.             MSDA.Close();
  1148.             return ds.Tables[0].DefaultView;
  1149.         }
  1150.         /// <summary>
  1151.         /// 判断任务要素
  1152.         /// </summary>
  1153.         /// <param name="iWFID">工作流编号</param>
  1154.         /// <param name="iStrat">任务标志</param>
  1155.         /// <param name="sTableFiled">表字段</param>
  1156.         /// <returns>true:已存在;false:不存在</returns>
  1157.         public bool BlStartTask(int iWFID,int iStrat,string sTableFiled)
  1158.         {
  1159.             string strSQL = "select * from tb_WF_Activity where WorkFlowID=" +iWFID +" and " + sTableFiled + "=" + iStrat;
  1160.             DataSet ds = new DataSet();
  1161.             MSDA.Open();
  1162.             ds = MSDA.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  1163.             MSDA.Close();
  1164.             if (ds.Tables[0].Rows.Count > 0)
  1165.             {
  1166.                 return true;
  1167.             }
  1168.             return false;
  1169.         }
  1170.         /// <summary>
  1171.         /// 判断内容是否存在
  1172.         /// </summary>
  1173.         /// <param name="iNum">数</param>
  1174.         /// <param name="sTableFiled">字段名</param>
  1175.         /// <param name="sTable">表名</param>
  1176.         /// <returns>true:已存在;false:不存在</returns>
  1177.         public bool BlTask(int iNum, string sTableFiled,string sTable)
  1178.         {
  1179.             string strSQL;
  1180.             strSQL = "select * from " + sTable + " where " + sTableFiled + "=" + iNum;
  1181.             DataSet ds = new DataSet();
  1182.             MSDA.Open();
  1183.             ds = MSDA.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  1184.             MSDA.Close();
  1185.             if (ds.Tables[0].Rows.Count > 0)
  1186.             {
  1187.                 return true;
  1188.             }
  1189.             return false;
  1190.         }
  1191.         /// <summary>
  1192.         /// 新增工作流活动
  1193.         /// </summary>
  1194.         /// <param name="iActID">活动ID</param>
  1195.         /// <param name="sUnit">使用单位</param>
  1196.         /// <param name="sActName">活动名称</param>
  1197.         /// <param name="iWFID">工作流ID</param>
  1198.         /// <param name="iPage">关联页面</param>
  1199.         /// <param name="iStart">任务类型</param>
  1200.         /// <param name="iBlock">阻塞方式</param>
  1201.         /// <param name="iShunt">分流方式</param>
  1202.         /// <param name="iMode">协调方式</param>
  1203.         /// <param name="iRole">角色</param>
  1204.         /// <param name="iParent">上级活动</param>
  1205.         /// <returns></returns>
  1206.         public bool InsertWFAct(int iActID,string sUnit,string sActName,int iWFID,int iPage,int iStart,int iBlock,int iShunt,int iMode,Int64 iRole,int[] iParent,string[] sDoc)
  1207.         {
  1208.             string strSQL;
  1209.             strSQL = "insert into tb_WF_Activity values('" + sUnit + "',1,'','" + sActName + "',"
  1210.                 + iWFID + "," + iPage + ",'',''," + iStart + "," + iBlock + ","
  1211.                 + iShunt + "," + iMode + ")";
  1212.             MSDA.Open();
  1213.             SqlTransaction tran = MSDA.BeginTransaction();
  1214.             try
  1215.             {
  1216.                 MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
  1217.                 tran.Commit();
  1218.             }
  1219.             catch
  1220.             {
  1221.                 tran.Rollback();
  1222.                 return false;
  1223.             }
  1224.             finally
  1225.             {
  1226.                 MSDA.Close();
  1227.             }
  1228.             strSQL = "select max(ActivityID) as maxcode from tb_WF_Activity";
  1229.             DataSet ds = new DataSet();
  1230.             MSDA.Open();
  1231.             ds = MSDA.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  1232.             MSDA.Close();
  1233.             int iMaxCode;
  1234.             try
  1235.             {
  1236.                 iMaxCode = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
  1237.             }
  1238.             catch
  1239.             {
  1240.                 iMaxCode = 1;
  1241.             }
  1242.             for (int i=0;i<iParent.Length;i++)
  1243.             {
  1244.                 strSQL = "insert into tb_Colony_User values(" + iMaxCode + "," + iParent[i] + "," + iRole + ")";
  1245.                 MSDA.Open();
  1246.                 SqlTransaction trans = MSDA.BeginTransaction();
  1247.                 try
  1248.                 {
  1249.                     MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
  1250.                     trans.Commit();
  1251.                 }
  1252.                 catch
  1253.                 {
  1254.                     trans.Rollback();
  1255.                     strSQL = "delete from tb_WF_Activity where ActivityID=" + iMaxCode;
  1256.                     MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
  1257.                     return false;
  1258.                 }
  1259.                 finally
  1260.                 {
  1261.                     MSDA.Close();
  1262.                 }
  1263.             }
  1264.             for (int j = 0; j < sDoc.Length; j++)
  1265.             {
  1266.                 strSQL = "insert into tb_Colony_FileName values(" + iMaxCode + ",'" + sDoc[j] + "',1,1" + ")";
  1267.                 MSDA.Open();
  1268.                 SqlTransaction trans = MSDA.BeginTransaction();
  1269.                 try
  1270.                 {
  1271.                     MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
  1272.                     trans.Commit();
  1273.                 }
  1274.                 catch
  1275.                 {
  1276.                     trans.Rollback();
  1277.                     strSQL = "delete from tb_WF_Activity where ActivityID=" + iMaxCode;
  1278.                     MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
  1279.                     return false;
  1280.                 }
  1281.                 finally
  1282.                 {
  1283.                     MSDA.Close();
  1284.                 }
  1285.             }
  1286.             return true;
  1287.         }
  1288.         /// <summary>
  1289.         /// 修改活动任务
  1290.         /// </summary>
  1291.         /// <param name="iActID">活动ID</param>
  1292.         /// <param name="sUnit">使用单位</param>
  1293.         /// <param name="sActName">活动名称</param>
  1294.         /// <param name="iWFID">工作流ID</param>
  1295.         /// <param name="iPage">关联页面</param>
  1296.         /// <param name="iStart">任务类型</param>
  1297.         /// <param name="iBlock">阻塞方式</param>
  1298.         /// <param name="iShunt">分流方式</param>
  1299.         /// <param name="iMode">协调方式</param>
  1300.         /// <param name="iRole">角色</param>
  1301.         /// <param name="iParent">上级活动</param>
  1302.         /// <param name="flag">修改标志</param>
  1303.         /// <returns></returns>
  1304.         public bool UpWFAct(int iActID, string sUnit, string sActName, int iWFID, int iPage, int iStart, int iBlock, int iShunt, int iMode, Int64 iRole, int[] iParent, int flag,string[] sDoc)
  1305.         {
  1306.             string strSQL;
  1307.             if (flag == 1)
  1308.             {
  1309.                 strSQL = "update tb_WF_Activity set Unit='" + sUnit + "',ActName='" + sActName + "',PageID="
  1310.                     + iPage + ",StartEnd=" + iStart + ",BlockFlag=" + iBlock + ",ShuntFlag="
  1311.                     + iShunt + ",ModeFlag=" + iMode + " where WorkFlowID=" + iWFID + " and ActivityID=" + iActID;
  1312.             }
  1313.             else
  1314.             {
  1315.                 strSQL = "";
  1316.             }
  1317.             MSDA.Open();
  1318.             SqlTransaction tran = MSDA.BeginTransaction();
  1319.             try
  1320.             {
  1321.                 MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
  1322.                 strSQL = "update tb_Colony_User set RoleID=" + iRole + " where ActivityID=" + iActID;
  1323.                 MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
  1324.                 strSQL = "delete from tb_Colony_FileName where ActivityID=" + iActID;
  1325.                 MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
  1326.                 for (int j = 0; j < sDoc.Length; j++)
  1327.                 {
  1328.                     strSQL = "insert into tb_Colony_FileName values(" + iActID + ",'" + sDoc[j] + "',1,1" + ")";
  1329.                     MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
  1330.                 }
  1331.                 tran.Commit();
  1332.                 return true;
  1333.             }
  1334.             catch
  1335.             {
  1336.                 tran.Rollback();
  1337.                 return false;
  1338.             }
  1339.             finally
  1340.             {
  1341.                 MSDA.Close();
  1342.             }
  1343.         }
  1344.         /// <summary>
  1345.         /// 获取活动模板
  1346.         /// </summary>
  1347.         /// <param name="iActID"></param>
  1348.         /// <returns></returns>
  1349.         public DataView GetActFName(int iActID)
  1350.         {
  1351.             string strSQL = "select SFileName from tb_Colony_FileName where ActivityID=" + iActID ;
  1352.             DataView dv = new DataView();
  1353.             try
  1354.             {
  1355.                 MSDA.Open();
  1356.                 dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
  1357.             }
  1358.             catch (Exception ex)
  1359.             {
  1360.                 throw ex;
  1361.             }
  1362.             finally
  1363.             {
  1364.                 MSDA.Close();
  1365.             }
  1366.             return dv;
  1367.         }
  1368.         /// <summary>
  1369.         /// 获取已知活动内容
  1370.         /// </summary>
  1371.         /// <param name="iWFID">工作流ID</param>
  1372.         /// <param name="iActID">活动ID</param>
  1373.         /// <returns>Dataview</returns>
  1374.         public DataView GetActivityEdit(int iWFID, int iActID)
  1375.         {
  1376.             string strSQL;
  1377.             strSQL = "select * from tb_WF_Activity a,tb_Colony_User u where WorkFlowID=" + iWFID;
  1378.             strSQL = strSQL + " and a.ActivityID=" + iActID + " and u.ActivityID=a.ActivityID";
  1379.             DataSet ds = new DataSet();
  1380.             MSDA.Open();
  1381.             ds = MSDA.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  1382.             MSDA.Close();
  1383.             return ds.Tables[0].DefaultView;
  1384.         }
  1385.         /// <summary>
  1386.         /// 获取活动名
  1387.         /// </summary>
  1388.         /// <param name="iActID">活动ID</param>
  1389.         /// <returns>活动名称</returns>
  1390.         public string GetActName(int iActID)
  1391.         {
  1392.             string strSQL, strName;
  1393.             strSQL = "select ActName from tb_WF_Activity where ActivityID=" + iActID;
  1394.             DataSet ds = new DataSet();
  1395.             MSDA.Open();
  1396.             MSDA.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  1397.             MSDA.Close();
  1398.             if (ds.Tables[0].Rows.Count < 1)
  1399.             {
  1400.                 strName = "起始";
  1401.             }
  1402.             else
  1403.             {
  1404.                 strName = ds.Tables[0].Rows[0][0].ToString();
  1405.             }
  1406.             return strName;
  1407.         }
  1408.         /// <summary>
  1409.         /// 删除任务活动
  1410.         /// </summary>
  1411.         /// <param name="iWFID">工作流ID</param>
  1412.         /// <param name="iActID">活动ID</param>
  1413.         /// <returns>bool</returns>
  1414.         public bool DelActivity(int iWFID, int iActID)
  1415.         {
  1416.             string strSQL, strSQL1;
  1417.             strSQL = "delete from tb_Colony_User where ActivityID =" + iActID;
  1418.             strSQL1 = "delete from tb_WF_Activity where ActivityID =" + iActID + " and WorkFlowID=" + iWFID;
  1419.             MSDA.Open();
  1420.             SqlTransaction tran = MSDA.BeginTransaction();
  1421.             try
  1422.             {
  1423.                 MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
  1424.                 MSDA.ExecuteNonQuery(CommandType.Text, strSQL1, null);
  1425.                 tran.Commit();
  1426.                 return true;
  1427.             }
  1428.             catch
  1429.             {
  1430.                 tran.Rollback();
  1431.                 return false;
  1432.             }
  1433.             finally
  1434.             {
  1435.                 MSDA.Close();
  1436.             }
  1437.         }
  1438.         ///// <summary>
  1439.         ///// 活动流程是否已被使用
  1440.         ///// </summary>
  1441.         ///// <param name="iActID">活动ID</param>
  1442.         ///// <returns>bool</returns>
  1443.         //public bool BlUsed(int iActID)
  1444.         //{
  1445.         //    string strSQL;
  1446.         //    strSQL = "select * from";
  1447.         //}
  1448.     }
  1449.     /// <summary>
  1450.     /// 代码表内容
  1451.     /// </summary>
  1452.     public class EtongFlyChouCode
  1453.     {
  1454.         private MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
  1455.         private QueryParameterCollection Params = new QueryParameterCollection();
  1456.         public EtongFlyChouCode()
  1457.         {
  1458.             //
  1459.             // TODO: 在此处添加构造函数逻辑
  1460.             //
  1461.         }
  1462.         /// <summary>
  1463.         /// 获取所有种类方式
  1464.         /// </summary>
  1465.         /// <returns>DataView</returns>
  1466.         public DataView BlockCodeAll(string sTableName)
  1467.         {
  1468.             string strSQL = "select * from " + sTableName;
  1469.             DataSet ds = new DataSet();
  1470.             MSDA.Open();
  1471.             ds = MSDA.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  1472.             MSDA.Close();
  1473.             return ds.Tables[0].DefaultView;
  1474.         }
  1475.         public DataView BStringSelect(string sTField, string sTable, int i)
  1476.         {
  1477.             string strSQL = "select " + sTField + " from " + sTable;
  1478.             DataSet ds = new DataSet();
  1479.             if (i == 2)
  1480.             {
  1481.                 MSSqlDataAccess MSDA2 = new MSSqlDataAccess(i);
  1482.                 MSDA2.Open();
  1483.                 ds = MSDA2.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  1484.                 MSDA2.Close();
  1485.             }
  1486.             else
  1487.             {
  1488.                 MSDA.Open();
  1489.                 ds = MSDA.ExecuteDataset(CommandType.Text, strSQL, null, ds, "");
  1490.                 MSDA.Close();
  1491.             }
  1492.             return ds.Tables[0].DefaultView;
  1493.         }
  1494.     }
  1495.     /// <summary>
  1496.     /// 工作流流程分析
  1497.     /// </summary>
  1498.     public class EtongFlyChouWFTask
  1499.     {
  1500.         private int m_tID;          //ActivityID
  1501.         private int m_pID;          //ParentActID
  1502.         private string m_tName;     //ActName
  1503.         private int m_wID;          //WFID
  1504.         private int m_type;         //startend
  1505.         private string m_tUnit;     //Unit
  1506.         //任务代码
  1507.         public int TaskID
  1508.         {
  1509.             set { m_tID = value; }
  1510.             get { return m_tID; }
  1511.         }
  1512.         //流程代码
  1513.         public int ProcessID
  1514.         {
  1515.             set { m_pID = value; }
  1516.             get { return m_pID; }
  1517.         }
  1518.         //任务类型 0:起始任务;1:后续任务;2:最终任务
  1519.         public int TaskType
  1520.         {
  1521.             set { m_type = value; }
  1522.             get { return m_type; }
  1523.         }
  1524.         //任务名称
  1525.         public string TaskName
  1526.         {
  1527.             set { m_tName = value; }
  1528.             get { return m_tName; }
  1529.         }
  1530.         //使用单位
  1531.         public string TaskUnit
  1532.         {
  1533.             set { m_tUnit = value; }
  1534.             get { return m_tUnit; }
  1535.         }
  1536.         //所属工作流ID
  1537.         public int TaskWFID
  1538.         {
  1539.             set { m_wID = value; }
  1540.             get { return m_wID; }
  1541.         }
  1542.         //以下方法用于绘制流程图所用
  1543.         //得到起始任务
  1544.         public static EtongFlyChouWFTask GetInitTask(int iWFID)
  1545.         {
  1546.             string strSQL;
  1547.             EtongFlyChouWFTask tsk = new EtongFlyChouWFTask();
  1548.             MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
  1549.             strSQL = "select * from tb_WF_Activity where StartEnd=0 and WorkFlowID=" + iWFID;
  1550.             try
  1551.             {
  1552.                 MSDA.Open();
  1553.                 SqlDataReader dr = MSDA.ExecuteReader(CommandType.Text, strSQL, null);
  1554.                 if (dr.Read() == true)
  1555.                 {
  1556.                     tsk.m_tID = Convert.ToInt32(dr["ActivityID"]);
  1557.                     tsk.m_wID = Convert.ToInt32(dr["WorkFlowID"]);
  1558.                     tsk.m_pID = -1;
  1559.                     tsk.m_tName = Convert.ToString(dr["ActName"]);
  1560.                     tsk.m_tUnit = Convert.ToString(dr["Unit"]);
  1561.                     tsk.m_type = Convert.ToInt32(dr["StartEnd"]);
  1562.                 }
  1563.                 dr.Close();
  1564.             }
  1565.             finally
  1566.             {
  1567.                 MSDA.Close();
  1568.             }
  1569.             return tsk;
  1570.         }
  1571.         //得到下一步任务
  1572.         public ArrayList GetNextTask()
  1573.         {
  1574.             ArrayList al = new ArrayList();
  1575.             string strSQL;
  1576.             EtongFlyChouWFTask tsk;
  1577.             MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
  1578.             strSQL = "select a.*,ParentActID from tb_WF_Activity a,tb_Colony_User u where a.ActivityID=u.ActivityID"
  1579.                 + " and u.ParentActID=" + this.m_tID + " and a.WorkFlowID=" + this.m_wID;
  1580.             try
  1581.             {
  1582.                 MSDA.Open();
  1583.                 SqlDataReader dr = MSDA.ExecuteReader(CommandType.Text, strSQL, null);
  1584.                 while (dr.Read() == true)
  1585.                 {
  1586.                     tsk = new EtongFlyChouWFTask();
  1587.                     tsk.m_tID = Convert.ToInt32(dr["ActivityID"]);
  1588.                     tsk.m_wID = Convert.ToInt32(dr["WorkFlowID"]);
  1589.                     tsk.m_pID = Convert.ToInt32(dr["ParentActID"]);
  1590.                     tsk.m_tName = Convert.ToString(dr["ActName"]);
  1591.                     tsk.m_tUnit = Convert.ToString(dr["Unit"]);
  1592.                     tsk.m_type = Convert.ToInt32(dr["StartEnd"]);
  1593.                     al.Add(tsk);
  1594.                 }
  1595.                 dr.Close();
  1596.                 ////由于SqlDataReader独占Connection
  1597.                 //for (i=0;i<al.Count;i++)
  1598.                 //{
  1599.                 //    tsk = al[i] as EtongFlyChouWFTask;
  1600.                 //}
  1601.             }
  1602.             finally
  1603.             {
  1604.                 MSDA.Close();
  1605.             }
  1606.             return al;
  1607.         }
  1608.         //得到上一步任务
  1609.         public ArrayList GetPrevioueTasks()
  1610.         {
  1611.             ArrayList al = new ArrayList();
  1612.             string strSQL;
  1613.             EtongFlyChouWFTask tsk;
  1614.             MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
  1615.             strSQL = "select a.* from tb_WF_Activity a,tb_Colony_User u where u.ActivityID = " + this.m_tID + " and a.ActivityID = u.ActivityID";
  1616.             try
  1617.             {
  1618.                 MSDA.Open();
  1619.                 SqlDataReader dr = MSDA.ExecuteReader(CommandType.Text, strSQL, null);
  1620.                 while (dr.Read() == true)
  1621.                 {
  1622.                     tsk = new EtongFlyChouWFTask();
  1623.                     tsk.m_tID = Convert.ToInt32(dr["ActivityID"]);
  1624.                     tsk.m_wID = Convert.ToInt32(dr["WorkFlowID"]);
  1625.                     tsk.m_tName = Convert.ToString(dr["ActName"]);
  1626.                     tsk.m_tUnit = Convert.ToString(dr["Unit"]);
  1627.                     tsk.m_type = Convert.ToInt32(dr["StartEnd"]);
  1628.                     al.Add(tsk);
  1629.                 }
  1630.                 dr.Close();
  1631.             }
  1632.             finally
  1633.             {
  1634.                 MSDA.Close();
  1635.             }
  1636.             return al;
  1637.         }
  1638.     }
  1639.     /// <summary>
  1640.     /// 项目查询
  1641.     /// </summary>
  1642.     public class EtongFlyChouWFPrj
  1643.     {
  1644.         //说明-----全部的值为-1  tb_Project
  1645.         private int m_pID;                      //ProjectID
  1646.         private string m_pName;                //ProjectName
  1647.         private string m_pLsh;                  //ProjcetLsh
  1648.         private string m_pNum;                  //ProjectNumber
  1649.         private DateTime m_pDate;               //CreateDate
  1650.         private string m_pEditUint;             //EditUnit
  1651.         private string m_pManager;              //ProjectManager
  1652.         private string m_pTran;                 //Transactor
  1653.         private int m_pType;                    //ProjectType
  1654.         private int m_pStatus;                  //Status
  1655.         private decimal m_pPlan;                //PlanCharge
  1656.         private decimal m_pFact;                //FactCharge
  1657.         private DateTime m_pSucc;               //SuccessedDate
  1658.         //日志tb_Project_Log
  1659.         private int m_lID;                      //LogID
  1660.         private string m_lWriter;               //Writer
  1661.         private DateTime m_lDate;               //WriteDate
  1662.         private string m_lInfo;                 //WriteInfo
  1663.         //实例tb_WF_Instance
  1664.         private int m_iID;                      //WfInstanceID
  1665.         private DateTime m_iDate;               //CreateDate
  1666.         private int m_iUser;                    //CreateUserID
  1667.         private int m_iRole;                    //TargetRoleID
  1668.         //实例活动tb_WF_ActIns
  1669.         private int m_sID;                      //ActInsID
  1670.         private int m_sUser;                    //UserID
  1671.         private int m_sStatus;                  //Status
  1672.         //工作流tb_WorkFlow
  1673.         private int m_wID;                      //WFID
  1674.         private string m_wName;                 //WFName
  1675.         //权限
  1676.         private int m_DeptID;                   //
  1677.         private int m_EmpID;                    //
  1678.         //业务角色
  1679.         private string m_Must;
  1680.         private int m_EmpType;
  1681.         private string m_cDID;
  1682.         private Int16 m_Psort;
  1683.         private int m_Ndept;
  1684.         private string m_OpName;
  1685.         private int m_OpID;
  1686.         private ArrayList m_OpPerm;
  1687.         private string m_OpDesc;
  1688.         //项目代码
  1689.         public int PrjID
  1690.         {
  1691.             set { m_pID = value; }
  1692.             get { return m_pID; }
  1693.         }
  1694.         //项目名称
  1695.         public string PrjName
  1696.         {
  1697.             set { m_pName = value; }
  1698.             get { return m_pName; }
  1699.         }
  1700.         //项目流水号
  1701.         public string PrjLsh
  1702.         {
  1703.             set { m_pLsh = value; }
  1704.             get { return m_pLsh; }
  1705.         }
  1706.         //项目编号
  1707.         public string PrjNum
  1708.         {
  1709.             set { m_pNum = value; }
  1710.             get { return m_pNum; }
  1711.         }
  1712.         //任务创建日期
  1713.         public DateTime PrjCDate
  1714.         {
  1715.             set { m_pDate = value; }
  1716.             get { return m_pDate; }
  1717.         }
  1718.         //项目编报单位
  1719.         public string PrjUnit
  1720.         {
  1721.             set { m_pEditUint = value; }
  1722.             get { return m_pEditUint; }
  1723.         }
  1724.         //项目负责人
  1725.         public string PrjManager
  1726.         {
  1727.             set { m_pManager = value; }
  1728.             get { return m_pManager; }
  1729.         }
  1730.         //项目经办人
  1731.         public string PrjTran
  1732.         {
  1733.             set { m_pTran = value; }
  1734.             get { return m_pTran; }
  1735.         }
  1736.         //项目所属类型
  1737.         public int PrjType
  1738.         {
  1739.             set { m_pType = value; }
  1740.             get { return m_pType; }
  1741.         }
  1742.         //项目状态
  1743.         public int PrjStatus
  1744.         {
  1745.             set { m_pStatus = value; }
  1746.             get { return m_pStatus; }
  1747.         }
  1748.         //项目计划费用
  1749.         public decimal PrjPlan
  1750.         {
  1751.             set { m_pPlan = value; }
  1752.             get { return m_pPlan; }
  1753.         }
  1754.         //项目实际费用
  1755.         public decimal PrjFact
  1756.         {
  1757.             set { m_pFact = value; }
  1758.             get { return m_pFact; }
  1759.         }
  1760.         //项目实际完成时间
  1761.         public DateTime PrjSucc
  1762.         {
  1763.             set { m_pSucc = value; }
  1764.             get { return m_pSucc; }
  1765.         }
  1766.         //日志代码
  1767.         public int LogID
  1768.         {
  1769.             set { m_lID = value; }
  1770.             get { return m_lID; }
  1771.         }
  1772.         //日志填写人
  1773.         public string LogWriter
  1774.         {
  1775.             set { m_lWriter = value; }
  1776.             get { return m_lWriter; }
  1777.         }
  1778.         //日志填写日期
  1779.         public DateTime LogDate
  1780.         {
  1781.             set { m_lDate = value; }
  1782.             get { return m_lDate; }
  1783.         }
  1784.         //日志信息
  1785.         public string LogInfo
  1786.         {
  1787.             set { m_lInfo = value; }
  1788.             get { return m_lInfo; }
  1789.         }
  1790.         //实例tb_WF_Instance
  1791.         public int iID
  1792.         {
  1793.             set { m_iID = value; }
  1794.             get { return m_iID; }
  1795.         }
  1796.         public DateTime iDate
  1797.         {
  1798.             set { m_iDate = value; }
  1799.             get { return m_iDate; }
  1800.         }
  1801.         public int iUser
  1802.         {
  1803.             set { m_iUser = value; }
  1804.             get { return m_iUser; }
  1805.         }
  1806.         public int iRole
  1807.         {
  1808.             set { m_iRole = value; }
  1809.             get { return m_iRole; }
  1810.         }
  1811.         //实例活动tb_WF_ActIns
  1812.         public int sID
  1813.         {
  1814.             set { m_sID = value; }
  1815.             get { return m_sID; }
  1816.         }
  1817.         public int sUser
  1818.         {
  1819.             set { m_sUser = value; }
  1820.             get { return m_sUser; }
  1821.         }
  1822.         public int sStatus
  1823.         {
  1824.             set { m_sStatus = value; }
  1825.             get { return m_sStatus; }
  1826.         }
  1827.         //工作流tb_WorkFlow
  1828.         public int wID
  1829.         {
  1830.             set { m_wID = value; }
  1831.             get { return m_wID; }
  1832.         }
  1833.         public string wName
  1834.         {
  1835.             set { m_wName = value; }
  1836.             get { return m_wName; }
  1837.         }
  1838.         //权限
  1839.         public int DeptID
  1840.         {
  1841.             set {m_DeptID =value;}
  1842.             get {return m_DeptID;}
  1843.         }
  1844.         public int EmpID
  1845.         {
  1846.             set {m_EmpID =value;}
  1847.             get {return m_EmpID;}
  1848.         }
  1849.         public string Must
  1850.         {
  1851.             set { m_Must = value; }
  1852.             get { return m_Must; }
  1853.         }
  1854.         public int EmpType
  1855.         {
  1856.             set {m_EmpType=value;}
  1857.             get {return m_EmpType;}
  1858.         }
  1859.         public string CdID
  1860.         {
  1861.             set { m_cDID = value; }
  1862.             get { return m_cDID; }
  1863.         }
  1864.         public Int16 Psort
  1865.         {
  1866.             set { m_Psort = value; }
  1867.             get { return m_Psort; }
  1868.         }
  1869.         public int Ndept
  1870.         {
  1871.             set { m_Ndept = value; }
  1872.             get { return m_Ndept; }
  1873.         }
  1874.         public string OpName
  1875.         {
  1876.             set { m_OpName = value; }
  1877.             get { return m_OpName; }
  1878.         }
  1879.         public int OpID
  1880.         {
  1881.             set { m_OpID = value; }
  1882.             get { return m_OpID; }
  1883.         }
  1884.         public ArrayList OpPerm
  1885.         {
  1886.             set { m_OpPerm = value; }
  1887.             get { return m_OpPerm; }
  1888.         }
  1889.         public string OpDesc
  1890.         {
  1891.             set { m_OpDesc = value; }
  1892.             get { return m_OpDesc; }
  1893.         }
  1894.         //创建新项目
  1895.         public EtongFlyChouWFPrj CreateNewPrj()
  1896.         {
  1897.             return new EtongFlyChouWFPrj();
  1898.         }
  1899.         //项目查询根据状态和类型
  1900.         public DataView PrjQuery()
  1901.         {
  1902.             DataView dv = new DataView();
  1903.             string strSQL;
  1904.             MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
  1905.             if (this.m_pType < -1 || this.m_pType == 0)
  1906.             {
  1907.                 this.m_pType = -212;              //没有数据
  1908.             }
  1909.             if (this.m_pStatus < -1)
  1910.             {
  1911.                 this.m_pStatus = -212;            //没有数据
  1912.             }
  1913.             strSQL = "select * from tb_Project";
  1914.             if (this.m_pType != -1)
  1915.                 strSQL = strSQL + " where ProjectType=" + this.m_pType;
  1916.             if (this.m_pStatus != -1)
  1917.             {
  1918.                 if (this.m_pType != -1)
  1919.                     strSQL = strSQL + " and Status=" + this.m_pStatus;
  1920.                 else
  1921.                     strSQL = strSQL + " where Status=" + this.m_pStatus;
  1922.             }
  1923.             try