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

.net编程

开发平台:

C#

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using com.etong.IDAL;
  5. using com.etong.Model;
  6. using com.etong.DBUtility;
  7. using System.Data;
  8. using System.Data.SqlClient;
  9. using com.etong.SqlDataConnect;
  10. using com.etong.BusinessRule.Zwf;
  11. using System.Xml;
  12. using System.Collections;
  13. namespace com.etong.DAL
  14. {
  15.     #region 角色管理类
  16.     public class RoleManage:IRole
  17.     {
  18.         public void AddPermissionToRole(int permissionid, int roleid, int permissionType, string fromDate, string toDate)
  19.         {
  20.             string strSqlText = "Insert into Tb_Sys_RolePerm([RoleID],[PermissionID],[EditDate],[PermissionType],[FromDate],[ToDate])values(" + roleid + "," + permissionid + ",getDate()," + permissionType + ",'" + fromDate + "','" + toDate + "')";
  21.             try
  22.             {
  23.                 SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  24.             }
  25.             catch (Exception ex)
  26.             {
  27.                 throw new Exception(ex.Message);
  28.             }
  29.         }
  30.         public bool AddRole(RoleInfo roleinfo)
  31.         {
  32.             string strSqlText = "Insert into Tb_Sys_Role([RoleName],[RoleDesc],[OrdInal],[CreateRole],[UserRole])values('" + roleinfo.RoleName + "','" + roleinfo.RoleDesc + "'," + roleinfo.OrdInal + "," + roleinfo.CreateRole + "," + roleinfo.UserRole + ")";
  33.             try
  34.             {
  35.                 SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  36.                 return true;
  37.             }
  38.             catch
  39.             {
  40.                 return false;
  41.             }
  42.         }
  43.         public void AddRoleToUser(int roleid, int userid)
  44.         {
  45.             string strSqlText = "Insert into Tb_Sys_UserRole([UserID],[RoleID],[EditDate])values(" + userid + "," + roleid + ",getDate())";
  46.             try
  47.             {
  48.                 SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  49.             }
  50.             catch (Exception ex)
  51.             {
  52.                 throw new Exception(ex.Message);
  53.             }
  54.         }
  55.         public bool DeleteRole(int roleid)
  56.         {
  57.             string strSqlText = "select * from Tb_Sys_Role where [CreateRole]=" + roleid;
  58.             DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  59.             if (dt.Rows.Count > 0)
  60.             {
  61.                 return false;
  62.             }
  63.             strSqlText = "select * from [tb_Colony_User] where [RoleID]=" + roleid;
  64.             dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  65.             if (dt.Rows.Count > 0)
  66.             {
  67.                 return false;
  68.             }
  69.             strSqlText = "Delete from Tb_Sys_Role where RoleID=" + roleid;
  70.             try
  71.             {
  72.                 SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  73.                 return true;
  74.             }
  75.             catch
  76.             {
  77.                 return false;
  78.             }
  79.         }
  80.         public void DeletePermissionInPermissionRole(int roleid)
  81.         {
  82.             string strSqlText = "Delete from Tb_Sys_RolePerm where RoleID=" + roleid;
  83.             try
  84.             {
  85.                 SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  86.             }
  87.             catch (Exception ex) 
  88.             {
  89.                 throw new Exception(ex.Message);
  90.             }
  91.         }
  92.         public DataTable GetAllRoles()
  93.         {
  94.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, "select r.[roleid],r.[rolename],r.[roledesc],rr.[rolename] createrole from Tb_Sys_Role r inner join Tb_Sys_Role rr on r.[createrole]=rr.[roleid]", null);
  95.         }
  96.         public DataTable GetPermissionList()
  97.         {
  98.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, "select [PermID],[DisplayName] from Tb_Sys_Permission", null);
  99.         }
  100.         public DataTable GetPermissionList(int RoleID)
  101.         {
  102.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, "select p.PermID,p.DisplayName from Tb_Sys_RolePerm as rp,Tb_Sys_Permission as p where rp.PermissionID=p.PermID and rp.RoleID=" + RoleID, null);
  103.         }
  104.         public DataTable GetUserPerissionList(int userid, string sAccount, int rightType)
  105.         {
  106.             //string strSqlText = "select p.[PermID],p.[DisplayName],p.[DefaultPage] from Tb_Sys_Permission p where PermID in(select PermissionID from Tb_Sys_RolePerm where RoleID in (select RoleID from Tb_Sys_UserRole where UserID=" + userid + ")) and ParentresCode=" + rightType;
  107.            // return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  108.             string strSqlText;
  109.             if ((sAccount == "admin" || sAccount == "Admin") && rightType == 1)
  110.             {
  111.                 strSqlText = "select p.[PermID],p.[DisplayName],p.[DefaultPage] from Tb_Sys_Permission p where ParentresCode=" + rightType;
  112.             }
  113.             else
  114.                 strSqlText = "select p.[PermID],p.[DisplayName],p.[DefaultPage] from Tb_Sys_Permission p where PermID in(select PermissionID from Tb_Sys_RolePerm where RoleID in (select RoleID from Tb_Sys_UserRole where UserID=" + userid + ")) and ParentresCode=" + rightType;
  115.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  116.         }
  117.         public DataTable GetRoleByConditions(int roleType, string searchContent, bool isBlurSearch)
  118.         {
  119.             string strSqlText = "select r.[roleid],r.[rolename],r.[roledesc],rr.[rolename] createrole from Tb_Sys_Role r inner join Tb_Sys_Role rr on r.[createrole]=rr.[roleid] where ";
  120.             if (isBlurSearch)//模糊查询
  121.             {
  122.                 switch (roleType)
  123.                 {
  124.                     case 1://角色名称
  125.                         strSqlText = strSqlText + "r.[RoleName] like '%" + searchContent + "%'";
  126.                         goto Label_00B9;
  127.                     case 2://创建者
  128.                         strSqlText = strSqlText + "rr.[RoleName] like '%" + searchContent + "%'";
  129.                         goto Label_00B9;
  130.                     case 3://使用者
  131.                         strSqlText = strSqlText + "rrr.[RoleName] like '%" + searchContent + "%'";
  132.                         goto Label_00B9;
  133.                 }
  134.             }
  135.             else//精确查询
  136.             {
  137.                 switch (roleType)
  138.                 {
  139.                     case 1:
  140.                         strSqlText = strSqlText + "r.[RoleName] ='" + searchContent + "'";
  141.                         goto Label_00B9;
  142.                     case 2:
  143.                         strSqlText = strSqlText + "rr.[RoleName] ='" + searchContent + "'";
  144.                         goto Label_00B9;
  145.                     case 3:
  146.                         strSqlText = strSqlText + "rrr.[RoleName] ='" + searchContent + "'";
  147.                         goto Label_00B9;
  148.                 }
  149.             }
  150.         Label_00B9:
  151.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  152.         }
  153.         public DataTable GetRoleByID(int id)
  154.         {
  155.             string strSqlText = "select * from Tb_Sys_Role where RoleID=" + id;
  156.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  157.         }
  158.         public bool UpdateRole(RoleInfo roleinfo)
  159.         {
  160.             string strSqlText = "Update Tb_Sys_Role set RoleName='" + roleinfo.RoleName + "',RoleDesc='" + roleinfo.RoleDesc + "',OrdInal=" + roleinfo.OrdInal + ",CreateRole=" + roleinfo.CreateRole + ",UserRole=" + roleinfo.UserRole + "where RoleID=" + roleinfo.RoleID;
  161.             try
  162.             {
  163.                 SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  164.                 return true;
  165.             }
  166.             catch
  167.             {
  168.                 return false;
  169.             }
  170.         }
  171.     }
  172.     #endregion
  173.     #region 工程项目实施类
  174.     public class ProjectImplment :IProjectImplement
  175.     {
  176.         /// <summary>
  177.         /// 获取工程项目列表
  178.         /// </summary>
  179.         /// <returns></returns>
  180.         public DataTable GetAllProjects()
  181.         {
  182.             string strSqlText = "select * from tb_Project where status=1";
  183.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
  184.         }
  185.         public DataTable GetProjectByID(int id)
  186.         {
  187.             string strsqltext = "select * from [tb_project] where [ProjectID]=" + id;
  188.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  189.         }
  190.         /// <summary>
  191.         /// 
  192.         /// </summary>
  193.         /// <param name="constructid"></param>
  194.         /// <returns></returns>
  195.         public DataTable GetConstructByID(int constructid)
  196.         {
  197.             string strsqltext = "select * from [tb_construct] where [ConID]=" + constructid;
  198.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  199.         }
  200.         /// <summary>
  201.         /// 
  202.         /// </summary>
  203.         /// <returns></returns>
  204.         public DataTable GetAllConstructs()
  205.         {
  206.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "p_construct_getAll", null);
  207.         }
  208.         /// <summary>
  209.         /// 获取指定ID工程项目
  210.         /// </summary>
  211.         /// <param name="ProjectID"></param>
  212.         /// <param name="isGetlist">表示是否要得到明细纪录</param>
  213.         /// <returns></returns>
  214.         public DataSet GetProjectByID(int ProjectID, bool isGetlist)
  215.         {
  216.             SqlParameter[] parameters ={
  217.                 new SqlParameter("@projectid",SqlDbType.Int,4),
  218.                 new SqlParameter ("@isgetlist",SqlDbType.Bit,1)
  219.             };
  220.             parameters[0].Value = ProjectID;
  221.             parameters[1].Value = isGetlist;
  222.             
  223.             return SqlHelper.ExecuteDataSet(SqlHelper.connectionString, CommandType.StoredProcedure, "p_Project_GetByID", parameters);
  224.         }
  225.         /// <summary>
  226.         /// 添加客户信息,返回"0"表示添加成功
  227.         /// </summary>
  228.         /// <param name="clientinfo"></param>
  229.         public int AddClient(ClientInfo clientinfo)
  230.         {
  231.             SqlParameter[] parameters ={ 
  232.                 new SqlParameter ("@ClientWorkUnit",SqlDbType.VarChar ,14),
  233.                 new SqlParameter ("@MateWorkUnit",SqlDbType.VarChar ,14),
  234.                 new SqlParameter ("@Number",SqlDbType.VarChar ,20),
  235.                 new SqlParameter ("@ClientNote",SqlDbType .VarChar ,200),
  236.                 new SqlParameter ("@ClientResidence",SqlDbType.VarChar,200),
  237.                 new SqlParameter ("@ClientDegreeID",SqlDbType.Int,4),
  238.                 new SqlParameter ("@ClientBirthday",SqlDbType.NVarChar ,20),
  239.                 new SqlParameter ("@ClientHomeAddress",SqlDbType .VarChar ,200),
  240.                 new SqlParameter ("@ClientIDCard",SqlDbType .VarChar ,30),
  241.                 new SqlParameter ("@ClientMale",SqlDbType .Int ,4),
  242.                 new SqlParameter ("@ClientMarriage",SqlDbType .Int ,4),
  243.                 new SqlParameter ("@ClientName",SqlDbType .VarChar ,20),
  244.                 new SqlParameter ("@ClientTelNum",SqlDbType .VarChar, 100),
  245.                 new SqlParameter ("@Salary",SqlDbType.Decimal ,12),
  246.                 new SqlParameter ("@MateNote",SqlDbType .VarChar ,200),
  247.                 new SqlParameter ("@MateResidence",SqlDbType.VarChar ,200),
  248.                 new SqlParameter ("@MateBirthday",SqlDbType.NVarChar ,20),
  249.                 new SqlParameter ("@MateDegree",SqlDbType.Int ,4),
  250.                 new SqlParameter ("@MateHomeAddress",SqlDbType.VarChar ,200),
  251.                 new SqlParameter ("@MateIDCard",SqlDbType.VarChar ,30),
  252.                 new SqlParameter ("@MateMale",SqlDbType.Int,4),
  253.                 new SqlParameter ("@MateName",SqlDbType.VarChar,20),
  254.                 new SqlParameter ("@MateSalary",SqlDbType.Decimal ,12),
  255.                 new SqlParameter ("returnValue",SqlDbType.Int,4)
  256.             };
  257.             parameters[0].Value = clientinfo.ClientWorkUnit;
  258.             parameters[1].Value = clientinfo.MateWorkUnit;
  259.             parameters[2].Value = clientinfo.Number;
  260.             parameters[3].Value = clientinfo.ClientNote;
  261.             parameters[4].Value = clientinfo.ClientRedience;
  262.             parameters[5].Value = clientinfo.ClientDegreeID;
  263.             parameters[6].Value = clientinfo.ClientBirthday;
  264.             parameters[7].Value = clientinfo.HomeAddress;
  265.             parameters[8].Value = clientinfo.IdentityCard;
  266.             parameters[9].Value = clientinfo.ClientMale;
  267.             parameters[10].Value = clientinfo.ClientMarriage;
  268.             parameters[11].Value = clientinfo.ClientName;
  269.             parameters[12].Value = clientinfo.ClientTelNum;
  270.             parameters[13].Value = clientinfo.Salary;
  271.             parameters[14].Value = clientinfo.MateNote;
  272.             parameters[15].Value = clientinfo.MateRedience;
  273.             parameters[16].Value = clientinfo.MateBirthday;
  274.             parameters[17].Value = clientinfo.MateDegreeID;
  275.             parameters[18].Value = clientinfo.MateHomeAddress;
  276.             parameters[19].Value = clientinfo.MateIdentityCard;
  277.             parameters[20].Value = clientinfo.MateMale;
  278.             parameters[21].Value = clientinfo.MateName;
  279.             parameters[22].Value = clientinfo.Salary;
  280.             parameters[23].Direction = ParameterDirection.ReturnValue;
  281.             
  282.             SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "p_WF_Client_ADD", parameters);
  283.             return (int)parameters[23].Value;
  284.         }
  285.         /// <summary>
  286.         /// 添加项目施工信息,返回"0"表示添加失败,否则成功
  287.         /// </summary>
  288.         /// <param name="constructinfo"></param>
  289.         /// <returns></returns>
  290.         public int AddConstruct(ConstructInfo constructinfo)
  291.         {
  292.              SqlParameter[] parameters ={ 
  293.                  new SqlParameter("@ConID",SqlDbType.Int,4),
  294.                  new SqlParameter("@ConName",SqlDbType.VarChar,200),
  295.                  new SqlParameter("@ConSort",SqlDbType.VarChar,2),
  296.                  new SqlParameter("@JcKgName",SqlDbType.VarChar,100),
  297.                  new SqlParameter("@JcWZTransactor",SqlDbType.VarChar,30),
  298.                  new SqlParameter("@JcWZFName",SqlDbType.VarChar,100),
  299.                  new SqlParameter("@WZTransactor",SqlDbType.VarChar,30),
  300.                  new SqlParameter("@WZFName",SqlDbType.VarChar,100),
  301.                  new SqlParameter("@JcZTransactor",SqlDbType.VarChar,30),
  302.                  new SqlParameter("@JcZFName",SqlDbType.VarChar,100),
  303.                  new SqlParameter("@ZgJdTransactor",SqlDbType.VarChar,30),
  304.                  new SqlParameter("@ZgJdIdea",SqlDbType.VarChar,200),
  305.                  new SqlParameter("@ZgXdTransactor",SqlDbType.VarChar,30),
  306.                  new SqlParameter("@ZgXdIdea",SqlDbType.VarChar,100),
  307.                  new SqlParameter("@JcSBTransactor",SqlDbType.VarChar,30),
  308.                  new SqlParameter("@JcSBFName",SqlDbType.VarChar,100),
  309.                  new SqlParameter("@ZgHzTransactor",SqlDbType.VarChar,30),
  310.                  new SqlParameter("@ZgHzFName",SqlDbType.VarChar,100),
  311.                  new SqlParameter("@GcglTransactor",SqlDbType.VarChar,30),
  312.                  new SqlParameter("@GcglFName",SqlDbType.VarChar,100),
  313.                  new SqlParameter("@JcSJTransactor",SqlDbType.VarChar,30),
  314.                  new SqlParameter("@JcSJFName",SqlDbType.VarChar,100),
  315.                  new SqlParameter("@WZFjTransactor",SqlDbType.VarChar,30),
  316.                  new SqlParameter("@WZFjFName",SqlDbType.VarChar,100),
  317.                  new SqlParameter("@Status",SqlDbType.Int,4),
  318.                  new  SqlParameter("@DocumentXml",SqlDbType.VarChar ,50)
  319.              };
  320.              parameters[0].Direction = ParameterDirection.Output;
  321.              parameters[1].Value = constructinfo.Conname;
  322.              parameters[2].Value = constructinfo.Consort;
  323.              parameters[3].Value = constructinfo.JcKgName;
  324.              parameters[4].Value = constructinfo.JcWZTransator;
  325.              parameters[5].Value = constructinfo.JcWZName;
  326.              parameters[6].Value = constructinfo.WzTransator;
  327.              parameters[7].Value = constructinfo.WzName;
  328.              parameters[8].Value = constructinfo.JcZTransator;
  329.              parameters[9].Value = constructinfo.JcZName;
  330.              parameters[10].Value = constructinfo.ZgJdTransator;
  331.              parameters[11].Value = constructinfo.ZgJdIdea;
  332.              parameters[12].Value = constructinfo.ZgXdTransator;
  333.              parameters[13].Value = constructinfo.ZgXdIdea;
  334.              parameters[14].Value = constructinfo.JcSBTransator;
  335.              parameters[15].Value = constructinfo.JcSBFName;
  336.              parameters[16].Value = constructinfo.ZgHzTransator;
  337.              parameters[17].Value = constructinfo.ZgHzFName;
  338.              parameters[18].Value = constructinfo.GcglTransator;
  339.              parameters[19].Value = constructinfo.GcglName;
  340.              parameters[20].Value = constructinfo.JcSJTranstor;
  341.              parameters[21].Value = constructinfo.JcSJFName;
  342.              parameters[22].Value = constructinfo.WZFjTransator;
  343.              parameters[23].Value = constructinfo.WZFjName;
  344.              parameters[24].Value = constructinfo.Status;
  345.              parameters[25].Value = constructinfo.DocumentXML;
  346.              SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "p_Construct_ADD", parameters);
  347.              return (int)parameters[0].Value;
  348.         }
  349.         /// <summary>
  350.         /// 编辑项目施工信息,返回"0"表示更新成功
  351.         /// </summary>
  352.         /// <param name="constructinfo"></param>
  353.         /// <returns></returns>
  354.         //public int UpdateConstruct(ConstructInfo constructinfo)
  355.         //{
  356.         //    SqlParameter[] parameters ={ 
  357.         //         new SqlParameter("@ConID",SqlDbType.Int,4),
  358.         //         new SqlParameter("@PrjID",SqlDbType.Int,4),
  359.         //         new SqlParameter("@TaskSort",SqlDbType.Int,4),
  360.         //         new SqlParameter("@MatRej",SqlDbType.Int,4),
  361.         //         new SqlParameter("@Rej_ChargeMachine",SqlDbType.Decimal,14),
  362.         //         new SqlParameter("@Rej_ChargeManPower",SqlDbType.Decimal,14),
  363.         //         new SqlParameter("@Rej_ChargeOther",SqlDbType.Decimal,14),
  364.         //         new SqlParameter("@Rej_ChargeStuff",SqlDbType.Decimal,14),
  365.         //         new SqlParameter("@Rej_ChargeSum",SqlDbType.Decimal,15),
  366.         //         new SqlParameter("@Rej_TransactorIdea",SqlDbType.VarChar,800),
  367.         //         new SqlParameter("@Rej_TransactorSignature",SqlDbType.VarChar,20),
  368.         //         new SqlParameter("@Fg_TransactorIdea",SqlDbType.VarChar,200),
  369.         //         new SqlParameter("@Fg_TransactorSignature",SqlDbType.VarChar,20),
  370.         //         new SqlParameter("@Zjl_TransactorIdea",SqlDbType.VarChar,200),
  371.         //         new SqlParameter("@Zjl_TransactorSignature",SqlDbType.VarChar,20),
  372.         //         new SqlParameter("@Mat_Stock",SqlDbType.VarChar,200),
  373.         //         new SqlParameter("@Mat_Grant",SqlDbType.VarChar,200),
  374.         //         new SqlParameter("@Ent_AccountMon",SqlDbType.VarChar,200),
  375.         //         new SqlParameter("@Ent_AddAccount",SqlDbType.Decimal,14),
  376.         //         new SqlParameter("@Ent_Account",SqlDbType.Int,4),
  377.         //         new SqlParameter("@StartWorking",SqlDbType.Int,4),
  378.         //         new SqlParameter("@DrawMat",SqlDbType.Int,4),
  379.         //         new SqlParameter("@PlanFile",SqlDbType.VarChar,100),
  380.         //         new SqlParameter("@ClientInfo",SqlDbType.VarChar,20),
  381.         //         new SqlParameter("@FinishFile",SqlDbType.VarChar,100),
  382.         //         new SqlParameter("@Ys_Manager",SqlDbType.VarChar,20),
  383.         //         new SqlParameter("@YsW_Idea",SqlDbType.VarChar,200),
  384.         //         new SqlParameter("@YsW_Manager",SqlDbType.VarChar,20),
  385.         //         new SqlParameter("@PactFile",SqlDbType.VarChar,100),
  386.         //         new SqlParameter("@PactSq",SqlDbType.VarChar,20),
  387.         //         new SqlParameter("@PactSqIdea",SqlDbType.VarChar,200),
  388.         //         new SqlParameter("@ConStatus",SqlDbType.Int,4),
  389.         //         new SqlParameter("returnValue",SqlDbType.Int,4)
  390.         //     };
  391.         //    parameters[0].Value = constructinfo.ConstructID;
  392.         //    parameters[1].Value = constructinfo.ProjectID;
  393.         //    parameters[2].Value = constructinfo.TaskType;
  394.         //    parameters[3].Value = constructinfo.isChangeMaterial;
  395.         //    parameters[4].Value = constructinfo.Rej_ChargeMachine;
  396.         //    parameters[5].Value = constructinfo.Rej_ChargeManpower;
  397.         //    parameters[6].Value = constructinfo.Rej_ChargeOther;
  398.         //    parameters[7].Value = constructinfo.Rej_ChargeStuff;
  399.         //    parameters[8].Value = constructinfo.Rej_ChargeSum;
  400.         //    parameters[9].Value = constructinfo.Rej_TransactorIdea;
  401.         //    parameters[10].Value = constructinfo.Rej_TransactorSignature;
  402.         //    parameters[11].Value = constructinfo.Fg_TransactorIdea;
  403.         //    parameters[12].Value = constructinfo.Fg_TransactorSignature;
  404.         //    parameters[13].Value = constructinfo.Zjl_TransactorIdea;
  405.         //    parameters[14].Value = constructinfo.Zjl_TransactorSignature;
  406.         //    parameters[15].Value = constructinfo.MatStock;
  407.         //    parameters[16].Value = constructinfo.MatGrant;
  408.         //    parameters[17].Value = constructinfo.EntAccountMon;
  409.         //    parameters[18].Value = constructinfo.EntAddAccount;
  410.         //    parameters[19].Value = constructinfo.EntAccount;
  411.         //    parameters[20].Value = constructinfo.StartWorking;
  412.         //    parameters[21].Value = constructinfo.DrawMat;
  413.         //    parameters[22].Value = constructinfo.PlanFile;
  414.         //    parameters[23].Value = constructinfo.ClientInfo;
  415.         //    parameters[24].Value = constructinfo.FinishFile;
  416.         //    parameters[25].Value = constructinfo.Ys_Manager;
  417.         //    parameters[26].Value = constructinfo.Ysw_Idea;
  418.         //    parameters[27].Value = constructinfo.Ysw_Manager;
  419.         //    parameters[28].Value = constructinfo.PactFile;
  420.         //    parameters[29].Value = constructinfo.PactSq;
  421.         //    parameters[30].Value = constructinfo.PactSqIdea;
  422.         //    parameters[31].Value = constructinfo.ConStatus;
  423.         //    parameters[32].Direction = ParameterDirection.ReturnValue;
  424.         //    SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.StoredProcedure, "p_Construct_Update", parameters);
  425.         //    return (int)parameters[32].Value;
  426.         //}
  427.         //修改项目表里的纪录状态
  428.         public void ChangeStatus(int projectid, int statusValue)
  429.         {
  430.             SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, "update [tb_Project] set [Status]= " + statusValue + " where [ProjectID]=" + projectid, null);
  431.         }
  432.         //确定施工表里的施工类型
  433.         public void ConfirmConstructTaskType(int constructid, int tasktype)
  434.         {
  435.             SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, "update [tb_construct] set [TaskSort]= " + tasktype + " where [ConID]=" + constructid, null);
  436.         }
  437.         public int GetProjectID(int constructid)
  438.         {
  439.             DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, "select [PrjID] from [tb_construct] where [ConID]=" + constructid, null);
  440.             if (dt.Rows.Count > 0)
  441.             {
  442.                 return Convert.ToInt32(dt.Rows[0]["PrjID"].ToString());
  443.             }
  444.             else
  445.             {
  446.                 return -1;
  447.             }
  448.         }
  449.         public void UpdateTransactorSignature(int constructid,string TransactorSignature)
  450.         {
  451.             string strsqltext = "update [tb_construct] set [Rej_TransactorSignature]='" + TransactorSignature + "' where [ConID]=" + constructid;
  452.             SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  453.         }
  454.         //修改项目的资金情况(工程实施表与项目表同步修改)
  455.         public void UpdateMoney(int constructid, decimal chargemachine, decimal chargemanpower, decimal chargeother, decimal chargestuff, decimal chargesum, string changeman)
  456.         {
  457.             string strsqltext1 = "update [tb_construct] set [Rej_ChargeMachine]=" + chargemachine + ",[Rej_ChargeManPower]=" + chargemanpower + ",[Rej_ChargeOther]=" + chargeother + ",[Rej_ChargeStuff]=" + chargestuff + ",[Rej_ChargeSum]=" + chargesum + ",[Rej_TransactorSignature]=" + changeman + " where [ConID]=" + constructid;
  458.             int projectid = GetProjectID(constructid);
  459.             string strsqltext2 = "update [tb_Project] set [ChargeMachine]=" + chargemachine + ",[ChargeManPower]=" + chargemanpower + ",[ChargeOther]=" + chargeother + ",[ChargeStuff]=" + chargestuff + ",[ChargeSum]=" + chargesum + " where [ProjectID]=" + projectid;
  460.             SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext1, null);
  461.             SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext2, null);
  462.         }
  463.         //分管领导审核
  464.         public void UpdateFg_TransactorIdea(int constructid, string Fg_TransactorIdea, string Fg_TransactorSignature)
  465.         {
  466.             string strsqltext = "update [tb_construct] set [Fg_TransactorIdea]='" + Fg_TransactorIdea + "',[Fg_TransactorSignature]='" + Fg_TransactorSignature + "' where [ConID]=" + constructid;
  467.             SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  468.         }
  469.         //总经理审核
  470.         public void UpdateZjl_TransactorIdea(int constructid, string Zjl_TransactorIdea, string Zjl_TransactorSignature)
  471.         {
  472.             string strsqltext = "update [tb_construct] set [Zjl_TransactorIdea]='" + Zjl_TransactorIdea + "',[Zjl_TransactorSignature]='" + Zjl_TransactorSignature + "' where [ConID]=" + constructid;
  473.             SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  474.         }
  475.         //flag为1为物资部门采购情况2为物资发放情况
  476.         public void UpdateMaterialStock(int constructid, string content, int flag)
  477.         {
  478.             string strsqltext=null;
  479.             switch (flag)
  480.             {
  481.                 case 1:
  482.                     strsqltext = "update [tb_construct] set [Mat_Stock]='" + content + "' where [ConID]=" + constructid; break;
  483.                 case 2:
  484.                     strsqltext = "update [tb_construct] set [Mat_Grant]='" + content + "' where [ConID]=" + constructid; break;
  485.             }   
  486.             SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  487.         }
  488.         public void UpdateContactAuthorzationIdea(int coustructid, string PactSqIdea, string PactSq)
  489.         {
  490.             string strsqltext = "update [tb_construct] set [PactSqIdea]='" + PactSqIdea + "',[PactSq]='" + PactSq + "' where [ConID]=" + coustructid;
  491.             SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  492.         }
  493.         public void UpdatePlanFile(int constructid, string planfile)
  494.         {
  495.             string strsqltext = "update [tb_construct] set [PlanFile]='" + planfile + "'";
  496.             SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  497.         }
  498.         public  void UpdateFinishFile(int constructid, string finishfile)
  499.         {
  500.             string strsqltext = "update [tb_construct] set [FinishFile]='" + finishfile + "'";
  501.             SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  502.         }
  503.         public void UpdateProjectDocumentBack(int constructid, string clientinfo, string pactfile, string Ys_Manager, string YsW_Idea, string YsW_Manager)
  504.         {
  505.             string strsqltext = "update [tb_construct] set [ClientInfo]='" + clientinfo + "',[PactFile]='" + pactfile + "',[Ys_Manager]='" + Ys_Manager + "',[YsW_Idea]='" + YsW_Idea + "',[YsW_Manager]='" + YsW_Manager + "' where [ConID]=" + constructid;
  506.             SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  507.         }
  508.         public void  UpdateStartWorking(int constructid, string working, int startworking, int drawmat)
  509.         {
  510.             string strsqltext = "update [tb_construct] set [StartWorking]=" + startworking + ",[Working]='" + working + "',[DrawMat]='" + drawmat + "' where [ConID]=" + constructid;
  511.             SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  512.         }
  513.         public DataTable GetDepartmentByID(int id)
  514.         {
  515.             string strsqltext = "select * from [Tb_Sys_Organization] where [OrgID]=" + id;
  516.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  517.         }
  518.         public DataTable GetNextOperatorRole(int CurrOpId)
  519.         {
  520.             string strsqltext = "select * from [Tb_Sys_OpRole] where [OpID]=" + CurrOpId;
  521.             return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  522.         }
  523.         public static string getTaskSortForString(int constructid)
  524.         {
  525.             string sqlText = "select [TaskSort] from [tb_construct] where [ConID]=" + constructid;
  526.             string returnString = null;
  527.             DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, sqlText, null);
  528.             if (dt.Rows.Count > 0)
  529.             {
  530.                 switch (Convert.ToInt32 (dt .Rows [0]["TaskSort"].ToString ()))
  531.                 {
  532.                     case 1: returnString = "自营"; break;
  533.                     case 2: returnString = "半委托"; break;
  534.                     case 3: returnString = "全委托"; break;
  535.                     case 4: returnString = "外委"; break;
  536.                 }
  537.             }
  538.             return returnString;
  539.         }
  540.         public static string getMatRejForString(int constructid)
  541.         {
  542.             string sqlText = "select [MatRej] from [tb_construct] where [ConID]=" + constructid;
  543.             string returnString = null;
  544.             DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, sqlText, null);
  545.             if (dt.Rows.Count > 0)
  546.             {
  547.                 switch (Convert.ToInt32(dt.Rows[0]["MatRej"].ToString()))
  548.                 {
  549.                     case 5: returnString = "更改材料"; break;
  550.                     case 6: returnString = "不更改材料"; break;
  551.                 }
  552.             }
  553.             return returnString;
  554.         }
  555.         public static string GetEmpType(int EmpID)
  556.         {
  557.             string strEmpType = "";
  558.             DataView dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, "select [EmpType] from [Tb_Sys_Employee] where [EmpID]=" + EmpID, null).DefaultView;
  559.             if (dv.Count > 0)
  560.             {
  561.                 strEmpType = dv[0]["EmpType"].ToString();
  562.             }
  563.             return strEmpType;
  564.         }
  565.         public DataView GetStructureStatus()
  566.         {
  567.             DataView dv = null;
  568.             DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "P_GetStructureStatus", null);
  569.             if (dt != null)
  570.             {
  571.                 dv = dt.DefaultView;
  572.             }
  573.             return dv;
  574.         }
  575.         public DataView GetStructureAllStatus(int ConID)
  576.         {
  577.             DataView dv = null;
  578.             SqlParameter parameterConID = new SqlParameter("@ConID", SqlDbType.Int, 4);
  579.             parameterConID.Value = ConID;
  580.             DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "P_GetSturctureAllStatus", parameterConID);
  581.             if (dt != null)
  582.                 dv = dt.DefaultView;
  583.             return dv;
  584.         }
  585.     }
  586.     #endregion
  587.     #region 工作流操作类
  588.     public class WorkFolw
  589.     {
  590.         private MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
  591.         private EtongZwf etongzwf = new EtongZwf();
  592.         /*=======================================================================================
  593.          * 
  594.          *                           获取工作流起始活动.
  595.          * 
  596.          *======================================================================================= */
  597.         public int ActivityIDGetByWFID(int WfId)
  598.         {
  599.             DataView dvActivity = etongzwf.GetActivityByWFID(WfId);
  600.             if (dvActivity.Count != 0)
  601.             {
  602.                 int activity = Convert.ToInt32(dvActivity[0][0].ToString().Trim());
  603.                 return activity;
  604.             }
  605.             else
  606.                 return 0;
  607.         }
  608.         /*=======================================================================================
  609.          * 
  610.          *                           提交到下一个角色用户申核.
  611.          * 
  612.          *======================================================================================= */
  613.         public string NextColonyRole(int actinsid, int WFInstanceID)
  614.         {
  615.             DataView dvActRole = etongzwf.ColonyUserGetByActId(actinsid);
  616.             if (dvActRole.Count > 0)
  617.             {
  618.                 int ActivityIDNext = Convert.ToInt32(dvActRole[0][0].ToString().Trim());
  619.                 int RoleID = Convert.ToInt32(dvActRole[0][2].ToString().Trim());
  620.                 WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, ActivityIDNext, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  621.                                                                 0, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, "", -1, RoleID);
  622.                 int returnValue = etongzwf.WFActInsADD(wfactinsinfo);
  623.                 if (returnValue > 0)
  624.                 {
  625.                     DataView dvRoleName = etongzwf.RoleGetName(RoleID);
  626.                     if (dvActRole.Count != 0)
  627.                     {
  628.                         return dvRoleName[0][0].ToString();
  629.                     }
  630.                     else
  631.                     {
  632.                         return "-1";
  633.                     }
  634.                 }
  635.                 else
  636.                 {
  637.                     return "-1";
  638.                 }
  639.             }
  640.             else // 不存在上级活动,将 活动状态(Status) 改为 "完成"   注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
  641.             {
  642.                 bool ReValueAIUpdata = false;
  643.                 ReValueAIUpdata = etongzwf.WFActInsUpdata(actinsid, 1);
  644.                 return "-2";
  645.             }
  646.         }
  647.         /*=======================================================================================
  648.          * 
  649.          *                           改变当前工作流活动实例状态.
  650.          * 
  651.          *======================================================================================= */
  652.         public bool WFActInsUpdata(int actinsid, int status, int userid)
  653.         {
  654.             QueryParameterCollection Params = new QueryParameterCollection();
  655.             Params.Clear();
  656.             Params.Add("@actinsid", actinsid);
  657.             Params.Add("@status", status);
  658.             Params.Add("@userid", userid);
  659.             string sSQL = "update [tb_WF_ActIns]  Set [Status]=@status,[UserID]=@userid where [ActInsID]=@actinsid";
  660.             MSDA.Open();
  661.             NewObj newobject = new NewObj();
  662.             bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
  663.             MSDA.Close();
  664.             return returnvalue;
  665.         }
  666.         /*================================================================================================================
  667.          * 
  668.          *                          判断当前工作流活动实例状态(0、正常;1、完成(审核通过);2、回退;3、回退并完成;4、作废)
  669.          * 
  670.          *=============================================================================================================== */
  671.         public static int GetCurrentActivityInstanceStatus(int actinsid)
  672.         {
  673.             string sql = "Select [Status] from [tb_WF_ActIns] where [ActInsID]=" + actinsid;
  674.             DataView dv = SqlServer.GetDataView(sql);
  675.             int tempStatus = 0;
  676.             if (dv.Count > 0)
  677.             {
  678.                 tempStatus = Convert.ToInt32(dv[0]["Status"].ToString());
  679.             }
  680.             return tempStatus;
  681.         }
  682.         /*================================================================================================================
  683.         * 
  684.         *                          找出部门的业务角色的类型(1 科技 2 生产 3 营销 99 未知)
  685.         * 
  686.         *=============================================================================================================== */
  687.         public static string GetOrgOpRoleType(int OpID)
  688.         {
  689.             string sql = "select [OrgDesc] from [Tb_Sys_OpRole] where [OpID]=" + OpID;
  690.             DataView dv = SqlServer.GetDataView(sql);
  691.             int type = -1;
  692.             if (dv.Count > 0)
  693.             {
  694.                 try
  695.                 {
  696.                     type = Convert.ToInt32(dv[0]["OrgDesc"].ToString().Trim());
  697.                 }
  698.                 catch
  699.                 {
  700.                     type = 99;
  701.                 }
  702.             }
  703.             return type.ToString();
  704.         }
  705.         public static string GetBlockReason(int acinstanceid)
  706.         {
  707.             string sql = "select [BlockReason] from [tb_WF_ActIns] where [ActInsID]=" + acinstanceid;
  708.             DataView dv = SqlServer.GetDataView(sql);
  709.             string s = "";
  710.             if (dv.Count > 0)
  711.             {
  712.                 s = dv[0]["BlockReason"].ToString();
  713.             }
  714.             return s;
  715.         }
  716.         public static bool ParentActivitysIsCompleted(int PrjID, int ActivityID)
  717.         {
  718.             int tempCount = 0;
  719.             string sql = "select * from tb_wf_actins where wfinstanceid in" +
  720.                             "(select wfinstanceid from tb_wf_instance where prjid=" + PrjID + " and status=2) and activityid in " +
  721.                              "(select parentactid from tb_colony_user where activityid =" + ActivityID + ")";
  722.             //return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
  723.             DataView dv = SqlServer.GetDataView(sql);
  724.             if (dv.Count > 0)
  725.             {
  726.                 for (int i = 0; i < dv.Count; i++)
  727.                 {
  728.                     tempCount += Convert.ToInt32(dv[i]["Status"].ToString().Trim());
  729.                 }
  730.             }
  731.             return (tempCount == dv.Count) ? true : false;
  732.         }
  733.     }
  734.     #endregion
  735.     #region XML操作类
  736.     public class XML
  737.     {
  738.         private XmlDocument xmlDocument;
  739.         private XmlElement xmlElement;
  740.         private string xmlFileName;
  741.         public XML()
  742.         {
  743.         }
  744.         public XML(string xmlFileName)
  745.         {
  746.             this.xmlFileName = xmlFileName;
  747.             xmlDocument = new XmlDocument();
  748.             xmlDocument.Load(xmlFileName);
  749.         }
  750.         public bool CreateXMLDocument(string xmlFileName)
  751.         {
  752.             try
  753.             {
  754.                 string str = "<?xml  version="1.0"   encoding="utf-8"   ?><Documents></Documents>";
  755.                 xmlDocument = new XmlDocument();
  756.                 xmlDocument.LoadXml(str);
  757.                 xmlDocument.Save(xmlFileName);
  758.                 return true;
  759.             }
  760.             catch
  761.             {
  762.                 return false;
  763.             }
  764.         }
  765.         public bool AddXmlNode(DocumentNode documentNode)
  766.         {
  767.             try
  768.             {
  769.                 xmlDocument = new XmlDocument();
  770.                 xmlDocument.Load(xmlFileName);
  771.                 XmlNode root = xmlDocument.SelectSingleNode("Documents");
  772.                 xmlElement = xmlDocument.CreateElement("Document");
  773.                 XmlElement filenameNode = xmlDocument.CreateElement("FileName");
  774.                 filenameNode.InnerText = documentNode.FileName;
  775.                 xmlElement.AppendChild(filenameNode);
  776.                 XmlElement checkerNode = xmlDocument.CreateElement("Checker");
  777.                 checkerNode.InnerText = documentNode.Checker;
  778.                 xmlElement.AppendChild(checkerNode);
  779.                 XmlElement timeNode = xmlDocument.CreateElement("Time");
  780.                 timeNode.InnerText = documentNode.Time;
  781.                 xmlElement.AppendChild(timeNode);
  782.                 XmlElement typeNode = xmlDocument.CreateElement("Type");
  783.                 typeNode.InnerText = documentNode.Type;
  784.                 xmlElement.AppendChild(typeNode);
  785.                 root.AppendChild(xmlElement);
  786.                 xmlDocument.Save(this.xmlFileName);
  787.                 return true;
  788.             }
  789.             catch
  790.             {
  791.                 return false;
  792.             }
  793.         }
  794.        // public ArrayList ReadNode(string nodeName)
  795.         public ArrayList ReadNode(ArrayList nodesname, string RootNodesName)
  796.         {
  797.             /*ArrayList list = new ArrayList();
  798.             string s = "";
  799.             XmlNodeReader xNodeReader = new XmlNodeReader(xmlDocument);
  800.             while (xNodeReader.Read())
  801.             {
  802.                 switch (xNodeReader.NodeType)
  803.                 {
  804.                     case XmlNodeType.Element:
  805.                         s = xNodeReader.Name;
  806.                         break;
  807.                     case XmlNodeType.Text:
  808.                         if (s.Equals(nodeName))
  809.                             list.Add(xNodeReader.Value);
  810.                         break;
  811.                 }
  812.             }
  813.             return list;*/
  814.             ArrayList al = new ArrayList();
  815.             //XmlDocument XmlDoc = new XmlDocument();
  816.             //XmlDoc.Load(address);
  817.             XmlNodeList NodeList = xmlDocument.SelectSingleNode(RootNodesName).ChildNodes;
  818.             foreach (XmlNode Xn in NodeList)
  819.             {
  820.                 XmlElement Xe = (XmlElement)Xn;
  821.                 XmlNodeList NodeList1 = Xe.ChildNodes;
  822.                 //指定命名空间的属性Xe.GetAttribute("")
  823.                 string[] s = new string[nodesname.Count];
  824.                 foreach (XmlNode Xn1 in NodeList1)
  825.                 {
  826.                     XmlElement Xe1 = (XmlElement)Xn1;
  827.                     for (int k = 0; k < nodesname.Count; k++)
  828.                     {
  829.                         if (nodesname[k].ToString() == Xe1.Name)
  830.                         {
  831.                             s[k] = Xe1.InnerText;
  832.                             break;
  833.                         }
  834.                     }
  835.                 }
  836.                 al.Add(s);
  837.             }
  838.             return al;
  839.         }
  840.         public ArrayList ReadNode(string rootNode, string matchValue, bool isMatchValue)
  841.         {
  842.             /*ArrayList list = new ArrayList();
  843.             string s = "";
  844.             //XmlNodeReader xNodeReader = new XmlNodeReader(xmlDocument);
  845.             //while (xNodeReader.reRead())
  846.             //{
  847.             //    switch (xNodeReader.NodeType)
  848.             //    {
  849.             //        case XmlNodeType.Element:
  850.             //            s = xNodeReader.Name;
  851.             //            break;
  852.             //        case XmlNodeType.Text:
  853.             //            if (s.Equals(nodeName))
  854.             //                list.Add(xNodeReader.Value);
  855.             //            break;
  856.             //    }
  857.             //}
  858.             XmlNodeList nodeList = xmlDocument.SelectNodes(nodeName);
  859.             foreach (XmlNode node in nodeList)
  860.             {
  861.                 if (node.SelectSingleNode("Type").InnerText == matchValue)
  862.                 {
  863.                     list.Add(node.SelectSingleNode("FileName").InnerText);
  864.                 }
  865.             }
  866.             return list;*/
  867.             ArrayList al = new ArrayList();
  868.             // XmlDocument XmlDoc = new XmlDocument();
  869.             // XmlDoc.Load(this.m_Address);
  870.             XmlNodeList NodeList = xmlDocument.SelectSingleNode(rootNode).ChildNodes;
  871.             foreach (XmlNode Xn in NodeList)
  872.             {
  873.                 XmlElement Xe = (XmlElement)Xn;
  874.                 XmlNodeList NodeList1 = Xe.ChildNodes;
  875.                 string FName = "", EmpName = "", OpSort = "", sDate = "";
  876.                 foreach (XmlNode Xn1 in NodeList1)
  877.                 {
  878.                     XmlElement Xe1 = (XmlElement)Xn1;
  879.                     switch (Xe1.Name)
  880.                     {
  881.                         case "FileName":
  882.                             FName = Xe1.InnerText;
  883.                             break;
  884.                         case "Checker":
  885.                             EmpName = Xe1.InnerText;
  886.                             break;
  887.                         case "Type":
  888.                             OpSort = Xe1.InnerText;
  889.                             break;
  890.                         case "Time":
  891.                             sDate = Xe1.InnerText;
  892.                             break;
  893.                         default:
  894.                             break;
  895.                     }
  896.                 }
  897.                 if (isMatchValue == false)
  898.                 {
  899.                     DocumentNode EXml = new DocumentNode();
  900.                     EXml.FileName = FName;
  901.                     EXml.Checker = EmpName;
  902.                     EXml.Type = OpSort;
  903.                     EXml.Time = sDate;
  904.                     al.Add(EXml);
  905.                 }
  906.                 else
  907.                 {
  908.                     if (OpSort.Trim() == matchValue)
  909.                     {
  910.                         DocumentNode EXml = new DocumentNode();
  911.                         EXml.FileName = FName;
  912.                         EXml.Checker = EmpName;
  913.                         EXml.Type = OpSort;
  914.                         EXml.Time = sDate;
  915.                         al.Add(EXml);
  916.                     }
  917.                 }
  918.             }
  919.             return al;
  920.         }
  921.     }
  922.     #endregion
  923.     #region 废旧物资管理流程类
  924.     public class PrjOldMatManager
  925.     {
  926.         public PrjOldMatManager()
  927.         { }
  928.         public int AddPrjOldMat(PrjOldMatInfo prjOldMatInfo)
  929.         {
  930.             SqlParameter[] parameters ={
  931.                  new SqlParameter("@MatID",SqlDbType.Int,4),
  932.                  new SqlParameter("@ConID",SqlDbType.Int,4),
  933.                  new SqlParameter("@ConSort",SqlDbType.Int,4),
  934.                //  new SqlParameter("@MatName",SqlDbType.VarChar,100),
  935.                  new SqlParameter("@MatSort",SqlDbType.Int,4),
  936.                  new SqlParameter("@nf",SqlDbType.VarChar,4),
  937.                  new SqlParameter("@jd",SqlDbType.VarChar,1),
  938.                  new SqlParameter("@hz",SqlDbType.VarChar,1),
  939.                  new SqlParameter("@JcTransactor",SqlDbType.VarChar,50),
  940.                  new SqlParameter("@ZgTransactor",SqlDbType.VarChar ,50),
  941.                  new SqlParameter("@ZgHZFName",SqlDbType.VarChar,100),
  942.                  new SqlParameter("@ZGxFName",SqlDbType.VarChar,100),
  943.                  new SqlParameter("@ZGdFName",SqlDbType.VarChar,100),
  944.                  new SqlParameter("@WZjTransactor",SqlDbType.VarChar,50),
  945.                  new SqlParameter("@WZjIdea",SqlDbType.VarChar,200),
  946.                  new SqlParameter("@WZhTransactor",SqlDbType.VarChar,50),
  947.                  new SqlParameter("@WZhFName",SqlDbType.VarChar,100),
  948.                  new SqlParameter("@WZqTransactor",SqlDbType.VarChar,50),
  949.                  new SqlParameter("@WZqFName",SqlDbType.VarChar,100),
  950.                  new SqlParameter("@GcglTransactor",SqlDbType.VarChar,50),
  951.                  new SqlParameter("@GcglIdea",SqlDbType.VarChar,200),
  952.                  new SqlParameter("@GSldTansactor",SqlDbType.VarChar ,50),
  953.                  new SqlParameter("@GSldIdea",SqlDbType.VarChar,200),
  954.                  new SqlParameter("@WZfTransactor",SqlDbType.VarChar,50),
  955.                  new SqlParameter("@WZfIdea",SqlDbType.VarChar,200),
  956.                  new SqlParameter("@ZGgTransactor",SqlDbType.VarChar,50),
  957.                  new SqlParameter("@ZGgIdea",SqlDbType.VarChar,200),
  958.                  new SqlParameter("@status",SqlDbType.Int,4)
  959.             };
  960.             parameters[0].Direction = ParameterDirection.Output;
  961.             parameters[1].Value = prjOldMatInfo.ConID;
  962.             parameters[2].Value = prjOldMatInfo.ConSort;
  963.            // parameters[3].Value = prjOldMatInfo.;
  964.             parameters[3].Value = prjOldMatInfo.MatSort;
  965.             parameters[4].Value = prjOldMatInfo.NF;
  966.             parameters[5].Value = prjOldMatInfo.JD;
  967.             parameters[6].Value = prjOldMatInfo.HZ;
  968.             parameters[7].Value = prjOldMatInfo.JcTransactor;
  969.             parameters[8].Value = prjOldMatInfo.ZgTransactor;
  970.             parameters[9].Value = prjOldMatInfo.ZgHZFName;
  971.             parameters[10].Value = prjOldMatInfo.ZGxFName;
  972.             parameters[11].Value = prjOldMatInfo.ZGdFName;
  973.             parameters[12].Value = prjOldMatInfo.WZjTransactor;
  974.             parameters[13].Value = prjOldMatInfo.WZjIdea;
  975.             parameters[14].Value = prjOldMatInfo.WZhTransactor;
  976.             parameters[15].Value = prjOldMatInfo.WZhFName;
  977.             parameters[16].Value = prjOldMatInfo.WZqTransactor;
  978.             parameters[17].Value = prjOldMatInfo.WZqFName;
  979.             parameters[18].Value = prjOldMatInfo.GcglTransactor;
  980.             parameters[19].Value = prjOldMatInfo.GcglIdea;
  981.             parameters[20].Value = prjOldMatInfo.GSldTansactor;
  982.             parameters[21].Value = prjOldMatInfo.GSldIdea;
  983.             parameters[22].Value = prjOldMatInfo.WZfTransactor;
  984.             parameters[23].Value = prjOldMatInfo.WZfIdea;
  985.             parameters[24].Value = prjOldMatInfo.ZGgTransactor;
  986.             parameters[25].Value = prjOldMatInfo.ZGgIdea;
  987.             parameters[26].Value = prjOldMatInfo.Status;
  988.             try
  989.             {
  990.                 SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.StoredProcedure, "p_PrjOldMat_add", parameters);
  991.                 return (int)parameters[0].Value;
  992.             }
  993.             catch
  994.             {
  995.                 return -1;
  996.             }
  997.         }
  998.         public int UpdateOldMatName(int matid, string matname)
  999.         {
  1000.             SqlParameter [] parameters ={ 
  1001.                 new SqlParameter ("@MatID",SqlDbType .Int,4),
  1002.                 new SqlParameter ("@MatName",SqlDbType.VarChar ,100),
  1003.                 new SqlParameter ("@returnValue",SqlDbType.Int,4)
  1004.             };
  1005.             parameters[0].Value = matid;
  1006.             parameters[1].Value = matname;
  1007.             parameters[2].Direction = ParameterDirection.ReturnValue;
  1008.             SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.StoredProcedure, "p_MatName_update", parameters);
  1009.             return (int)parameters[2].Value;
  1010.         }
  1011.     }
  1012.     #endregion
  1013.     #region 废旧物资汇总类
  1014.     public class PrjOldMatHZManager
  1015.     {
  1016.         public PrjOldMatHZManager()
  1017.         { }
  1018.         public int AddPrjOldMatHZ(PrjOldMatHZInfo  prjOldMatHZInfo)
  1019.         {
  1020.             SqlParameter[] parameters ={
  1021.                  new SqlParameter("@MatHZID",SqlDbType.Int,4),
  1022.                  new SqlParameter("@HZ",SqlDbType.VarChar,1),
  1023.                  new SqlParameter("@nf",SqlDbType.VarChar,4),
  1024.                  new SqlParameter("@jd",SqlDbType.VarChar,1),
  1025.                  new SqlParameter("@MatHzName",SqlDbType.VarChar,100),
  1026.                  new SqlParameter("@HzFName",SqlDbType.VarChar,100),
  1027.                  new SqlParameter("@WzTransactor",SqlDbType.VarChar,30),
  1028.                  new SqlParameter("@GcglTransactor",SqlDbType.VarChar,20),
  1029.                  new SqlParameter("@GcglIdea",SqlDbType.VarChar,200),
  1030.                  new SqlParameter("@FgTransactor",SqlDbType.VarChar,20),
  1031.                  new SqlParameter("@FgIdea",SqlDbType.VarChar,200),
  1032.                  new SqlParameter("@JcoTransactor",SqlDbType.VarChar,20),
  1033.                  new SqlParameter("@JcoIdea",SqlDbType.VarChar,200),
  1034.                  new SqlParameter("@status",SqlDbType.Int,4),
  1035.             };
  1036.             parameters[0].Direction = ParameterDirection.Output;
  1037.             parameters[1].Value = prjOldMatHZInfo.HZ;
  1038.             parameters[2].Value = prjOldMatHZInfo.NF;
  1039.             parameters[3].Value = prjOldMatHZInfo.JD;
  1040.             parameters[4].Value = prjOldMatHZInfo.MatHZName;
  1041.             parameters[5].Value = prjOldMatHZInfo.HzFName;
  1042.             parameters[6].Value = prjOldMatHZInfo.WzTransactor;
  1043.             parameters[7].Value = prjOldMatHZInfo.GcglTransactor;
  1044.             parameters[8].Value = prjOldMatHZInfo.GcglIdea;
  1045.             parameters[9].Value = prjOldMatHZInfo.FgTransactor;
  1046.             parameters[10].Value = prjOldMatHZInfo.FgIdea;
  1047.             parameters[11].Value = prjOldMatHZInfo.JcoTransactor;
  1048.             parameters[12].Value = prjOldMatHZInfo.JcoIdea;
  1049.             parameters[13].Value = prjOldMatHZInfo.Status;
  1050.             try
  1051.             {
  1052.                 SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.StoredProcedure, "p_PrjOldMatHZ_add", parameters);
  1053.                 return (int)parameters[0].Value;
  1054.             }
  1055.             catch
  1056.             {
  1057.                 return -1;
  1058.             }
  1059.         }
  1060.     }
  1061.     #endregion
  1062.     #region 废旧物资汇总类
  1063.     public class PrjAlertManager
  1064.     {
  1065.         public PrjAlertManager()
  1066.         { }
  1067.         public int AddPrjAlert(PrjAlertInfo prjAlertInfo)
  1068.         {
  1069.             SqlParameter[] parameters ={
  1070.                  new SqlParameter("@AlertID",SqlDbType.Int,4),
  1071.                  new SqlParameter("@ConID",SqlDbType.Int,4),
  1072.                  new SqlParameter("@ConSort",SqlDbType.VarChar,2),
  1073.                  new SqlParameter("@AlertName",SqlDbType.VarChar,100),
  1074.                  new SqlParameter("@BgFName",SqlDbType.VarChar,100),
  1075.                  new SqlParameter("@JcTransactor",SqlDbType.VarChar,30),
  1076.                  new SqlParameter("@JcFName",SqlDbType.VarChar,100),
  1077.                  new SqlParameter("@ZgTransactor",SqlDbType.VarChar,30),
  1078.                  new SqlParameter("@ZgFName",SqlDbType.VarChar,100),
  1079.                  new SqlParameter("@GcglTransactor",SqlDbType.VarChar,20),
  1080.                  new SqlParameter("@GcglIdea",SqlDbType.VarChar,200),
  1081.                  new SqlParameter("@FgTransactor",SqlDbType.VarChar,20),
  1082.                  new SqlParameter("@FgIdea",SqlDbType.VarChar,200),
  1083.                  new SqlParameter("@status",SqlDbType.Int,4),
  1084.             };
  1085.             parameters[0].Direction = ParameterDirection.Output;
  1086.             parameters[1].Value = prjAlertInfo.ConID;
  1087.             parameters[2].Value = prjAlertInfo.ConSort;
  1088.             parameters[3].Value = prjAlertInfo.AlertName;
  1089.             parameters[4].Value = prjAlertInfo.BgFName;
  1090.             parameters[5].Value = prjAlertInfo.Jctransactor;
  1091.             parameters[6].Value = prjAlertInfo.Jcfname;
  1092.             parameters[7].Value = prjAlertInfo.Zgtransactor;
  1093.             parameters[8].Value = prjAlertInfo.Zgfname;
  1094.             parameters[9].Value = prjAlertInfo.Gcgltransactor;
  1095.             parameters[10].Value = prjAlertInfo.Gcglidea;
  1096.             parameters[11].Value = prjAlertInfo.Fgtransactor;
  1097.             parameters[12].Value = prjAlertInfo.Fgidea;
  1098.             parameters[13].Value = prjAlertInfo.Status;
  1099.             try
  1100.             {
  1101.                 SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.StoredProcedure, "p_tb_PrjAlert_add", parameters);
  1102.                 return (int)parameters[0].Value;
  1103.             }
  1104.             catch
  1105.             {
  1106.                 return -1;
  1107.             }
  1108.         }
  1109.     }
  1110.     #endregion
  1111. }