EtongZwf.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:111k
- using System;
- using System.Text;
- using System.Data.SqlClient;
- using com.etong.SqlDataConnect;
- using System.Data;
- using com.etong.DBUtility;
- using com.etong.Model;
- using System.Configuration;
- using System.Collections;
- using System.Xml;
- namespace com.etong.BusinessRule.Zwf
- {
- public class EtongZwf
- {
- private MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- public EtongZwf()
- {
- //
- // TODO: 在此处添加构造函数逻辑
- //
- }
- #region 用户管理
- /*************************************************************************************************************
- * Module: 用户管理
- * Desc: 添加、更新、删除、查询记录
- * Author:朱皖峰
- * Date: 2007-03
- **************************************************************************************************************/
- /// <summary>
- /// 添加用户记录
- /// </summary>
- /// <returns>返回一bool类型值</returns>
- public bool UserAdd(int empid, string useraccount, string usercode, string userdecs, int ordinal, string userpwd, int islock,
- string ipaddress,int isipbound,DateTime editdate,DateTime fromdate,DateTime todate)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@empid", empid);
- Params.Add("@useraccount", useraccount);
- Params.Add("@usercode", usercode);
- Params.Add("@userdecs", userdecs);
- Params.Add("@ordinal", ordinal);
- Params.Add("@userpwd", userpwd);
- Params.Add("@islock", islock);
- Params.Add("@ipaddress", ipaddress);
- Params.Add("@isipbound", isipbound);
- Params.Add("@editdate", editdate);
- Params.Add("@fromdate", fromdate);
- Params.Add("@todate", todate);
- string sSQL = "insert into Tb_Sys_User([EmpID],[UserAccount],[UserCode],[UserDecs],[OrdInal],[UserPwd],[IsLock],[IPAddress],[IsIPBound],[EditDate],[FromDate],[ToDate]) values(" +
- "@empid ,@useraccount,@usercode,@userdecs,@ordinal,@userpwd,@islock,@ipaddress,@isipbound,@editdate,@fromdate,@todate)";
- MSDA.Open();
-
- NewObj newobject=new NewObj();
- bool returnvalue =newobject.insert(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 更新用户记录
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool UserUpdata(int @userid, int empid, string useraccount, string usercode, string userdecs, int ordinal, string userpwd, int islock,
- string ipaddress, int isipbound, DateTime editdate, DateTime fromdate, DateTime todate)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@userid", @userid);
- Params.Add("@empid", empid);
- Params.Add("@useraccount", useraccount);
- Params.Add("@usercode", usercode);
- Params.Add("@userdecs", userdecs);
- Params.Add("@ordinal", ordinal);
- Params.Add("@userpwd", userpwd);
- Params.Add("@islock", islock);
- Params.Add("@ipaddress", ipaddress);
- Params.Add("@isipbound", isipbound);
- Params.Add("@editdate", editdate);
- Params.Add("@fromdate", fromdate);
- Params.Add("@todate", todate);
- string sSQL = "update Tb_Sys_User Set EmpID =@empid,UserAccount=@useraccount,UserCode=@usercode,UserDecs=@userdecs,OrdInal=@ordinal,UserPwd=@userpwd,IsLock=@islock," +
- "IPAddress=@ipaddress,IsIPBound=@isipbound,EditDate=@editdate,FromDate=@fromdate,ToDate=@todate where UserID=@userid";
- MSDA.Open();
- NewObj newobject=new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 删除用户记录
- /// </summary>
- /// <param name="userid">用户ID</param>
- public void UserDelete(int UserID)
- {
- string sSQL = "delete from Tb_Sys_User where [UserID]='" + UserID + "'";
- MSDA.Open();
- MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
- MSDA.Close();
- }
- /// <summary>
- /// 查询指定或全部用户记录
- /// </summary>
- /// <param name="SearchTxt">查找内容</param>
- /// <param name="IsSearch">是否精确查询</param>
- /// <param name="i">查找关键字,例:1:帐号;2:用户名;3:组织机构;4:用户id;非1,2,3,4且SearchTxt为空:查找全部</param>
- public DataView UserSearch(string SearchTxt, string i,bool IsSearch)
- {
- string sSQL = "select * from Tb_Sys_User a ,Tb_Sys_Employee b,Tb_Sys_Organization c where ";
-
- if(SearchTxt!="")
- {
- if (IsSearch == true)
- {
- switch (i)
- {
- case "1":
- sSQL = sSQL + " a.UserAccount like '%" + SearchTxt + "%' and ";
- break;
- case "2":
- sSQL = sSQL + " b.EmpName like '%" + SearchTxt + "%' and ";
- break;
- case "3":
- sSQL = sSQL + " c.OrgName like '%" + SearchTxt + "%' and ";
- break;
- case "4":
- sSQL = sSQL + " a.UserID like '%" + SearchTxt + "%' and ";
- break;
- }
- }
- else
- { //精确查询
- switch (i)
- {
- case "1":
- sSQL = sSQL + " a.UserAccount='" + SearchTxt + "' and ";
- break;
- case "2":
- sSQL = sSQL + " b.EmpName='" + SearchTxt + "' and ";
- break;
- case "3":
- sSQL = sSQL + " c.OrgName='" + SearchTxt + "' and ";
- break;
- case "4":
- sSQL = sSQL + "a.UserID='" + SearchTxt + "' and ";
- break;
- }
- }
- }
- sSQL=sSQL+" b.EmpID=a.EmpID and c.OrgID=b.PrimaryOrgID";
-
- MSDA.Open();
- NewObj newobject = new NewObj();
- // bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- DataView dv;
- try
- {
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- }
- catch
- {
- dv = null;
- }
- // MSDA.ExecuteDataset(CommandType.Text, sSQL, null, ds, "");
- finally
- {
- MSDA.Close();
- }
- return dv; //ds.Tables[0].DefaultView;
-
- }
- /// <summary>
- /// 获取所有角色列表
- /// </summary>
- public DataView RoleGetAll()
- {
- string sSQL = "select RoleID ,RoleName from Tb_Sys_Role";
-
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
-
- MSDA.Close();
- return dv;
- }
- /// <summary>
- /// 添加用户权限记录
- /// </summary>
- /// <returns>返回一bool类型值</returns>
- public bool UserRoleAdd(int userid, int roleid, DateTime editdate)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@userid", userid);
- Params.Add("@roleid", roleid);
- Params.Add("@editdate", editdate);
- string sSQL = "insert into Tb_Sys_UserRole([UserID],[RoleID],[EditDate]) values(@userid,@roleid,@editdate)";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.insert(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///清除用户对应的权限记录
- /// </summary>
- /// <param name="userid">用户ID</param>
- public void UserRoleDelete(int UserID)
- {
- string sSQL = "delete from Tb_Sys_UserRole where [UserID]='" + UserID + "'";
- MSDA.Open();
- MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
- MSDA.Close();
- }
- /// <summary>
- /// 获取某个用户角色
- /// </summary>
- public DataView RoleGetByID(int userid)
- {
- //string sSQL = "select RoleID ,RoleName from Tb_Sys_Role where UserID='" + userid + "'";
- string sSQL = "select * from Tb_Sys_Role where RoleID in(select RoleID from Tb_Sys_UserRole where UserID='" + userid + "')";
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- MSDA.Close();
- return dv;
- }
- /// <summary>
- /// 初始化用户密码
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool UserPwdUpdata(int @userid)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@userid", @userid);
- //string sSQL = "update Tb_Sys_User Set UserPwd='111111' where UserID=@userid";
- string sSQL = "update Tb_Sys_User Set UserPwd='1' where UserID=@userid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 获取某个角色信息
- /// </summary>
- public DataView RoleGetName(int roleid)
- {
- string sSQL = "select RoleName from Tb_Sys_Role where RoleID='" + roleid + "'";
-
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- MSDA.Close();
- return dv;
- }
- /// <summary>
- /// 得到某个业务角色的所有用户
- /// </summary>
- /// <param name="SOrgID">业务角色ID</param>
- public DataView GetOrgzation(int OpID)
- {
- //string sSQL = "select OrgName from Tb_Sys_Organization where OrgID=" + orgid;
- // string sSQL = "select * from tb_sys_empoprole where OpID=" + OpID;
- string sSQL = "select OpName,OpID from tb_sys_oprole where OpID=" + OpID;
-
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataView dv;
- try
- {
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- }
- catch
- {
- dv = null;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- /// <summary>
- /// 根据用户ID得到组织机构ID
- /// </summary>
-
- public int GetOrgID(int userid)
- {
- string sSQL = "select PrimaryOrgID from Tb_Sys_Employee where EmpID =(select EmpID from Tb_Sys_User where UserID='" + userid +"')";
- MSDA.Open();
- NewObj newobject = new NewObj();
-
- int orgid;
- try
- {
- DataView dv;
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- orgid = Convert.ToInt16(dv[0][0].ToString().Trim());
- }
- catch
- {
- orgid = -1;
- }
- finally
- {
- MSDA.Close();
- }
- return orgid;
- }
- #endregion
- #region 项目分类
- /*************************************************************************************************************
- * Module: 项目分类
- * Desc:添加、更新、删除、查询记录
- * Author:朱皖峰
- * Date: 2007-03
- **************************************************************************************************************/
- /// <summary>
- /// 添加项目分类
- /// </summary>
- /// <returns>返回一bool类型值</returns>
- public bool ProjectAdd(string serialname)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@SerialName", serialname);
- string sSQL = "insert into tb_Project_Serial([SerialName]) values(@SerialName)";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.insert(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 更新项目分类
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool ProjectUpdata(int serialid, string serialname)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@serialid", serialid);
- Params.Add("@serialname", serialname);
- string sSQL = "update tb_Project_Serial Set SerialName =@serialname where SerialID=@serialid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 删除项目分类
- /// </summary>
- /// <param name="userid">项目分类ID</param>
- public void ProjectDelete(int serialid)
- {
- string sSQL = "delete from tb_Project_Serial where [SerialID]='" + serialid + "'";
- MSDA.Open();
- MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
- MSDA.Close();
- }
- /// <summary>
- /// 获取项目分类记录
- /// </summary>
- public DataView ProjectSearch(int serialid)
- {
- string sSQL = "select * from tb_Project_Serial";
- if (serialid != -1)
- sSQL = sSQL + " where SerialID='" + serialid + "'";
-
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
-
- MSDA.Close();
- return dv;
- }
- /// <summary>
- /// 根据项目名称获取项目分类记录
- /// </summary>
- /// <param name="serialid">项目名称</param>
- /// <returns></returns>
- public int ProjectSearchByName(string serialname)
- {
- string sSQL = "select * from tb_Project_Serial where SerialName='" + serialname + "'";
-
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- MSDA.Close();
- int returnvalue=0;
- returnvalue = dv.Count;
- return returnvalue;
- }
- /// <summary>
- /// 获取全部项目分类记录
- /// </summary>
- public DataTable ProjectSerialGetAll()
- {
- string sSQL = "select * from tb_Project_Serial";
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataTable dt = new DataTable();
- dt = null;
- dt = newobject.Search(sSQL, null, CommandType.Text).Tables[0];
- MSDA.Close();
- return dt;
- }
- #endregion
- #region 工作流
- /***************************************************************************************************************
- * Module: 工作流
- * Desc:项目申请
- * Author:朱皖峰
- * Date: 2007-04
- ****************************************************************************************************************/
- ///// <summary>
- ///// 启动工作流
- ///// </summary>
- ///// <param name="UserId">用户ID</param>
- ///// <param name="WFId">启动工作流ID</param>
- ///// <returns>返回string类型数据:流水号</returns>
- //public bool WorkFlowStart(out WFStartReValue[] WF_StartReValue, int UserId, int WFId)
- //{
- // string StrProjcetLsh = DateTime.Now.ToString("yyyyMMdd");//例如:20070410
- // int Lsh = 1;
- // //取tb_Project 中字段ProjcetLsh的最大值
- // MSDA.Open();
- // DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_ProjectMaxLsh", null);
- // if (dt.Rows.Count > 0 && dt.Rows[0]["ProjcetLsh"].ToString() != "")
- // {
- // string ProjcetLsh = dt.Rows[0]["ProjcetLsh"].ToString().Trim();
- // Lsh = Convert.ToInt32(ProjcetLsh.Substring(8).Trim().ToString()) + 1;
- // }
- // int strlen = Lsh.ToString().Trim().Length;
- // for (int i = 1; i <= 5 - strlen; i++)
- // {
- // StrProjcetLsh = StrProjcetLsh + "0"; //格式化流水号后五位,补0
- // }
- // StrProjcetLsh = StrProjcetLsh + Lsh.ToString(); //记录中最大值 化为int型后 +1
- // //向tb_Project中添加空项目记录
- // WFStartReValue[] returnvalue=new WFStartReValue[1];
- // if (StrProjcetLsh != "")
- // {
- // returnvalue[0].LSH = StrProjcetLsh;
- // WF_StartReValue = returnvalue;
- // return true;
- // }
- // else
- // {
- // returnvalue[0].LSH = "";
- // WF_StartReValue = returnvalue;
- // return false;
- // }
- //}
- /// <summary>
- /// 工作流启动返回信息结构
- /// </summary>
- public struct WFStartReValue
- {
- public string LSH; //流水号
- // public int PROJECTID; //项目ID
- }
- /// <summary>
- /// 获取项目记录
- /// </summary>
- public DataView ProjectGetAll(int prjid)
- {
- string sSQL = "select * from tb_Project where ProjectID='"+ prjid +"'";
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataView dv = null;
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- MSDA.Close();
- return dv;
- }
- /// <summary>
- /// 获取变更项目记录
- /// </summary>
- public DataView PrjAlertGetAll(int alertid)
- {
- string sSQL = "select * from tb_PrjAlert where AlertID='" + alertid + "'";
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataView dv = null;
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- MSDA.Close();
- return dv;
- }
- /// <summary>
- /// 获取工作流实例信息
- /// </summary>
- /// <param name="WFInstanceID"></param>
- /// <returns></returns>
- public DataView WFInstanceGetAll(int WFInstanceID)
- {
- string sSQL = "select * from tb_WF_Instance where WFInstanceID='" + WFInstanceID + "' ";
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataView dv = null;
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- MSDA.Close();
- return dv;
- }
- /// <summary>
- ///添加项目
- /// </summary>
- public int WFProjectAdd(ProjectInfo projectinfo)
- {
-
- SqlParameter[] parameters ={
- new SqlParameter ("@ProjectID",SqlDbType.Int ,4),
- new SqlParameter ("@ProjectName" ,SqlDbType.VarChar,200),
- new SqlParameter ("@PrjSort" ,SqlDbType.VarChar,2),
- new SqlParameter ("@JcTransactor" ,SqlDbType.VarChar,30),
- new SqlParameter ("@JcFName" ,SqlDbType.VarChar,100),
- new SqlParameter ("@QuestOrg" ,SqlDbType.VarChar,100),
- new SqlParameter ("@ZgTransactor" ,SqlDbType.VarChar,30),
- new SqlParameter ("@ZgFName" ,SqlDbType.VarChar,100),
- new SqlParameter ("@JqbXTransactor" ,SqlDbType.VarChar,30),
- new SqlParameter ("@JqbXFName" ,SqlDbType.VarChar,100),
- new SqlParameter ("@GcglXTransactor" ,SqlDbType.VarChar,30),
- new SqlParameter ("@GcglXFName" ,SqlDbType.VarChar,100),
- new SqlParameter ("@JqbBTransactor" ,SqlDbType.VarChar,30),
- new SqlParameter ("@JqbBFName" ,SqlDbType.VarChar,100),
- new SqlParameter ("@GcglHTransactor" ,SqlDbType.VarChar,30),
- new SqlParameter ("@GcglHFName" ,SqlDbType.VarChar,100),
- new SqlParameter ("@FgTransactor" ,SqlDbType.VarChar,20),
- new SqlParameter ("@FgIdea" ,SqlDbType.VarChar,200),
- new SqlParameter ("@ZjwyhTransactor" ,SqlDbType.VarChar,20),
- new SqlParameter ("@ZjwyhIdea" ,SqlDbType.VarChar,200),
- new SqlParameter ("@GsTransactor" ,SqlDbType.VarChar,20),
- new SqlParameter ("@GsIdea" ,SqlDbType.VarChar,400),
- new SqlParameter ("@GcglQTransactor" ,SqlDbType.VarChar,20),
- new SqlParameter ("@GcglQIdea" ,SqlDbType.VarChar,200),
- new SqlParameter ("@JqbZTransactor" ,SqlDbType.VarChar,30),
- new SqlParameter ("@JqbZFName" ,SqlDbType.VarChar,100),
- new SqlParameter ("@Status" ,SqlDbType.Int,2),
- };
-
- parameters[0].Direction = ParameterDirection.Output;
- parameters[1].Value = projectinfo.ProjectName;
- parameters[2].Value = projectinfo.PrjSort;
- parameters[3].Value = projectinfo.JcTransactor;
- parameters[4].Value = projectinfo.JcFName;
- parameters[5].Value = projectinfo.QuestOrg;
- parameters[6].Value = projectinfo.ZgTransactor;
- parameters[7].Value = projectinfo.ZgFName;
- parameters[8].Value = projectinfo.JqbxTransactor;
- parameters[9].Value = projectinfo.JqbxFName;
- parameters[10].Value = projectinfo.GcglxTransactor;
- parameters[11].Value = projectinfo.GcglxFName;
- parameters[12].Value = projectinfo.JqbbTransactor;
- parameters[13].Value = projectinfo.JqbbFName;
- parameters[14].Value = projectinfo.GcglhTransactor;
- parameters[15].Value = projectinfo.GcglhFName;
- parameters[16].Value = projectinfo.FgTransactor;
- parameters[17].Value = projectinfo.FgIdea;
- parameters[18].Value = projectinfo.ZjwyhTransactor;
- parameters[19].Value = projectinfo.ZjwyhIdea;
- parameters[20].Value = projectinfo.GsTransactor;
- parameters[21].Value = projectinfo.GsIdea;
- parameters[22].Value = projectinfo.GcglqTransactor;
- parameters[23].Value = projectinfo.GcglqIdea;
- parameters[24].Value = projectinfo.JqbzTransactor;
- parameters[25].Value = projectinfo.JqbzFName;
- parameters[26].Value = projectinfo.Status;
- int rv = 0;
- try
- {
- SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "P_Project_ADD", parameters);
- rv = Convert.ToInt32(parameters[0].Value.ToString().Trim());
- }
- catch
- {
- rv = 0;
- }
- return rv;
- }
- /// <summary>
- /// 添加工作流实例记录
- /// </summary>
- /// <param name="wfinstanceinfo"></param>
- /// <returns></returns>
- public int WFInstanceADD(WFInstanceInfo wfinstanceinfo)
- {
- SqlParameter[] parameters ={
- new SqlParameter ("@WFInstanceID",SqlDbType.Int,4),
- new SqlParameter ("@CreateDate",SqlDbType.DateTime ,8),
- new SqlParameter ("@CreateUserID",SqlDbType.Int ,4),
- new SqlParameter ("@TargetRoleID",SqlDbType.Int ,4),
- new SqlParameter ("@ClientID",SqlDbType.Int ,4),
- new SqlParameter ("@RealEndDate",SqlDbType.DateTime ,8),
- new SqlParameter ("@Status",SqlDbType.Int ,4),
- new SqlParameter ("@TheoryEndDate",SqlDbType.DateTime ,8),
- new SqlParameter ("@WorkFlowID",SqlDbType.Int ,4),
- new SqlParameter ("@PrjID",SqlDbType.Int ,4),
- };
- parameters[0].Direction = ParameterDirection.Output;
- parameters[1].Value = wfinstanceinfo.CreateDate;
- parameters[2].Value = wfinstanceinfo.CreateUserID;
- parameters[3].Value = wfinstanceinfo.TargetRoleID;
- parameters[4].Value = wfinstanceinfo.ClientID;
- parameters[5].Value = wfinstanceinfo.RealEndDate;
- parameters[6].Value = wfinstanceinfo.Status;
- parameters[7].Value = wfinstanceinfo.TheoryEndDate;
- parameters[8].Value = wfinstanceinfo.WorkflowID;
- parameters[9].Value = wfinstanceinfo.PrjID;
- int WFInstanceID = 0;
- try
- {
- SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_Instance_ADD", parameters);
- WFInstanceID = Convert.ToInt32(parameters[0].Value.ToString().Trim());
- }
- catch
- {
-
- WFInstanceID = 0;
- }
- return WFInstanceID;
- }
- /// <summary>
- /// 提交申请项目记录
- /// </summary>
- /// <param name="projectinfo"></param>
- /// <returns>返回类型:int 返回值:0:表示不成功,-1:成功</returns>
- public int WFProjectUpdata(ProjectInfo projectinfo)
- {
- //SqlParameter[] parameters ={
- // new SqlParameter ("@ProjectID",SqlDbType.Int ,4),
- // new SqlParameter ("@AuditIdea" ,SqlDbType.VarChar,20),
- // new SqlParameter ("@ChargeMachine" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@ChargeManPower" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@ChargeOther" ,SqlDbType.Decimal,14),
- // new SqlParameter("@ChargeStuff" ,SqlDbType.Decimal ,14),
- // new SqlParameter ("@ChargeSum" ,SqlDbType.Decimal,15),
- // new SqlParameter ("@CreateDate" ,SqlDbType.DateTime,8),
- // new SqlParameter ("@Yw_ChargeMachine" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@Yw_ChargeManPower" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@Yw_ChargeOther" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@Yw_ChargeStuff" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@Yw_ChargeSum" ,SqlDbType.Decimal,15),
- // new SqlParameter ("@Yw_ExpenseChannel" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@Yw_ProjectNumber" ,SqlDbType.VarChar,100),
- // new SqlParameter ("@Yw_TransactorIdea" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@Yw_TransactorSignature" ,SqlDbType.VarChar,20),
- // new SqlParameter ("@DirectorGeneralIdea" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@EditUnit" ,SqlDbType.VarChar,100),
- // new SqlParameter ("@GeneralManagerIdea" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@Fg_ChargeMachine" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@Fg_ChargeManPower" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@Fg_ChargeOther" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@Fg_ChargeStuff" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@Fg_ChargeSum" ,SqlDbType.Decimal,15),
- // new SqlParameter ("@Fg_ExpenseChannel" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@Fg_ProjectNumber" ,SqlDbType.VarChar,100),
- // new SqlParameter ("@Fg_TransactorIdea" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@Fg_TransactorSignature" ,SqlDbType.VarChar,20),
- // new SqlParameter ("@Zjl_ChargeMachine" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@Zjl_ChargeManPower" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@Zjl_ChargeOther" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@Zjl_ChargeStuff" ,SqlDbType.Decimal,14),
- // new SqlParameter ("@Zjl_ChargeSum" ,SqlDbType.Decimal,15),
- // new SqlParameter ("@Zjl_ExpenseChannel" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@Zjl_ProjectNumber" ,SqlDbType.VarChar,100),
- // new SqlParameter ("@Zjl_TransactorIdea" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@Zjl_TransactorSignature" ,SqlDbType.VarChar,20),
- // new SqlParameter ("@OfficeLeadIdea" ,SqlDbType.VarChar,100),
- // new SqlParameter ("@ProjectManager" ,SqlDbType.VarChar,20),
- // new SqlParameter ("@ProjectName" ,SqlDbType.VarChar,20),
- // new SqlParameter ("@ProjectReason" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@SuccessDate" ,SqlDbType.DateTime,8),
- // new SqlParameter ("@Transactor" ,SqlDbType.VarChar,20),
- // new SqlParameter ("@UnitManager" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@ProjectType" ,SqlDbType.Int,4),
- // new SqlParameter ("@wi_id" ,SqlDbType.Int,4),
- // new SqlParameter ("@ProjectSort" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@Dynamic_Wi_ID" ,SqlDbType.Int,4),
- // new SqlParameter ("@Status" ,SqlDbType.Int,2),
- // new SqlParameter ("@ProjectNumber" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@CurrentDate" ,SqlDbType.DateTime,8),
- // new SqlParameter ("@FactCharge" ,SqlDbType.Decimal,16),
- // new SqlParameter ("@Memo" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@PlanCharge" ,SqlDbType.Decimal,15),
- // new SqlParameter ("@SuccessedDate" ,SqlDbType.DateTime,8),
- // new SqlParameter ("@TakeDepartment" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@ProjcetLsh" ,SqlDbType.VarChar,15),
- // new SqlParameter ("@Jqb_TransactorSignature" ,SqlDbType.VarChar,20),
- // new SqlParameter ("@Jqb_Idea" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@cw_TransactorSignature" ,SqlDbType.VarChar,20),
- // new SqlParameter ("@cw_Idea" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@Ld_TransactorSignature" ,SqlDbType.VarChar,20),
- // new SqlParameter ("@Ld_Idea" ,SqlDbType.VarChar,200),
- // new SqlParameter ("@Jqb2_TransactorSignature" ,SqlDbType.VarChar,20),
- // new SqlParameter ("returnValue",SqlDbType.Int ,2)
- //};
- //parameters[0].Value = projectinfo.ProjectID;
- //parameters[1].Value = projectinfo.AuditIdea;
- //parameters[2].Value = projectinfo.Chargemachine;
- //parameters[3].Value = projectinfo.ChargeManPower;
- //parameters[4].Value = projectinfo.ChargeOther;
- //parameters[5].Value = projectinfo.ChargeStuff;
- //parameters[6].Value = projectinfo.ChargeSum;
- //parameters[7].Value = projectinfo.CreateDate;
- //parameters[8].Value = projectinfo.Yw_ChargeMachine;
- //parameters[9].Value = projectinfo.Yw_ChargeManPower;
- //parameters[10].Value = projectinfo.Yw_ChargeOther;
- //parameters[11].Value = projectinfo.Yw_ChargeStuff;
- //parameters[12].Value = projectinfo.Yw_ChargeSum;
- //parameters[13].Value = projectinfo.Yw_ExpenseChannel;
- //parameters[14].Value = projectinfo.Yw_ProjectNumber;
- //parameters[15].Value = projectinfo.Yw_TransactorIdea;
- //parameters[16].Value = projectinfo.Yw_TransactorSignature;
- //parameters[17].Value = projectinfo.DirectorGeneralIdea;
- //parameters[18].Value = projectinfo.EditUnit;
- //parameters[19].Value = projectinfo.GeneralManagerIdea;
- //parameters[20].Value = projectinfo.Fg_ChargeMachine;
- //parameters[21].Value = projectinfo.Fg_ChargeManPower;
- //parameters[22].Value = projectinfo.Fg_ChargeOther;
- //parameters[23].Value = projectinfo.Fg_ChargeStuff;
- //parameters[24].Value = projectinfo.Fg_ChargeSum;
- //parameters[25].Value = projectinfo.Fg_ExpenseChannel;
- //parameters[26].Value = projectinfo.Fg_ProjectNumber;
- //parameters[27].Value = projectinfo.Fg_TransactorIdea;
- //parameters[28].Value = projectinfo.Fg_TransactorSignature;
- //parameters[29].Value = projectinfo.Zjl_ChargeMachine;
- //parameters[30].Value = projectinfo.Zjl_ChargeManPower;
- //parameters[31].Value = projectinfo.Zjl_ChargeOther;
- //parameters[32].Value = projectinfo.Zjl_ChargeStuff;
- //parameters[33].Value = projectinfo.Zjl_ChargeSum;
- //parameters[34].Value = projectinfo.Zjl_ExpenseChannel;
- //parameters[35].Value = projectinfo.Zjl_ProjectNumber;
- //parameters[36].Value = projectinfo.Zjl_TransactorIdea;
- //parameters[37].Value = projectinfo.Zjl_TransactorSignature;
- //parameters[38].Value = projectinfo.OfficeLeadIdea;
- //parameters[39].Value = projectinfo.ProjectManager;
- //parameters[40].Value = projectinfo.ProjectName;
- //parameters[41].Value = projectinfo.ProjectReason;
- //parameters[42].Value = projectinfo.SuccessDate;
- //parameters[43].Value = projectinfo.Transactor;
- //parameters[44].Value = projectinfo.UnitManager;
- //parameters[45].Value = projectinfo.ProjectType;
- //parameters[46].Value = projectinfo.Wi_Id;
- //parameters[47].Value = projectinfo.ProjectSort;
- //parameters[48].Value = projectinfo.Dynamic_Wi_ID;
- //parameters[49].Value = projectinfo.Status;
- //parameters[50].Value = projectinfo.ProjectNumber;
- //parameters[51].Value = projectinfo.CurrentDate;
- //parameters[52].Value = projectinfo.FactCharge;
- //parameters[53].Value = projectinfo.Memo;
- //parameters[54].Value = projectinfo.PlanCharge;
- //parameters[55].Value = projectinfo.SuccessedDate;
- //parameters[56].Value = projectinfo.TakeDepartment;
- //parameters[57].Value = projectinfo.ProjcetLsh;
- //parameters[58].Value = projectinfo.Jqb_TransactorSignature;
- //parameters[59].Value = projectinfo.Jqb_Idea;
- //parameters[60].Value = projectinfo.cw_TransactorSignature;
- //parameters[61].Value = projectinfo.cw_Idea;
- //parameters[62].Value = projectinfo.Jqb_Idea;
- //parameters[63].Value = projectinfo.cw_TransactorSignature;
- //parameters[64].Value = projectinfo.cw_Idea;
- //parameters[65].Direction = ParameterDirection.ReturnValue;
- int rv = 0;
- //try
- //{
- // SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "P_Project_Updata", parameters);
- // rv = Convert.ToInt32(parameters[65].Value.ToString().Trim());
- //}
- //catch
- //{
- // rv = 0;
- //}
-
- return rv;
- }
- /// <summary>
- /// 添加工作流活动记录
- /// </summary>
- /// <param name="wfinstanceinfo"></param>
- /// <returns></returns>
- public int WFActivityADD(WFActivityInfo wfactivityinfo)
- {
- SqlParameter[] parameters ={
- new SqlParameter ("@ActivityID",SqlDbType.Int,4),
- new SqlParameter ("@Unit",SqlDbType.VarChar ,200),
- new SqlParameter ("@UnitType",SqlDbType.Int ,4),
- new SqlParameter ("@ActDesc",SqlDbType.VarChar ,200),
- new SqlParameter ("@ActName",SqlDbType.VarChar ,200),
- new SqlParameter ("@WorkFlowID",SqlDbType.Int ,4),
- new SqlParameter ("@PageID",SqlDbType.Int,4),
- new SqlParameter ("@DecisionTitle",SqlDbType.VarChar ,200),
- new SqlParameter ("@DecisionName",SqlDbType.VarChar ,200),
- new SqlParameter ("@StartEnd",SqlDbType.Int ,4),
- new SqlParameter ("@BlockFlag",SqlDbType.Int ,4),
- new SqlParameter ("@ShuntFlag",SqlDbType.Int ,4),
- new SqlParameter ("@ModeFlag",SqlDbType.Int ,4),
- };
- parameters[0].Direction = ParameterDirection.Output;
- parameters[1].Value = wfactivityinfo.Unit;
- parameters[2].Value = wfactivityinfo.UnitType;
- parameters[3].Value = wfactivityinfo.ActDesc;
- parameters[4].Value = wfactivityinfo.ActName;
- parameters[5].Value = wfactivityinfo.WorkFlowID;
- parameters[6].Value = wfactivityinfo.PageID;
- parameters[7].Value = wfactivityinfo.DecisionTitle;
- parameters[8].Value = wfactivityinfo.DecisionName;
- parameters[9].Value = wfactivityinfo.StartEnd;
- parameters[10].Value = wfactivityinfo.BlockFlag;
- parameters[11].Value = wfactivityinfo.ShuntFlag;
- parameters[12].Value = wfactivityinfo.ModeFlag;
- // MSDA.Open();
- // DataTable dataTable = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_Instance_ADD", parameters);
- // int WFInstanceID = Convert.ToInt32(parameters[0].Value.ToString().Trim());
- int ActivityID =0;
- try
- {
- SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_Activity_ADD", parameters);
- ActivityID = Convert.ToInt32(parameters[0].Value.ToString().Trim());
- }
- catch
- {
- ActivityID = 0;
- }
- return ActivityID;
- }
- /// <summary>
- /// 添加工作流活动实例记录
- /// </summary>
- /// <param name="wfinstanceinfo"></param>
- /// <returns></returns>
- public int WFActInsADD(WFActInsInfo wfactinsinfo)
- {
- SqlParameter[] parameters ={
- new SqlParameter ("@ActInsID",SqlDbType.Int,4),
- new SqlParameter ("@ActivityID",SqlDbType.Int ,4),
- new SqlParameter ("@CreateDate",SqlDbType.DateTime ,8),
- new SqlParameter ("@RealEndDate",SqlDbType.DateTime ,8),
- new SqlParameter ("@Status",SqlDbType.Int ,2),
- new SqlParameter ("@TheoryEndDate",SqlDbType.DateTime ,8),
- new SqlParameter ("@WfInstanceID",SqlDbType.Int,4),
- new SqlParameter ("@BlockReason",SqlDbType.VarChar ,2000),
- new SqlParameter ("@UserID",SqlDbType.Int ,4),
- new SqlParameter ("@RoleID",SqlDbType.Int ,4),
- };
- parameters[0].Direction = ParameterDirection.Output;
- parameters[1].Value = wfactinsinfo.ActivityID;
- parameters[2].Value = wfactinsinfo.CreateDate;
- parameters[3].Value = wfactinsinfo.RealEndDate;
- parameters[4].Value = wfactinsinfo.Status;
- parameters[5].Value = wfactinsinfo.TheoryEndDate;
- parameters[6].Value = wfactinsinfo.WfInstanceID;
- parameters[7].Value = wfactinsinfo.BlockReason;
- parameters[8].Value = wfactinsinfo.UserID;
- parameters[9].Value = wfactinsinfo.RoleID;
- // MSDA.Open();
- int ActInsID =0;
- try
- {
- SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_ActIns_ADD", parameters);
- ActInsID = Convert.ToInt32(parameters[0].Value.ToString().Trim());
- }
- catch
- {
- ActInsID = 0;
- }
- return ActInsID;
- }
- /// <summary>
- /// 改变当前工作流活动实例状态
- /// </summary>
- /// <param name="wfinstanceinfo"></param>
- /// <returns></returns>
- public bool WFActInsUpdata(int actinsid,int userid, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@actinsid", actinsid);
- Params.Add("@UserID", userid);
- Params.Add("@status", status);
- string sSQL = "update tb_WF_ActIns Set Status=@status,UserID=@UserID where ActInsID=@actinsid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
-
- }
- /// <summary>
- /// 获到当前活动实例对的活动
- /// </summary>
- /// <returns></returns>
- public DataView GetWFAct(int actinsid)
- {
- string sSQL = "select * from tb_WF_ActIns where ActInsID=" + actinsid;
- DataView dv = null;
- try
- {
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- }
- catch
- {
- dv = null;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- /// <summary>
- /// 改变当前工作流活动实例状态
- /// </summary>
- /// <param name="wfinstanceinfo"></param>
- /// <returns></returns>
- public bool WFActInsUpdata(int actinsid, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@actinsid", actinsid);
- Params.Add("@status", status);
- string sSQL = "update tb_WF_ActIns Set Status=@status where ActInsID=@actinsid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 根据当前活动id获取当前部门与上级角色
- /// </summary>
- /// <param name="activityid">活动ID</param>
- /// <returns></returns>
- public DataView ColonyUserGetByActId(int actid)
- {
- //string sSQL = "select a.ActivityID CurrentActID,a.RoleID CurrentRoleID,b.ActivityID ParentActID,b.RoleID ParentRoleID " +
- // " from tb_Colony_User a,tb_Colony_User b where a.ActivityID='" + actid + "' and a.ActivityID=b.ParentActID";
- SqlParameter parameter = new SqlParameter("@ActivityID", SqlDbType.Int, 4);
- parameter.Value = actid;
- DataView dv = null;
- try
- {
- MSDA.Open();
- dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_Activity_GetByActID", parameter).DefaultView;
- MSDA.Close();
- }
- catch
- {
- dv = null;
- }
- return dv;
- }
- public string GetEmpType(int EmpID)
- {
- string strEmpType = "";
- DataView dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, "select [EmpType] from [Tb_Sys_Employee] where [EmpID]=" + EmpID, null).DefaultView;
- if (dv.Count > 0)
- {
- strEmpType = dv[0]["EmpType"].ToString();
- }
- return strEmpType;
- }
- /// <summary>
- /// 根据当前活动id获取下级活动
- /// </summary>
- /// <param name="actid">活动ID</param>
- /// <returns></returns>
- public DataView ColonyUserGetByAct(int actid)
- {
- string sSQL = "select CU2.ActivityID,CU2.ParentActID,CU2.RoleID from tb_Colony_User CU1,tb_Colony_User CU2 where CU1.ParentActID=CU2.ActivityID and CU1.ActivityID='" + actid + "' ";
- DataView dv = null;
- try
- {
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- }
- catch
- {
- dv = null;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- /// <summary>
- /// 获取某一工作流的起始活动
- /// </summary>
- /// <param name="wfid"></param>
- /// <returns></returns>
- public DataView GetActivityByWFID(int wfid)
- {
- string sSQL = "select ActivityID from tb_WF_Activity where StartEnd='0' and WorkFlowID='" + wfid + "' ";
- DataView dv = null;
- try
- {
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
-
- }
- catch
- {
- dv = null;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- /// <summary>
- /// 获取某一角色所应启动的活动
- /// </summary>
- /// <param name="wfid"></param>
- /// <returns></returns>
- public DataView GetActivityPage(int wfid,int roleid)
- {
- // string sSQL = "select * from tb_WF_Activity where WorkFlowID='" + wfid +"' and ActivityID in(select ActivityID from tb_Colony_User where RoleID='" + roleid +"')";
- string sSQL = "select * from tb_WF_Activity a,tb_WF_StaticPage s where WorkFlowID='" + wfid + "' and s.StaticPageID=a.PageID and ActivityID" +
- " in(select ActivityID from tb_Colony_User where RoleID='" + roleid+"') ";
- DataView dv = null;
- try
- {
- MSDA.Open();
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- MSDA.Close();
- }
- catch
- {
- dv = null;
- }
- return dv;
- }
- /// <summary>
- /// 基层部门提交
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_JC(int projectid,string JcFName, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@JcFName", JcFName);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set JcFName=@JcFName,Status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 主管部门提交
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_Zg(int projectid, string ZgTransactor,
- string ZgFName, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@ZgTransactor", ZgTransactor);
- Params.Add("@ZgFName", ZgFName);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set ZgTransactor=@ZgTransactor,ZgFName=@ZgFName,Status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 计企部项目汇总
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_JqbX(int projectid, string JqbXTransactor,
- string JqbXFName, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@JqbXTransactor", JqbXTransactor);
- Params.Add("@JqbXFName", JqbXFName);
-
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set JqbXTransactor=@JqbXTransactor,JqbXFName=@JqbXFName,Status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 职能部门回退
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_FG_Untread(int projectid, string fg_transactoridea, string fg_transactorsignature, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
-
- Params.Add("@fg_transactoridea", fg_transactoridea);
- Params.Add("@fg_transactorsignature", fg_transactorsignature);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set Fg_TransactorIdea=@fg_transactoridea,Fg_TransactorSignature=@fg_transactorsignature,Status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///计企部计划清单
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_JqbB(int projectid, string JqbBTransactor, string JqbBFName, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@JqbBTransactor", JqbBTransactor);
- Params.Add("@JqbBFName", JqbBFName);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set JqbBTransactor=@JqbBTransactor,JqbBFName=@JqbBFName,status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///财务部回退
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_CW_Untread(int projectid, string cw_TransactorSignature, string cw_Idea)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@cw_TransactorSignature", cw_TransactorSignature);
- Params.Add("@cw_Idea", cw_Idea);
- string sSQL = "update tb_Project Set cw_TransactorSignature=@cw_TransactorSignature,cw_Idea=@cw_Idea where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 分管领导审核
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_Gcgl(int projectid, string GcglHTransactor, string GcglHFName, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@GcglHTransactor", GcglHTransactor);
- Params.Add("@GcglHFName", GcglHFName);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set GcglHTransactor=@GcglHTransactor,GcglHFName=@GcglHFName,Status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 分管领导回退
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_ZJL_Untread(int projectid, string zjl_transactoridea, string zjl_transactorsignature, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
-
- Params.Add("@zjl_transactoridea", zjl_transactoridea);
- Params.Add("@zjl_transactorsignature", zjl_transactorsignature);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set Zjl_TransactorIdea=@zjl_transactoridea,Zjl_TransactorSignature=@zjl_transactorsignature,Status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///分管领导审核
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_Fg(int projectid, string FgTransactor, string FgIdea, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@FgTransactor", FgTransactor);
- Params.Add("@FgIdea", FgIdea);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set FgTransactor=@FgTransactor,FgIdea=@FgIdea,status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///工程预算委员会审批
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_Zjwyh(int projectid, string ZjwyhTransactor, string ZjwyhIdea, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@ZjwyhTransactor", ZjwyhTransactor);
- Params.Add("@ZjwyhIdea", ZjwyhIdea);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set ZjwyhTransactor=@ZjwyhTransactor,ZjwyhIdea=@ZjwyhIdea,status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///公司领导回退
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_LD_Untread(int projectid, string Ld_TransactorSignature, string Ld_Idea)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@Ld_TransactorSignature", Ld_TransactorSignature);
- Params.Add("@Ld_Idea", Ld_Idea);
- string sSQL = "update tb_Project Set Ld_TransactorSignature=@Ld_TransactorSignature,Ld_Idea=@Ld_Idea where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///计企部初次审核
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_JQP_GcglX(int projectid, string GcglXTransactor, string GcglXFName, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@GcglXTransactor", GcglXTransactor);
- Params.Add("@GcglXFName", GcglXFName);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set GcglXTransactor=@GcglXTransactor,GcglXFName=@GcglXFName,status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///计企部回退
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_JQP_Untread(int projectid, string Jqb_TransactorSignature, string Jqb_Idea)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@Jqb_TransactorSignature", Jqb_TransactorSignature);
- Params.Add("@Jqb_Idea", Jqb_Idea);
- string sSQL = "update tb_Project Set Jqb_TransactorSignature=@Jqb_TransactorSignature,Jqb_Idea=@Jqb_Idea where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///公司领导审批
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_Gs(int projectid, string GsTransactor, string GsIdea, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@GsTransactor", GsTransactor);
- Params.Add("@GsIdea", GsIdea);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set GsTransactor=@GsTransactor,GsIdea=@GsIdea,Status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///工程办公室领导审批
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_GcglQ(int projectid, string GcglQTransactor, string GcglQIdea, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@GcglQTransactor", GcglQTransactor);
- Params.Add("@GcglQIdea", GcglQIdea);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set GcglQTransactor=@GcglQTransactor,GcglQIdea=@GcglQIdea,Status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///计企部正式发文
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_JqbZ(int projectid, string JqbZTransactor, string JqbZFName, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@JqbZTransactor", JqbZTransactor);
- Params.Add("@JqbZFName", JqbZFName);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set JqbZTransactor=@JqbZTransactor,JqbZFName=@JqbZFName,Status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 获取上级活动记录
- /// </summary>
- /// <param name="activityid">当前活动事例ID</param>
- /// <returns></returns>
- public DataView ActivityGetByActInsId(int ActInsID)
- {
- string sSQL = " select AC1.ActivityID PreviousActID,AC1.UserID PreviousUserID,AC1.RoleID PreviousRoleID,AC1.ActInsID PreviousActInsID from tb_wf_actins AC1 where AC1.ActivityID in( " +
- "select ActivityID from tb_Colony_User where ParentActID in(" +
- "select AC.ActivityID from tb_wf_actins AC where AC.ActInsID='" + ActInsID+ "')) and AC1.WfInstanceID in" +
- "(select AC2.WfInstanceID from tb_wf_actins AC2 where AC2.ActInsID='" + ActInsID + "')";
- DataView dv = null;
- try
- {
- MSDA.Open();
- dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text,sSQL, null).DefaultView;
- MSDA.Close();
- }
- catch
- {
- dv = null;
- }
- return dv;
- }
- /// <summary>
- /// 获取基层部门员工提交申请人业务角色
- /// </summary>
- /// <param name="activityid">当前活动ID</param>
- /// <returns></returns>
- public DataView ActDeptIDGetByActId(int ActID)
- {
- string sSQL = " select CU1.ActivityID,CU1.RoleID from tb_Colony_User CU1,tb_Colony_User CU2 " +
- " where CU1.ActivityID=CU2.ParentActID and CU2.ActivityID='" + ActID + "' ";
- DataView dv = null;
- try
- {
- MSDA.Open();
- dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, sSQL, null).DefaultView;
- MSDA.Close();
- }
- catch
- {
- dv = null;
- }
- return dv;
- }
- /// <summary>
- /// 退回时,改变前一活动状态
- /// </summary>
- /// <param name="Status">0、正常;1、完成;2、回退;3、回退并完成;4、作废</param>
- /// <returns></returns>
- public bool ActInsStatusChange(int WfInstanceID, int ActivityID, int Status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@WfInstanceID", WfInstanceID);
- Params.Add("@ActivityID", ActivityID);
- Params.Add("@Status", Status);
- string sSQL = "update tb_WF_ACtIns set Status=@Status where WfInstanceID=@WfInstanceID and ActivityID=@ActivityID";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- ///// <summary>
- ///// 获取物资第一下拉列表
- ///// </summary>
- //public SqlDataReader WZGetAll()
- //{
- // string connStr = ConfigurationSettings.AppSettings["SqlConnection2"].ToString();
- // SqlConnection conn = new SqlConnection(connStr);
- // // 绑定第一级下拉列表
- // string commStr1 = string.Format("select wz_code1,wz_namecode1 from wz_code1");
- // SqlCommand comm1 = new SqlCommand(commStr1, conn);
- // conn.Open();
- // //DataView dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, commStr1, null).DefaultView;
-
- // SqlDataReader dr = comm1.ExecuteReader();
-
-
- // return dr;
-
- //}
- ///// <summary>
- ///// 获取物资第一下拉列表
- ///// </summary>
- //public SqlDataReader WZGetByCode1(int wz_code1)
- //{
- // string connStr = ConfigurationSettings.AppSettings["SqlConnection2"].ToString();
- // string sSQL = "select wz_code1,wz_namecode2 from wz_code2 where wz_code1='" + wz_code1 + "'";
- // SqlConnection conn = new SqlConnection(connStr);
- // SqlCommand comm1 = new SqlCommand(sSQL, conn);
- // conn.Open();
- // SqlDataReader dr = comm1.ExecuteReader();
- // return dr;
- //}
- /// <summary>
- /// 添加设备费记录
- /// </summary>
- /// <returns>返回一bool类型值</returns>
- public bool ProEquAdd(string UnitName, int wz_id, string EquipmentName, int Number, int ProjectID, decimal Price, string EquipmentSize, string NumberHistory, string PriceHistory)
- {
- string sSQL = "insert into tb_Project_Equipment([UnitName],[wz_id],[EquipmentName],[Number],[ProjectID],[Price],[EquipmentSize],[NumberHistory],[PriceHistory]) values " +
- "('" + UnitName + "', '" + wz_id + "','" + EquipmentName + "','" + Number + "','" + ProjectID + "','" + Price + "','" + EquipmentSize + "','" + NumberHistory + "','" + PriceHistory + "')";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.insert(sSQL, null, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 修改设备费记录
- /// </summary>
- /// <returns>返回一bool类型值</returns>
- public bool ProEquUpdata(int EquipmentID,string UnitName, int wz_id, string EquipmentName, int Number, int ProjectID, decimal Price, string EquipmentSize, string NumberHistory, string PriceHistory)
- {
- string sSQL = "update tb_Project_Equipment Set UnitName='" + UnitName + "'," + "wz_id='" + wz_id + "'," + "EquipmentName='" + EquipmentName + "'," + "Number='" + Number + "'," +
- "ProjectID='" + ProjectID + "'," + "Price='" + Price + "'," + "EquipmentSize='" + EquipmentSize + "'," + "NumberHistory='" +
- NumberHistory + "'," + "PriceHistory='" + PriceHistory + "' where EquipmentID='" + EquipmentID + "'";
-
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, null, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 获取设备费记录
- /// </summary>
- //////public DataView ProEquGetById(int ProjectID)
- //////{
- ////// string sSQL = "select * from tb_Project_Equipment where ProjectID='" + ProjectID + "'";
- ////// MSDA.Open();
- ////// NewObj newobject = new NewObj();
- ////// DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- ////// MSDA.Close();
- ////// return dv;
- //////}
- /// <summary>
- /// 删除设备费记录
- /// </summary>
- /// <param name="userid">设备ID</param>
- public bool ProEquDelete(int EquipmentID)
- {
- string sSQL = "delete from tb_Project_Equipment where [EquipmentID]=" + EquipmentID;
- bool bl = false;
- try
- {
- MSDA.Open();
- MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
- bl = true;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return bl;
- }
- /// <summary>
- /// 添加材料费记录
- /// </summary>
- /// <returns>返回一bool类型值</returns>
- public bool ProMaterialAdd(decimal BudGetPrice, decimal DifferencePrice, decimal DifferencePriceSum, decimal MarketPrice,
- string Memo, string MeterialName, int Number, string UnitName,int ProjectID)
- {
- string sSQL = "insert into tb_Project_Material([BudGetPrice],[DifferencePrice],[DifferencePriceSum],[MarketPrice],[Memo],[MeterialName],[Number],[UnitName],[ProjectID]) values " +
- "('" + BudGetPrice + "', '" + DifferencePrice + "','" + DifferencePriceSum + "','" + MarketPrice + "','" + Memo + "','" + MeterialName + "','" + Number + "','" + UnitName + "','" + ProjectID + "')";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.insert(sSQL, null, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 修改材料费记录
- /// </summary>
- /// <returns>返回一bool类型值</returns>
- public bool ProMaterialUpdata(int MaterialID, decimal BudGetPrice, decimal DifferencePrice, decimal DifferencePriceSum, decimal MarketPrice,
- string Memo, string MeterialName, int Number, string UnitName, int ProjectID)
- {
- string sSQL = "update tb_Project_Material Set BudGetPrice='" + BudGetPrice + "'," + "DifferencePrice='" + DifferencePrice + "'," + "DifferencePriceSum='" + DifferencePriceSum + "'," + "MarketPrice='" + MarketPrice + "'," +
- "Memo='" + Memo + "'," + "MeterialName='" + MeterialName + "'," + "Number='" + Number + "'," + "UnitName='" +
- UnitName + "'," + "ProjectID='" + ProjectID + "' where MaterialID='" + MaterialID + "'";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, null, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 删除材料费记录
- /// </summary>
- /// <param name="userid">设备ID</param>
- public bool ProMaterialDelete(int MaterialID)
- {
- string sSQL = "delete from tb_Project_Material where [MaterialID]=" + MaterialID;
- bool bl = false;
- try
- {
- MSDA.Open();
- MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
- bl = true;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return bl;
-
- }
-
- /// <summary>
- /// 材料费记录
- /// </summary>
- public DataView ProMaterialGetById(int ProjectID)
- {
- string sSQL = "select * from tb_Project_Material where ProjectID=" + ProjectID;
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- MSDA.Close();
- return dv;
- }
- ///// <summary>
- ///// 获取材料费记录
- ///// </summary>
- //public string BudGetPriceGetByWzId(int wzid)
- //{
- // string connStr = ConfigurationSettings.AppSettings["SqlConnection2"].ToString();
- // string sSQL = "select * from material_name where wz_id='" + wzid + "'";
- // SqlConnection conn = new SqlConnection(connStr);
- // SqlCommand comm1 = new SqlCommand(sSQL, conn);
- // conn.Open();
- // SqlDataReader dr = comm1.ExecuteReader();
- // string wz_plan = "";
- // while (dr.Read())
- // {
- // wz_plan=dr["wz_plan"].ToString();
- // }
- // dr.Close();
- // return wz_plan;
- //}
- /// <summary>
- /// 添加其它费用记录
- /// </summary>
- /// <returns>返回一bool类型值</returns>
- public bool ProOtherAdd(string Explain, string OtherName, string Memo, decimal Price, int ProjectID)
- {
- string sSQL = "insert into tb_Project_Other([Explain],[OtherName],[Memo],[Price],[ProjectID]) values " +
- "('" + Explain + "', '" + OtherName + "','" + Memo + "','" + Price + "','" + ProjectID + "')";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.insert(sSQL, null, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 修改其它费用记录
- /// </summary>
- /// <returns>返回一bool类型值</returns>
- public bool ProOtherUpdata(int OtherID, string Explain, string OtherName, string Memo, decimal Price, int ProjectID)
- {
- string sSQL = "update tb_Project_Other Set Explain='" + Explain + "'," + "OtherName='" + OtherName + "'," + "Memo='" + Memo + "'," + "Price='" + Price + "'," +
- "ProjectID='" + ProjectID + "' where OtherID='" + OtherID + "'";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, null, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 删除其它费用记录
- /// </summary>
- /// <param name="userid">设备ID</param>
- public void ProOtherDelete(int OtherID)
- {
- string sSQL = "delete from tb_Project_Other where [OtherID]='" + OtherID + "'";
- MSDA.Open();
- MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
- MSDA.Close();
- }
- /// <summary>
- /// 其它费用记录集合
- /// </summary>
- public DataView ProOtherGetAll(int ProjectID)
- {
- string sSQL = "select * from tb_Project_Other where ProjectID='" + ProjectID + "'";
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- MSDA.Close();
- return dv;
- }
- /// <summary>
- /// 其它费用单条记录
- /// </summary>
- public DataView ProOtherGetById(int OtherID)
- {
- string sSQL = "select * from tb_Project_Other where OtherID='" + OtherID + "'";
- MSDA.Open();
- NewObj newobject = new NewObj();
- DataView dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- MSDA.Close();
- return dv;
- }
- /// <summary>
- /// 查找设备费用
- /// </summary>
- /// <param name="projectid">项目ID</param>
- /// <param name="WZType">查找类型,1:物资代码;2:规格型号</param>
- /// <param name="searchContent">查找内容</param>
- /// <returns></returns>
- public DataView GetWZByConditions(int projectid, string WZType, string searchContent)
- {
- string strSqlText = "select * from tb_Project_Equipment where ProjectID='" + projectid +"' " ;
- switch (WZType)
- {
- case "1":
- strSqlText = strSqlText + " and wz_id like '%" + searchContent + "%'";
- goto Label_00B9;
- case "2":
- strSqlText = strSqlText + " and EquipmentSize like '%" + searchContent + "%'";
- goto Label_00B9;
- }
-
-
- Label_00B9:
- return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null).DefaultView;
- }
- /// <summary>
- /// 获取当前用户所在部门OrgcID记录
- /// </summary>
- /// <param name="OrgID"></param>
- /// <returns></returns>
- public string GetOrgcID(int UserID)
- {
- SqlParameter parameter = new SqlParameter("@UserID", SqlDbType.Int, 4);
- parameter.Value = UserID;
- string str = "";
- try
- {
- DataView dv = null;
- dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "P_WF_GetOrgcID", parameter).DefaultView;
- str = dv[0]["OrgcID"].ToString();
- }
- catch
- {
- str = "";
- }
- finally
- {
- MSDA.Close();
- }
- return str;
- }
- /// <summary>
- /// 工作流任务完成
- /// </summary>
- /// <returns>返回一bool类型值</returns>
- public bool WF_End(string EndDesc, string EndName, int EndX, int EndY, int WorkFlowID, int STATUS, int PrjID)
- {
- string sSQL = "insert into tb_WF_End([EndDesc],[EndName],[EndX],[EndY],[WorkFlowID],[STATUS],[PrjID]) values " +
- "('" + EndDesc + "', '" + EndName + "','" + EndX + "','" + EndY + "','" + WorkFlowID + "','" + STATUS + "','" + PrjID + "')";
- bool returnvalue=false;
- try
- {
- MSDA.Open();
- NewObj newobject = new NewObj();
- returnvalue = newobject.insert(sSQL, null, CommandType.Text);
- }
- catch
- {
- returnvalue = false;
- }
- finally
- {
- MSDA.Close();
- }
-
- return returnvalue;
- }
- /// <summary>
- /// 获取某一普通员工的业务主管
- /// </summary>
- /// <returns></returns>
- public DataView GetParentEmp(int EmpID)
- {
- // string sSQL = "select * from Tb_Sys_Employee where EmpID=" + EmpID;
- string sSQL = "select * from tb_Sys_User where EmpID in (select ParentEmp from Tb_Sys_Employee where EmpID=" + EmpID +")";
- DataView dv = null;
- MSDA.Open();
- try
- {
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- }
- catch (Exception ex)
- {
- dv = null;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- /// <summary>
- ///判断某一员工是否是业务主管
- /// </summary>
- /// <returns>返回bool类型</returns>
- public bool ParentEmp(int UserID)
- {
- string sSQL = "select * from tb_sys_Employee where ParentEmp=(select EmpID from tb_sys_user where userid=" + UserID + ")";
- DataView dv = null;
- MSDA.Open();
- try
- {
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- if (dv.Count == 0)
- dv = null;
- }
- catch (Exception ex)
- {
- dv = null;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- if (dv != null)
- return true;
- else
- return false;
-
- }
- /// <summary>
- /// 获取领导名单
- /// </summary>
- /// <returns></returns>
- public DataView GetEmpLD(int OpID)
- {
- //string sSQL = "select UserID,EmpID from tb_Sys_User where EmpID in (select EmpID from tb_Sys_EmpOpRole where OpID=7)";
- string sSQL = "select UserID,EmpName from tb_Sys_User U,Tb_Sys_Employee E where U.EmpID in (select EmpID from tb_Sys_EmpOpRole where OpID=" + OpID + ") and U.EmpID=E.EmpID";
- DataView dv = null;
- MSDA.Open();
- try
- {
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- }
- catch (Exception ex)
- {
- dv = null;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- public DataTable GetWFPerissionList()
- {
- string strSqlText= "select p.[PermID],p.[DisplayName],p.[DefaultPage] from Tb_Sys_Permission p where ParentresCode='2'";
- return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- }
- /// <summary>
- ///返回某活动实例状态
- /// </summary>
- /// <returns></returns>
- public DataView GetActInsStatus(int actinsid)
- {
- string sSQL = "select * from tb_wf_actins where ActInsID=" + actinsid;
- DataView dv = null;
- MSDA.Open();
- try
- {
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- }
- catch (Exception ex)
- {
- dv = null;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- /// <summary>
- ///返回某活动状态
- /// </summary>
- /// <returns></returns>
- public DataView GetActMustChooseItem(int actid)
- {
- string sSQL = "select * from tb_WF_Activity AC,tb_WF_StaticPage SP where AC.PageID=SP.StaticPageID and ActivityID=" + actid;
- DataView dv = null;
- MSDA.Open();
- try
- {
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- }
- catch (Exception ex)
- {
- dv = null;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- /// <summary>
- ///清除未提交申请
- /// </summary>
- /// <param name="ActivityID">起始活动</param>
- public void ProInit(int ActivityID)
- {
- string strSQL = "select ActInsID,CreateDate,WFInstanceID from tb_WF_ActIns where ActivityID=" + ActivityID + " and Status=0";
- MSDA.Open();
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- NewObj newobject = new NewObj();
- DataView dv = null;
- dv= newobject.Search(strSQL, null, CommandType.Text).Tables[0].DefaultView;
- for (int i = 0; i < dv.Count; i++)
- {
- DateTime CreateDate = DateTime.Parse(dv[i]["CreateDate"].ToString().Trim());
- TimeSpan ts = DateTime.Parse(DateTime.Now.ToShortDateString()) - CreateDate;
- if ( ts.Days>= 7)
- {
- int WFInstanceID = Convert.ToInt16(dv[i]["WFInstanceID"].ToString().Trim());
-
- string strSQLIns = "select * from tb_WF_Instance where WFInstanceID=" + WFInstanceID;
- DataView dvInstance = null;
- dvInstance = newobject.Search(strSQLIns, null, CommandType.Text).Tables[0].DefaultView;
- if (dvInstance.Count == 0)
- continue;
- int PrjID=Convert.ToInt16(dvInstance[0]["PrjID"].ToString().Trim());
- //删除项目记录
- string strSQLProject = "delete from tb_Project where ProjectID=" + PrjID;
- MSDA.ExecuteNonQuery(CommandType.Text, strSQLProject, null);
- //删除设备费用记录
- string strSQLPrjEquipment = "delete from tb_Project_Equipment where ProjectID=" + PrjID;
- MSDA.ExecuteNonQuery(CommandType.Text, strSQLPrjEquipment, null);
- //删除材料费用记录
- string strSQLPrjMaterialt = "delete from tb_Project_Material where ProjectID=" + PrjID;
- MSDA.ExecuteNonQuery(CommandType.Text, strSQLPrjMaterialt, null);
- //删除其它费用记录
- string strSQLPrjOther = "delete from tb_Project_Other where ProjectID=" + PrjID;
- MSDA.ExecuteNonQuery(CommandType.Text, strSQLPrjOther, null);
- //删除工作流实例
- string strSQLInstance = "delete from tb_WF_Instance where WFInstanceID=" + WFInstanceID;
- MSDA.ExecuteNonQuery(CommandType.Text, strSQLInstance, null);
- //删除活动实例
- int ActInsID = Convert.ToInt16(dv[i]["ActInsID"].ToString().Trim());
- string strSQLActIns = "delete from tb_WF_ActIns where ActInsID=" + ActInsID;
- MSDA.ExecuteNonQuery(CommandType.Text, strSQLActIns, null);
- }
- }
-
-
- tran.Commit();
- }
- catch (Exception ex)
- {
- tran.Rollback();
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- /// <summary>
- ///返回项目分类情况
- /// </summary>
- /// <returns></returns>
- public DataView GetPrjSerial()
- {
- string sSQL = "select P.ProjectSort SerialName, count(*) num,sum(ChargeSum) ChargeSum from tb_Project P,tb_Project_Serial PS where P.ProjectSort=PS.SerialName group by P.ProjectSort ";
- DataView dv = null;
- MSDA.Open();
- try
- {
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- }
- catch (Exception ex)
- {
- dv = null;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- /// <summary>
- ///返回工程项目预算表(电子文档)
- /// </summary>
- /// <returns></returns>
- public DataView GetSFileName(int activityid)
- {
- string sSQL = "select * from tb_Colony_FileName where ActivityID=" + activityid;
- DataView dv = null;
- MSDA.Open();
- try
- {
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- }
- catch (Exception ex)
- {
- dv = null;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- /// <summary>
- /// 回退时,更改项目状态
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool Project_Untread(int projectid,int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@projectid", projectid);
- Params.Add("@status", status);
- string sSQL = "update tb_Project Set Status=@status where ProjectID=@projectid";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- ///// <summary>
- /////判断是否有同名项目
- ///// </summary>
- ///// <returns>返回bool类型值</returns>
- //public bool IfSnPrjName(string PrjName)
- //{
- // string sSQL = "select * from tb_Project where ProjectName='" + PrjName + "'";
- // DataView dv = null;
- // bool re=true;
- // MSDA.Open();
- // try
- // {
- // NewObj newobject = new NewObj();
- // dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- // if (dv != null)
- // re = true;
- // else
- // re = false;
- // }
- // catch (Exception ex)
- // {
- // re = true;
- // throw ex;
- // }
- // finally
- // {
- // MSDA.Close();
- // }
- // return re;
- //}
- //项目查询根据状态和类型
- public DataView PrjQueryZ(int PrjSort,int Status)
- {
- DataView dv = new DataView();
- string strSQL;
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- if (PrjSort < -1 || PrjSort == 0)
- {
- PrjSort = -212; //没有数据
- }
- if (Status < -1)
- {
- Status = -212; //没有数据
- }
- strSQL = "select * from tb_Project";
- if (PrjSort != -1)
- strSQL = strSQL + " where PrjSort=" + PrjSort;
- if (Status != -1)
- {
- if (PrjSort != -1)
- strSQL = strSQL + " and Status=" + Status;
- else
- strSQL = strSQL + " where Status=" + Status;
- }
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
-
- /// <summary>
- /// 起始活动.
- /// </summary>
- /// <returns></returns>
- public static int ActivityIDGetByWFID(int WfId)
- {
- EtongZwf etongzwf = new EtongZwf();
- DataView dvActivity = etongzwf.GetActivityByWFID(WfId);
- if (dvActivity.Count != 0)
- {
- int activity = Convert.ToInt32(dvActivity[0][0].ToString().Trim());
- return activity;
- }
- else
- return 0;
- }
- /// <summary>
- /// 用最新日期生成最新文档
- /// </summary>
- /// <param name="filename"></param>
- /// <returns></returns>
- public static string MakeNewFileNameWithDate(string filename)
- {
- if (filename.Length > 0)
- {
- string[] a = filename.Split('.');
- return a[0] + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + "." + a[1];
- }
- else
- return "";
- }
- /// <summary>
- /// 得到指定活动的文档名称
- /// </summary>
- /// <param name="activityid"></param>
- /// <returns></returns>
- public static ArrayList GetDocumentFileName(int activityid)
- {
- // string sql = "select [SFileName] from [tb_Colony_FileName] where [ActivityID]=" + activityid;
- string sql = "select * from [tb_Sys_FileName] where [FID] in (select FID from tb_Colony_FileName1 where ActivityID=" +activityid +")";
- // string tempfilename = "";
- DataView dv = SqlServer.GetDataView(sql);
- ArrayList al = new ArrayList();
- if (dv != null && dv.Count > 0)
- {
- for (int i = 0; i < dv.Count; i++)
- {
- string filename = dv[i]["FName"].ToString();
- if (filename.Length >= 5)
- {
- // tempfilename = filename.Substring(filename.LastIndexOf("\\") + 2);
- al.Add(filename);
- }
- }
- }
- return al;
- }
- /// <summary>
- /// 获取当前活动状态
- /// </summary>
- /// <param name="ActID"></param>
- /// <returns></returns>
- public static string GetStatus(int ActID)
- {
- EtongZwf etongzwf = new EtongZwf();
- try
- {
- DataView dvAct = etongzwf.GetWFAct(ActID);
- string Status = dvAct[0]["Status"].ToString().Trim();
- return Status;
- }
- catch
- { return ""; }
- }
- /// <summary>
- /// 获取 工程变更和调整 项目
- /// </summary>
- /// <param name="wfid"></param>
- /// <returns></returns>
- public DataView GetPrjAlert(int wfinstanceid)
- {
- //string sSQL = "select C.ConName,P.* from tb_construct C,tb_PrjAlert P where C.ConID " +
- // "in(select PrjID from tb_WF_Instance where WFInstanceID=" + wfinstanceid + ") and C.ConID=P.ConID";
- string sSQL = "select * from tb_PrjAlert where AlertID in(select PrjID from tb_WF_Instance where WFInstanceID=" + wfinstanceid + ")";
- DataView dv = null;
- try
- {
- MSDA.Open();
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- MSDA.Close();
- }
- catch
- {
- dv = null;
- }
- return dv;
- }
- /// <summary>
- /// 获取 工程计划项目
- /// </summary>
- /// <param name="wfid"></param>
- /// <returns></returns>
- public DataView GetProject(int wfinstanceid)
- {
- string sSQL = "select * from tb_Project where PrjSort in(select PrjID from tb_WF_Instance where WFInstanceID=" + wfinstanceid + ")";
- DataView dv = null;
- try
- {
- MSDA.Open();
- NewObj newobject = new NewObj();
- dv = newobject.Search(sSQL, null, CommandType.Text).Tables[0].DefaultView;
- MSDA.Close();
- }
- catch
- {
- dv = null;
- }
- return dv;
- }
- /// <summary>
- ///工程变更和调整 基层部门
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool PrjAlert_JC(int AlertID, string JcTransactor, string JcFName, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@AlertID", AlertID);
- Params.Add("@JcTransactor", JcTransactor);
- Params.Add("@JcFName", JcFName);
- Params.Add("@status", status);
- string sSQL = "update tb_PrjAlert Set JcTransactor=@JcTransactor,JcFName=@JcFName,Status=@status where AlertID=@AlertID";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///工程变更和调整 主管部门
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool PrjAlert_Zg(int AlertID, string ZgTransactor, string ZgFName, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@AlertID", AlertID);
- Params.Add("@ZgTransactor", ZgTransactor);
- Params.Add("@ZgFName", ZgFName);
- Params.Add("@status", status);
- string sSQL = "update tb_PrjAlert Set ZgTransactor=@ZgTransactor,ZgFName=@ZgFName,Status=@status where AlertID=@AlertID";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///工程变更和调整 工程管理办公室
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool PrjAlert_Gcgl(int AlertID, string GcglTransactor, string GcglIdea, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@AlertID", AlertID);
- Params.Add("@GcglTransactor", GcglTransactor);
- Params.Add("@GcglIdea", GcglIdea);
- Params.Add("@status", status);
- string sSQL = "update tb_PrjAlert Set GcglTransactor=@GcglTransactor,GcglIdea=@GcglIdea,Status=@status where AlertID=@AlertID";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- ///工程变更和调整 分管领导审批
- /// </summary>
- /// <returns>返回bool类型参数</returns>
- public bool PrjAlert_Fg(int AlertID, string FgTransactor, string FgIdea, int status)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@AlertID", AlertID);
- Params.Add("@FgTransactor", FgTransactor);
- Params.Add("@FgIdea", FgIdea);
- Params.Add("@status", status);
- string sSQL = "update tb_PrjAlert Set FgTransactor=@FgTransactor,FgIdea=@FgIdea,Status=@status where AlertID=@AlertID";
- MSDA.Open();
- NewObj newobject = new NewObj();
- bool returnvalue = newobject.Update(sSQL, Params, CommandType.Text);
- MSDA.Close();
- return returnvalue;
- }
- /// <summary>
- /// 获取项目施工流程ID
- /// </summary>
- /// <param name="OrgID"></param>
- /// <returns></returns>
- public int GetConWfID()
- {
- string sql = " select WFID from tb_WorkFlowRouter where RouID=4";
- int wfid = -1;
- DataView dv = SqlServer.GetDataView(sql);
- if (dv != null && dv.Count > 0)
- {
- wfid = Convert.ToInt16(dv[0]["WFID"].ToString().Trim());
- }
- return wfid;
- }
- /// <summary>
- /// 变更项目查询
- /// </summary>
- /// <returns>返回DataView类型</returns>
- public DataView StatusSearchPrjAlert()
- {
- DataView dv=null;
- try
- {
- MSDA.Open();
- DataSet ds = SqlHelper.ExecuteDataSet(SqlHelper.connectionString, CommandType.StoredProcedure, "P_GetStatusPrjAlert", null);
- dv = ds.Tables[0].DefaultView;
- }
- catch
- {
- dv=null;
- }
- finally
- {
- MSDA.Close();
- }
-
- return dv;
- }
- /// <summary>
- /// 查询PrjAlert
- /// </summary>
- /// <returns>返回一dataset类型值</returns>
- public DataView AllStatusSearchPrjAlert(int AlertID)
- {
- DataView dv = null;
- try
- {
- MSDA.Open();
- SqlParameter paramter = new SqlParameter("@PrjID", SqlDbType.Int, 4);
- paramter.Value = AlertID;
- DataSet ds = SqlHelper.ExecuteDataSet(SqlHelper.connectionString, CommandType.StoredProcedure, "P_GetAllStatusPrjAlert", paramter);
- dv = ds.Tables[0].DefaultView;
- }
- catch
- {
- dv = null;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- public DataView AllStatusSearch(int PrjID)
- {
- DataView dv = null;
- try
- {
- MSDA.Open();
- SqlParameter paramter = new SqlParameter("@PrjID", SqlDbType.Int, 4);
- paramter.Value = PrjID;
- DataSet ds = SqlHelper.ExecuteDataSet(SqlHelper.connectionString, CommandType.StoredProcedure, "P_GetAllStatus",paramter);
- dv = ds.Tables[0].DefaultView;
- }
- catch
- {
- dv = null;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- /// <summary>
- /// 获取指定流程的启始活动
- /// </summary>
- /// <param name="RouID">1:变更材料 4:施工工作流</param>
- /// <returns></returns>
- public DataView ActivityColony_User(int RouID)
- {
- string sSQL = "select * from tb_Colony_User where ActivityID in(select ActivityID from tb_WF_Activity where "
- + "WorkFlowID in(select WFID from tb_WorkFlowRouter where RouID=" + RouID + ") and StartEnd=0) ";
- DataView dv = null;
- try
- {
- MSDA.Open();
- dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, sSQL, null).DefaultView;
- MSDA.Close();
- }
- catch
- {
- dv = null;
- }
- return dv;
- }
- /// <summary>
- /// 获取指定活动所属类型
- /// </summary>
- /// <param name="RouID">1: 4:施工工作流</param>
- /// <returns></returns>
- public DataView ActInsSort(int actinsid)
- {
- string sSQL = "select * from tb_WF_ActIns where ActInsID=" + actinsid;
- DataView dv = null;
- try
- {
- MSDA.Open();
- dv = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, sSQL, null).DefaultView;
- MSDA.Close();
- }
- catch
- {
- dv = null;
- }
- return dv;
- }
- /// <summary>
- /// 操作电子文档权限
- /// </summary>
- /// <param name="EmpID">员工ID</param>
- /// <returns></returns>
- public static ArrayList GetSFileNamePerm(int EmpID)
- {
- string sSQL = "select * from tb_Sys_FileName where FID in(select FID from tb_WF_RoleFName where OpID "
- + " in(select OpID from Tb_Sys_EmpOpRole where EmpID= " + EmpID + "))";
- DataView dv = SqlServer.GetDataView(sSQL);
- ArrayList al = new ArrayList();
- if (dv != null && dv.Count > 0)
- {
- for (int i = 0; i < dv.Count; i++)
- {
- string FileId = dv[i]["FName"].ToString();
- al.Add(FileId);
- }
- }
- return al;
- }
- /// <summary>
- /// 获取某业务角色对应的类型
- /// </summary>
- /// <param name="opid">业务角色ID</param>
- /// <returns></returns>
- public static string GetOpRole(int opid)
- {
- string str = "";
- string sSQL = "select * from Tb_Sys_OpRole Where OpID=" + opid;
- try
- {
- DataView dv = SqlServer.GetDataView(sSQL);
- if (dv != null && dv.Count > 0)
- {
- str = dv[0]["OrgDesc"].ToString();
- }
- }
- catch
- {
- str = "";
- }
- return str;
- }
- /// <summary>
- /// 写数据到XML文件中
- /// </summary>
- /// <param name="XMLFileName">要打开的XML文件</param>
- /// <param name="DocFileName">写入DOC文件名</param>
- /// <param name="EmpName">操作人用户名</param>
- /// <param name="Date">操作日期时间</param>
- public void WriteXML(string XMLFileName, string DocFileName, string EmpName, string OpSort, string Date)
- {
- //初始化XML文档操作类
- XmlDocument mydoc = new XmlDocument();
- //加载指定的XML文件
- mydoc.Load(XMLFileName);
- //添加元素-DOC文件名
- XmlElement ele = mydoc.CreateElement("DocFileName");
- XmlText text = mydoc.CreateTextNode(DocFileName);
- //添加元素-操作人用户名
- XmlElement ele1 = mydoc.CreateElement("EmpName");
- XmlText text1 = mydoc.CreateTextNode(EmpName);
- //添加元素-操作人类型
- XmlElement ele3 = mydoc.CreateElement("OpSort");
- XmlText text3 = mydoc.CreateTextNode(OpSort);
- //添加元素-操作日期时间
- XmlElement ele2 = mydoc.CreateElement("Date");
- XmlText text2 = mydoc.CreateTextNode(Date);
-
- //添加文件的节点-msgrecord
- XmlNode newElem = mydoc.CreateNode("element", "XMLrecord", "");
- //在节点中添加元素
- newElem.AppendChild(ele);
- newElem.LastChild.AppendChild(text);
- newElem.AppendChild(ele1);
- newElem.LastChild.AppendChild(text1);
- newElem.AppendChild(ele3);
- newElem.LastChild.AppendChild(text3);
- newElem.AppendChild(ele2);
- newElem.LastChild.AppendChild(text2);
- //将节点添加到文档中
- XmlElement root = mydoc.DocumentElement;
- root.AppendChild(newElem);
- //保存所有修改
- mydoc.Save(XMLFileName);
- }
- /// <summary>
- /// 判断 (或同类型的) 上级活动实例是否产生
- /// </summary>
- /// <param name="Actid">当前活动ID</param>
- /// <param name="WfInstanceID">当前工作流实例</param>
- /// <param name="IOpsort">是否要据类型查找</param>
- /// <param name="Opsort">类型</param>
- /// <returns>返回bool类型值</returns>
- public bool CheckUpActCompleteActIns(int Actid, int WfInstanceID, bool IOpsort, string Opsort)
- {
- bool bl = true;
- DataView dv = new DataView();
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- try
- {
- string sSQL = "select * from tb_WF_ActIns where ActivityID in (select ActivityID from tb_Colony_User where ParentActID=" + Actid + ") and WfInstanceID=" + WfInstanceID;
- MSDA.Open();
- if(IOpsort==true)
- sSQL = "select * from tb_WF_ActIns where ActivityID in (select ActivityID from tb_Colony_User where ParentActID=" + Actid + ") and WfInstanceID=" + WfInstanceID + " and BlockReason='" + Opsort +"'";
-
- dv = MSDA.ExecuteDataView(CommandType.Text, sSQL, null);
- if (dv.Table.Rows.Count > 0)
- {
- for (int i = 0; i < dv.Table.Rows.Count; i++)
- {
- if (Convert.ToInt32(dv.Table.Rows[i][0].ToString()) == 0) bl = false;
- }
- }
- else
- {
- bl = false;
- }
- }
- catch (Exception ex)
- {
- bl = false;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return bl;
- }
-
- #endregion
- }
- }