DAL.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:56k
- using System;
- using System.Collections.Generic;
- using System.Text;
- using com.etong.IDAL;
- using com.etong.Model;
- using com.etong.DBUtility;
- using System.Data;
- using System.Data.SqlClient;
- using com.etong.SqlDataConnect;
- using com.etong.BusinessRule.Zwf;
- using System.Xml;
- using System.Collections;
- namespace com.etong.DAL
- {
- #region 角色管理类
- public class RoleManage:IRole
- {
- public void AddPermissionToRole(int permissionid, int roleid, int permissionType, string fromDate, string toDate)
- {
- string strSqlText = "Insert into Tb_Sys_RolePerm([RoleID],[PermissionID],[EditDate],[PermissionType],[FromDate],[ToDate])values(" + roleid + "," + permissionid + ",getDate()," + permissionType + ",'" + fromDate + "','" + toDate + "')";
- try
- {
- SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- public bool AddRole(RoleInfo roleinfo)
- {
- string strSqlText = "Insert into Tb_Sys_Role([RoleName],[RoleDesc],[OrdInal],[CreateRole],[UserRole])values('" + roleinfo.RoleName + "','" + roleinfo.RoleDesc + "'," + roleinfo.OrdInal + "," + roleinfo.CreateRole + "," + roleinfo.UserRole + ")";
- try
- {
- SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- return true;
- }
- catch
- {
- return false;
- }
- }
- public void AddRoleToUser(int roleid, int userid)
- {
- string strSqlText = "Insert into Tb_Sys_UserRole([UserID],[RoleID],[EditDate])values(" + userid + "," + roleid + ",getDate())";
- try
- {
- SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- public bool DeleteRole(int roleid)
- {
- string strSqlText = "select * from Tb_Sys_Role where [CreateRole]=" + roleid;
- DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- if (dt.Rows.Count > 0)
- {
- return false;
- }
- strSqlText = "select * from [tb_Colony_User] where [RoleID]=" + roleid;
- dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- if (dt.Rows.Count > 0)
- {
- return false;
- }
- strSqlText = "Delete from Tb_Sys_Role where RoleID=" + roleid;
- try
- {
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- return true;
- }
- catch
- {
- return false;
- }
- }
- public void DeletePermissionInPermissionRole(int roleid)
- {
- string strSqlText = "Delete from Tb_Sys_RolePerm where RoleID=" + roleid;
- try
- {
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- public DataTable GetAllRoles()
- {
- 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);
- }
- public DataTable GetPermissionList()
- {
- return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, "select [PermID],[DisplayName] from Tb_Sys_Permission", null);
- }
- public DataTable GetPermissionList(int RoleID)
- {
- 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);
- }
- public DataTable GetUserPerissionList(int userid, string sAccount, int rightType)
- {
- //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;
- // return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- string strSqlText;
- if ((sAccount == "admin" || sAccount == "Admin") && rightType == 1)
- {
- strSqlText = "select p.[PermID],p.[DisplayName],p.[DefaultPage] from Tb_Sys_Permission p where ParentresCode=" + rightType;
- }
- else
- 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;
- return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- }
- public DataTable GetRoleByConditions(int roleType, string searchContent, bool isBlurSearch)
- {
- 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 ";
- if (isBlurSearch)//模糊查询
- {
- switch (roleType)
- {
- case 1://角色名称
- strSqlText = strSqlText + "r.[RoleName] like '%" + searchContent + "%'";
- goto Label_00B9;
- case 2://创建者
- strSqlText = strSqlText + "rr.[RoleName] like '%" + searchContent + "%'";
- goto Label_00B9;
- case 3://使用者
- strSqlText = strSqlText + "rrr.[RoleName] like '%" + searchContent + "%'";
- goto Label_00B9;
- }
- }
- else//精确查询
- {
- switch (roleType)
- {
- case 1:
- strSqlText = strSqlText + "r.[RoleName] ='" + searchContent + "'";
- goto Label_00B9;
- case 2:
- strSqlText = strSqlText + "rr.[RoleName] ='" + searchContent + "'";
- goto Label_00B9;
- case 3:
- strSqlText = strSqlText + "rrr.[RoleName] ='" + searchContent + "'";
- goto Label_00B9;
- }
- }
- Label_00B9:
- return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- }
- public DataTable GetRoleByID(int id)
- {
- string strSqlText = "select * from Tb_Sys_Role where RoleID=" + id;
- return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- }
- public bool UpdateRole(RoleInfo roleinfo)
- {
- 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;
- try
- {
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- return true;
- }
- catch
- {
- return false;
- }
- }
- }
- #endregion
- #region 工程项目实施类
- public class ProjectImplment :IProjectImplement
- {
- /// <summary>
- /// 获取工程项目列表
- /// </summary>
- /// <returns></returns>
- public DataTable GetAllProjects()
- {
- string strSqlText = "select * from tb_Project where status=1";
- return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strSqlText, null);
- }
- public DataTable GetProjectByID(int id)
- {
- string strsqltext = "select * from [tb_project] where [ProjectID]=" + id;
- return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="constructid"></param>
- /// <returns></returns>
- public DataTable GetConstructByID(int constructid)
- {
- string strsqltext = "select * from [tb_construct] where [ConID]=" + constructid;
- return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public DataTable GetAllConstructs()
- {
- return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "p_construct_getAll", null);
- }
- /// <summary>
- /// 获取指定ID工程项目
- /// </summary>
- /// <param name="ProjectID"></param>
- /// <param name="isGetlist">表示是否要得到明细纪录</param>
- /// <returns></returns>
- public DataSet GetProjectByID(int ProjectID, bool isGetlist)
- {
- SqlParameter[] parameters ={
- new SqlParameter("@projectid",SqlDbType.Int,4),
- new SqlParameter ("@isgetlist",SqlDbType.Bit,1)
- };
- parameters[0].Value = ProjectID;
- parameters[1].Value = isGetlist;
-
- return SqlHelper.ExecuteDataSet(SqlHelper.connectionString, CommandType.StoredProcedure, "p_Project_GetByID", parameters);
- }
- /// <summary>
- /// 添加客户信息,返回"0"表示添加成功
- /// </summary>
- /// <param name="clientinfo"></param>
- public int AddClient(ClientInfo clientinfo)
- {
- SqlParameter[] parameters ={
- new SqlParameter ("@ClientWorkUnit",SqlDbType.VarChar ,14),
- new SqlParameter ("@MateWorkUnit",SqlDbType.VarChar ,14),
- new SqlParameter ("@Number",SqlDbType.VarChar ,20),
- new SqlParameter ("@ClientNote",SqlDbType .VarChar ,200),
- new SqlParameter ("@ClientResidence",SqlDbType.VarChar,200),
- new SqlParameter ("@ClientDegreeID",SqlDbType.Int,4),
- new SqlParameter ("@ClientBirthday",SqlDbType.NVarChar ,20),
- new SqlParameter ("@ClientHomeAddress",SqlDbType .VarChar ,200),
- new SqlParameter ("@ClientIDCard",SqlDbType .VarChar ,30),
- new SqlParameter ("@ClientMale",SqlDbType .Int ,4),
- new SqlParameter ("@ClientMarriage",SqlDbType .Int ,4),
- new SqlParameter ("@ClientName",SqlDbType .VarChar ,20),
- new SqlParameter ("@ClientTelNum",SqlDbType .VarChar, 100),
- new SqlParameter ("@Salary",SqlDbType.Decimal ,12),
- new SqlParameter ("@MateNote",SqlDbType .VarChar ,200),
- new SqlParameter ("@MateResidence",SqlDbType.VarChar ,200),
- new SqlParameter ("@MateBirthday",SqlDbType.NVarChar ,20),
- new SqlParameter ("@MateDegree",SqlDbType.Int ,4),
- new SqlParameter ("@MateHomeAddress",SqlDbType.VarChar ,200),
- new SqlParameter ("@MateIDCard",SqlDbType.VarChar ,30),
- new SqlParameter ("@MateMale",SqlDbType.Int,4),
- new SqlParameter ("@MateName",SqlDbType.VarChar,20),
- new SqlParameter ("@MateSalary",SqlDbType.Decimal ,12),
- new SqlParameter ("returnValue",SqlDbType.Int,4)
- };
- parameters[0].Value = clientinfo.ClientWorkUnit;
- parameters[1].Value = clientinfo.MateWorkUnit;
- parameters[2].Value = clientinfo.Number;
- parameters[3].Value = clientinfo.ClientNote;
- parameters[4].Value = clientinfo.ClientRedience;
- parameters[5].Value = clientinfo.ClientDegreeID;
- parameters[6].Value = clientinfo.ClientBirthday;
- parameters[7].Value = clientinfo.HomeAddress;
- parameters[8].Value = clientinfo.IdentityCard;
- parameters[9].Value = clientinfo.ClientMale;
- parameters[10].Value = clientinfo.ClientMarriage;
- parameters[11].Value = clientinfo.ClientName;
- parameters[12].Value = clientinfo.ClientTelNum;
- parameters[13].Value = clientinfo.Salary;
- parameters[14].Value = clientinfo.MateNote;
- parameters[15].Value = clientinfo.MateRedience;
- parameters[16].Value = clientinfo.MateBirthday;
- parameters[17].Value = clientinfo.MateDegreeID;
- parameters[18].Value = clientinfo.MateHomeAddress;
- parameters[19].Value = clientinfo.MateIdentityCard;
- parameters[20].Value = clientinfo.MateMale;
- parameters[21].Value = clientinfo.MateName;
- parameters[22].Value = clientinfo.Salary;
- parameters[23].Direction = ParameterDirection.ReturnValue;
-
- SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "p_WF_Client_ADD", parameters);
- return (int)parameters[23].Value;
- }
- /// <summary>
- /// 添加项目施工信息,返回"0"表示添加失败,否则成功
- /// </summary>
- /// <param name="constructinfo"></param>
- /// <returns></returns>
- public int AddConstruct(ConstructInfo constructinfo)
- {
- SqlParameter[] parameters ={
- new SqlParameter("@ConID",SqlDbType.Int,4),
- new SqlParameter("@ConName",SqlDbType.VarChar,200),
- new SqlParameter("@ConSort",SqlDbType.VarChar,2),
- new SqlParameter("@JcKgName",SqlDbType.VarChar,100),
- new SqlParameter("@JcWZTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@JcWZFName",SqlDbType.VarChar,100),
- new SqlParameter("@WZTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@WZFName",SqlDbType.VarChar,100),
- new SqlParameter("@JcZTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@JcZFName",SqlDbType.VarChar,100),
- new SqlParameter("@ZgJdTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@ZgJdIdea",SqlDbType.VarChar,200),
- new SqlParameter("@ZgXdTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@ZgXdIdea",SqlDbType.VarChar,100),
- new SqlParameter("@JcSBTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@JcSBFName",SqlDbType.VarChar,100),
- new SqlParameter("@ZgHzTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@ZgHzFName",SqlDbType.VarChar,100),
- new SqlParameter("@GcglTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@GcglFName",SqlDbType.VarChar,100),
- new SqlParameter("@JcSJTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@JcSJFName",SqlDbType.VarChar,100),
- new SqlParameter("@WZFjTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@WZFjFName",SqlDbType.VarChar,100),
- new SqlParameter("@Status",SqlDbType.Int,4),
- new SqlParameter("@DocumentXml",SqlDbType.VarChar ,50)
- };
- parameters[0].Direction = ParameterDirection.Output;
- parameters[1].Value = constructinfo.Conname;
- parameters[2].Value = constructinfo.Consort;
- parameters[3].Value = constructinfo.JcKgName;
- parameters[4].Value = constructinfo.JcWZTransator;
- parameters[5].Value = constructinfo.JcWZName;
- parameters[6].Value = constructinfo.WzTransator;
- parameters[7].Value = constructinfo.WzName;
- parameters[8].Value = constructinfo.JcZTransator;
- parameters[9].Value = constructinfo.JcZName;
- parameters[10].Value = constructinfo.ZgJdTransator;
- parameters[11].Value = constructinfo.ZgJdIdea;
- parameters[12].Value = constructinfo.ZgXdTransator;
- parameters[13].Value = constructinfo.ZgXdIdea;
- parameters[14].Value = constructinfo.JcSBTransator;
- parameters[15].Value = constructinfo.JcSBFName;
- parameters[16].Value = constructinfo.ZgHzTransator;
- parameters[17].Value = constructinfo.ZgHzFName;
- parameters[18].Value = constructinfo.GcglTransator;
- parameters[19].Value = constructinfo.GcglName;
- parameters[20].Value = constructinfo.JcSJTranstor;
- parameters[21].Value = constructinfo.JcSJFName;
- parameters[22].Value = constructinfo.WZFjTransator;
- parameters[23].Value = constructinfo.WZFjName;
- parameters[24].Value = constructinfo.Status;
- parameters[25].Value = constructinfo.DocumentXML;
- SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.StoredProcedure, "p_Construct_ADD", parameters);
- return (int)parameters[0].Value;
- }
- /// <summary>
- /// 编辑项目施工信息,返回"0"表示更新成功
- /// </summary>
- /// <param name="constructinfo"></param>
- /// <returns></returns>
- //public int UpdateConstruct(ConstructInfo constructinfo)
- //{
- // SqlParameter[] parameters ={
- // new SqlParameter("@ConID",SqlDbType.Int,4),
- // new SqlParameter("@PrjID",SqlDbType.Int,4),
- // new SqlParameter("@TaskSort",SqlDbType.Int,4),
- // new SqlParameter("@MatRej",SqlDbType.Int,4),
- // new SqlParameter("@Rej_ChargeMachine",SqlDbType.Decimal,14),
- // new SqlParameter("@Rej_ChargeManPower",SqlDbType.Decimal,14),
- // new SqlParameter("@Rej_ChargeOther",SqlDbType.Decimal,14),
- // new SqlParameter("@Rej_ChargeStuff",SqlDbType.Decimal,14),
- // new SqlParameter("@Rej_ChargeSum",SqlDbType.Decimal,15),
- // new SqlParameter("@Rej_TransactorIdea",SqlDbType.VarChar,800),
- // new SqlParameter("@Rej_TransactorSignature",SqlDbType.VarChar,20),
- // new SqlParameter("@Fg_TransactorIdea",SqlDbType.VarChar,200),
- // new SqlParameter("@Fg_TransactorSignature",SqlDbType.VarChar,20),
- // new SqlParameter("@Zjl_TransactorIdea",SqlDbType.VarChar,200),
- // new SqlParameter("@Zjl_TransactorSignature",SqlDbType.VarChar,20),
- // new SqlParameter("@Mat_Stock",SqlDbType.VarChar,200),
- // new SqlParameter("@Mat_Grant",SqlDbType.VarChar,200),
- // new SqlParameter("@Ent_AccountMon",SqlDbType.VarChar,200),
- // new SqlParameter("@Ent_AddAccount",SqlDbType.Decimal,14),
- // new SqlParameter("@Ent_Account",SqlDbType.Int,4),
- // new SqlParameter("@StartWorking",SqlDbType.Int,4),
- // new SqlParameter("@DrawMat",SqlDbType.Int,4),
- // new SqlParameter("@PlanFile",SqlDbType.VarChar,100),
- // new SqlParameter("@ClientInfo",SqlDbType.VarChar,20),
- // new SqlParameter("@FinishFile",SqlDbType.VarChar,100),
- // new SqlParameter("@Ys_Manager",SqlDbType.VarChar,20),
- // new SqlParameter("@YsW_Idea",SqlDbType.VarChar,200),
- // new SqlParameter("@YsW_Manager",SqlDbType.VarChar,20),
- // new SqlParameter("@PactFile",SqlDbType.VarChar,100),
- // new SqlParameter("@PactSq",SqlDbType.VarChar,20),
- // new SqlParameter("@PactSqIdea",SqlDbType.VarChar,200),
- // new SqlParameter("@ConStatus",SqlDbType.Int,4),
- // new SqlParameter("returnValue",SqlDbType.Int,4)
- // };
- // parameters[0].Value = constructinfo.ConstructID;
- // parameters[1].Value = constructinfo.ProjectID;
- // parameters[2].Value = constructinfo.TaskType;
- // parameters[3].Value = constructinfo.isChangeMaterial;
- // parameters[4].Value = constructinfo.Rej_ChargeMachine;
- // parameters[5].Value = constructinfo.Rej_ChargeManpower;
- // parameters[6].Value = constructinfo.Rej_ChargeOther;
- // parameters[7].Value = constructinfo.Rej_ChargeStuff;
- // parameters[8].Value = constructinfo.Rej_ChargeSum;
- // parameters[9].Value = constructinfo.Rej_TransactorIdea;
- // parameters[10].Value = constructinfo.Rej_TransactorSignature;
- // parameters[11].Value = constructinfo.Fg_TransactorIdea;
- // parameters[12].Value = constructinfo.Fg_TransactorSignature;
- // parameters[13].Value = constructinfo.Zjl_TransactorIdea;
- // parameters[14].Value = constructinfo.Zjl_TransactorSignature;
- // parameters[15].Value = constructinfo.MatStock;
- // parameters[16].Value = constructinfo.MatGrant;
- // parameters[17].Value = constructinfo.EntAccountMon;
- // parameters[18].Value = constructinfo.EntAddAccount;
- // parameters[19].Value = constructinfo.EntAccount;
- // parameters[20].Value = constructinfo.StartWorking;
- // parameters[21].Value = constructinfo.DrawMat;
- // parameters[22].Value = constructinfo.PlanFile;
- // parameters[23].Value = constructinfo.ClientInfo;
- // parameters[24].Value = constructinfo.FinishFile;
- // parameters[25].Value = constructinfo.Ys_Manager;
- // parameters[26].Value = constructinfo.Ysw_Idea;
- // parameters[27].Value = constructinfo.Ysw_Manager;
- // parameters[28].Value = constructinfo.PactFile;
- // parameters[29].Value = constructinfo.PactSq;
- // parameters[30].Value = constructinfo.PactSqIdea;
- // parameters[31].Value = constructinfo.ConStatus;
- // parameters[32].Direction = ParameterDirection.ReturnValue;
- // SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.StoredProcedure, "p_Construct_Update", parameters);
- // return (int)parameters[32].Value;
- //}
- //修改项目表里的纪录状态
- public void ChangeStatus(int projectid, int statusValue)
- {
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, "update [tb_Project] set [Status]= " + statusValue + " where [ProjectID]=" + projectid, null);
- }
- //确定施工表里的施工类型
- public void ConfirmConstructTaskType(int constructid, int tasktype)
- {
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, "update [tb_construct] set [TaskSort]= " + tasktype + " where [ConID]=" + constructid, null);
- }
- public int GetProjectID(int constructid)
- {
- DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, "select [PrjID] from [tb_construct] where [ConID]=" + constructid, null);
- if (dt.Rows.Count > 0)
- {
- return Convert.ToInt32(dt.Rows[0]["PrjID"].ToString());
- }
- else
- {
- return -1;
- }
- }
- public void UpdateTransactorSignature(int constructid,string TransactorSignature)
- {
- string strsqltext = "update [tb_construct] set [Rej_TransactorSignature]='" + TransactorSignature + "' where [ConID]=" + constructid;
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- //修改项目的资金情况(工程实施表与项目表同步修改)
- public void UpdateMoney(int constructid, decimal chargemachine, decimal chargemanpower, decimal chargeother, decimal chargestuff, decimal chargesum, string changeman)
- {
- 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;
- int projectid = GetProjectID(constructid);
- string strsqltext2 = "update [tb_Project] set [ChargeMachine]=" + chargemachine + ",[ChargeManPower]=" + chargemanpower + ",[ChargeOther]=" + chargeother + ",[ChargeStuff]=" + chargestuff + ",[ChargeSum]=" + chargesum + " where [ProjectID]=" + projectid;
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext1, null);
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext2, null);
- }
- //分管领导审核
- public void UpdateFg_TransactorIdea(int constructid, string Fg_TransactorIdea, string Fg_TransactorSignature)
- {
- string strsqltext = "update [tb_construct] set [Fg_TransactorIdea]='" + Fg_TransactorIdea + "',[Fg_TransactorSignature]='" + Fg_TransactorSignature + "' where [ConID]=" + constructid;
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- //总经理审核
- public void UpdateZjl_TransactorIdea(int constructid, string Zjl_TransactorIdea, string Zjl_TransactorSignature)
- {
- string strsqltext = "update [tb_construct] set [Zjl_TransactorIdea]='" + Zjl_TransactorIdea + "',[Zjl_TransactorSignature]='" + Zjl_TransactorSignature + "' where [ConID]=" + constructid;
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- //flag为1为物资部门采购情况2为物资发放情况
- public void UpdateMaterialStock(int constructid, string content, int flag)
- {
- string strsqltext=null;
- switch (flag)
- {
- case 1:
- strsqltext = "update [tb_construct] set [Mat_Stock]='" + content + "' where [ConID]=" + constructid; break;
- case 2:
- strsqltext = "update [tb_construct] set [Mat_Grant]='" + content + "' where [ConID]=" + constructid; break;
- }
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- public void UpdateContactAuthorzationIdea(int coustructid, string PactSqIdea, string PactSq)
- {
- string strsqltext = "update [tb_construct] set [PactSqIdea]='" + PactSqIdea + "',[PactSq]='" + PactSq + "' where [ConID]=" + coustructid;
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- public void UpdatePlanFile(int constructid, string planfile)
- {
- string strsqltext = "update [tb_construct] set [PlanFile]='" + planfile + "'";
- SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- public void UpdateFinishFile(int constructid, string finishfile)
- {
- string strsqltext = "update [tb_construct] set [FinishFile]='" + finishfile + "'";
- SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- public void UpdateProjectDocumentBack(int constructid, string clientinfo, string pactfile, string Ys_Manager, string YsW_Idea, string YsW_Manager)
- {
- 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;
- SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- public void UpdateStartWorking(int constructid, string working, int startworking, int drawmat)
- {
- string strsqltext = "update [tb_construct] set [StartWorking]=" + startworking + ",[Working]='" + working + "',[DrawMat]='" + drawmat + "' where [ConID]=" + constructid;
- SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- public DataTable GetDepartmentByID(int id)
- {
- string strsqltext = "select * from [Tb_Sys_Organization] where [OrgID]=" + id;
- return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- public DataTable GetNextOperatorRole(int CurrOpId)
- {
- string strsqltext = "select * from [Tb_Sys_OpRole] where [OpID]=" + CurrOpId;
- return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- }
- public static string getTaskSortForString(int constructid)
- {
- string sqlText = "select [TaskSort] from [tb_construct] where [ConID]=" + constructid;
- string returnString = null;
- DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, sqlText, null);
- if (dt.Rows.Count > 0)
- {
- switch (Convert.ToInt32 (dt .Rows [0]["TaskSort"].ToString ()))
- {
- case 1: returnString = "自营"; break;
- case 2: returnString = "半委托"; break;
- case 3: returnString = "全委托"; break;
- case 4: returnString = "外委"; break;
- }
- }
- return returnString;
- }
- public static string getMatRejForString(int constructid)
- {
- string sqlText = "select [MatRej] from [tb_construct] where [ConID]=" + constructid;
- string returnString = null;
- DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, sqlText, null);
- if (dt.Rows.Count > 0)
- {
- switch (Convert.ToInt32(dt.Rows[0]["MatRej"].ToString()))
- {
- case 5: returnString = "更改材料"; break;
- case 6: returnString = "不更改材料"; break;
- }
- }
- return returnString;
- }
- public static 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;
- }
- public DataView GetStructureStatus()
- {
- DataView dv = null;
- DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "P_GetStructureStatus", null);
- if (dt != null)
- {
- dv = dt.DefaultView;
- }
- return dv;
- }
- public DataView GetStructureAllStatus(int ConID)
- {
- DataView dv = null;
- SqlParameter parameterConID = new SqlParameter("@ConID", SqlDbType.Int, 4);
- parameterConID.Value = ConID;
- DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.StoredProcedure, "P_GetSturctureAllStatus", parameterConID);
- if (dt != null)
- dv = dt.DefaultView;
- return dv;
- }
- }
- #endregion
- #region 工作流操作类
- public class WorkFolw
- {
- private MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- private EtongZwf etongzwf = new EtongZwf();
- /*=======================================================================================
- *
- * 获取工作流起始活动.
- *
- *======================================================================================= */
- public int ActivityIDGetByWFID(int WfId)
- {
- DataView dvActivity = etongzwf.GetActivityByWFID(WfId);
- if (dvActivity.Count != 0)
- {
- int activity = Convert.ToInt32(dvActivity[0][0].ToString().Trim());
- return activity;
- }
- else
- return 0;
- }
- /*=======================================================================================
- *
- * 提交到下一个角色用户申核.
- *
- *======================================================================================= */
- public string NextColonyRole(int actinsid, int WFInstanceID)
- {
- DataView dvActRole = etongzwf.ColonyUserGetByActId(actinsid);
- if (dvActRole.Count > 0)
- {
- int ActivityIDNext = Convert.ToInt32(dvActRole[0][0].ToString().Trim());
- int RoleID = Convert.ToInt32(dvActRole[0][2].ToString().Trim());
- WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, ActivityIDNext, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 0, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, "", -1, RoleID);
- int returnValue = etongzwf.WFActInsADD(wfactinsinfo);
- if (returnValue > 0)
- {
- DataView dvRoleName = etongzwf.RoleGetName(RoleID);
- if (dvActRole.Count != 0)
- {
- return dvRoleName[0][0].ToString();
- }
- else
- {
- return "-1";
- }
- }
- else
- {
- return "-1";
- }
- }
- else // 不存在上级活动,将 活动状态(Status) 改为 "完成" 注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
- {
- bool ReValueAIUpdata = false;
- ReValueAIUpdata = etongzwf.WFActInsUpdata(actinsid, 1);
- return "-2";
- }
- }
- /*=======================================================================================
- *
- * 改变当前工作流活动实例状态.
- *
- *======================================================================================= */
- public bool WFActInsUpdata(int actinsid, int status, int userid)
- {
- QueryParameterCollection Params = new QueryParameterCollection();
- Params.Clear();
- Params.Add("@actinsid", actinsid);
- Params.Add("@status", status);
- Params.Add("@userid", userid);
- 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;
- }
- /*================================================================================================================
- *
- * 判断当前工作流活动实例状态(0、正常;1、完成(审核通过);2、回退;3、回退并完成;4、作废)
- *
- *=============================================================================================================== */
- public static int GetCurrentActivityInstanceStatus(int actinsid)
- {
- string sql = "Select [Status] from [tb_WF_ActIns] where [ActInsID]=" + actinsid;
- DataView dv = SqlServer.GetDataView(sql);
- int tempStatus = 0;
- if (dv.Count > 0)
- {
- tempStatus = Convert.ToInt32(dv[0]["Status"].ToString());
- }
- return tempStatus;
- }
- /*================================================================================================================
- *
- * 找出部门的业务角色的类型(1 科技 2 生产 3 营销 99 未知)
- *
- *=============================================================================================================== */
- public static string GetOrgOpRoleType(int OpID)
- {
- string sql = "select [OrgDesc] from [Tb_Sys_OpRole] where [OpID]=" + OpID;
- DataView dv = SqlServer.GetDataView(sql);
- int type = -1;
- if (dv.Count > 0)
- {
- try
- {
- type = Convert.ToInt32(dv[0]["OrgDesc"].ToString().Trim());
- }
- catch
- {
- type = 99;
- }
- }
- return type.ToString();
- }
- public static string GetBlockReason(int acinstanceid)
- {
- string sql = "select [BlockReason] from [tb_WF_ActIns] where [ActInsID]=" + acinstanceid;
- DataView dv = SqlServer.GetDataView(sql);
- string s = "";
- if (dv.Count > 0)
- {
- s = dv[0]["BlockReason"].ToString();
- }
- return s;
- }
- public static bool ParentActivitysIsCompleted(int PrjID, int ActivityID)
- {
- int tempCount = 0;
- string sql = "select * from tb_wf_actins where wfinstanceid in" +
- "(select wfinstanceid from tb_wf_instance where prjid=" + PrjID + " and status=2) and activityid in " +
- "(select parentactid from tb_colony_user where activityid =" + ActivityID + ")";
- //return SqlHelper.ExecuteDataTable(SqlHelper.connectionString, CommandType.Text, strsqltext, null);
- DataView dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- {
- for (int i = 0; i < dv.Count; i++)
- {
- tempCount += Convert.ToInt32(dv[i]["Status"].ToString().Trim());
- }
- }
- return (tempCount == dv.Count) ? true : false;
- }
- }
- #endregion
- #region XML操作类
- public class XML
- {
- private XmlDocument xmlDocument;
- private XmlElement xmlElement;
- private string xmlFileName;
- public XML()
- {
- }
- public XML(string xmlFileName)
- {
- this.xmlFileName = xmlFileName;
- xmlDocument = new XmlDocument();
- xmlDocument.Load(xmlFileName);
- }
- public bool CreateXMLDocument(string xmlFileName)
- {
- try
- {
- string str = "<?xml version="1.0" encoding="utf-8" ?><Documents></Documents>";
- xmlDocument = new XmlDocument();
- xmlDocument.LoadXml(str);
- xmlDocument.Save(xmlFileName);
- return true;
- }
- catch
- {
- return false;
- }
- }
- public bool AddXmlNode(DocumentNode documentNode)
- {
- try
- {
- xmlDocument = new XmlDocument();
- xmlDocument.Load(xmlFileName);
- XmlNode root = xmlDocument.SelectSingleNode("Documents");
- xmlElement = xmlDocument.CreateElement("Document");
- XmlElement filenameNode = xmlDocument.CreateElement("FileName");
- filenameNode.InnerText = documentNode.FileName;
- xmlElement.AppendChild(filenameNode);
- XmlElement checkerNode = xmlDocument.CreateElement("Checker");
- checkerNode.InnerText = documentNode.Checker;
- xmlElement.AppendChild(checkerNode);
- XmlElement timeNode = xmlDocument.CreateElement("Time");
- timeNode.InnerText = documentNode.Time;
- xmlElement.AppendChild(timeNode);
- XmlElement typeNode = xmlDocument.CreateElement("Type");
- typeNode.InnerText = documentNode.Type;
- xmlElement.AppendChild(typeNode);
- root.AppendChild(xmlElement);
- xmlDocument.Save(this.xmlFileName);
- return true;
- }
- catch
- {
- return false;
- }
- }
- // public ArrayList ReadNode(string nodeName)
- public ArrayList ReadNode(ArrayList nodesname, string RootNodesName)
- {
- /*ArrayList list = new ArrayList();
- string s = "";
- XmlNodeReader xNodeReader = new XmlNodeReader(xmlDocument);
- while (xNodeReader.Read())
- {
- switch (xNodeReader.NodeType)
- {
- case XmlNodeType.Element:
- s = xNodeReader.Name;
- break;
- case XmlNodeType.Text:
- if (s.Equals(nodeName))
- list.Add(xNodeReader.Value);
- break;
- }
- }
- return list;*/
- ArrayList al = new ArrayList();
- //XmlDocument XmlDoc = new XmlDocument();
- //XmlDoc.Load(address);
- XmlNodeList NodeList = xmlDocument.SelectSingleNode(RootNodesName).ChildNodes;
- foreach (XmlNode Xn in NodeList)
- {
- XmlElement Xe = (XmlElement)Xn;
- XmlNodeList NodeList1 = Xe.ChildNodes;
- //指定命名空间的属性Xe.GetAttribute("")
- string[] s = new string[nodesname.Count];
- foreach (XmlNode Xn1 in NodeList1)
- {
- XmlElement Xe1 = (XmlElement)Xn1;
- for (int k = 0; k < nodesname.Count; k++)
- {
- if (nodesname[k].ToString() == Xe1.Name)
- {
- s[k] = Xe1.InnerText;
- break;
- }
- }
- }
- al.Add(s);
- }
- return al;
- }
- public ArrayList ReadNode(string rootNode, string matchValue, bool isMatchValue)
- {
- /*ArrayList list = new ArrayList();
- string s = "";
- //XmlNodeReader xNodeReader = new XmlNodeReader(xmlDocument);
- //while (xNodeReader.reRead())
- //{
- // switch (xNodeReader.NodeType)
- // {
- // case XmlNodeType.Element:
- // s = xNodeReader.Name;
- // break;
- // case XmlNodeType.Text:
- // if (s.Equals(nodeName))
- // list.Add(xNodeReader.Value);
- // break;
- // }
- //}
- XmlNodeList nodeList = xmlDocument.SelectNodes(nodeName);
- foreach (XmlNode node in nodeList)
- {
- if (node.SelectSingleNode("Type").InnerText == matchValue)
- {
- list.Add(node.SelectSingleNode("FileName").InnerText);
- }
- }
- return list;*/
- ArrayList al = new ArrayList();
- // XmlDocument XmlDoc = new XmlDocument();
- // XmlDoc.Load(this.m_Address);
- XmlNodeList NodeList = xmlDocument.SelectSingleNode(rootNode).ChildNodes;
- foreach (XmlNode Xn in NodeList)
- {
- XmlElement Xe = (XmlElement)Xn;
- XmlNodeList NodeList1 = Xe.ChildNodes;
- string FName = "", EmpName = "", OpSort = "", sDate = "";
- foreach (XmlNode Xn1 in NodeList1)
- {
- XmlElement Xe1 = (XmlElement)Xn1;
- switch (Xe1.Name)
- {
- case "FileName":
- FName = Xe1.InnerText;
- break;
- case "Checker":
- EmpName = Xe1.InnerText;
- break;
- case "Type":
- OpSort = Xe1.InnerText;
- break;
- case "Time":
- sDate = Xe1.InnerText;
- break;
- default:
- break;
- }
- }
- if (isMatchValue == false)
- {
- DocumentNode EXml = new DocumentNode();
- EXml.FileName = FName;
- EXml.Checker = EmpName;
- EXml.Type = OpSort;
- EXml.Time = sDate;
- al.Add(EXml);
- }
- else
- {
- if (OpSort.Trim() == matchValue)
- {
- DocumentNode EXml = new DocumentNode();
- EXml.FileName = FName;
- EXml.Checker = EmpName;
- EXml.Type = OpSort;
- EXml.Time = sDate;
- al.Add(EXml);
- }
- }
- }
- return al;
- }
- }
- #endregion
- #region 废旧物资管理流程类
- public class PrjOldMatManager
- {
- public PrjOldMatManager()
- { }
- public int AddPrjOldMat(PrjOldMatInfo prjOldMatInfo)
- {
- SqlParameter[] parameters ={
- new SqlParameter("@MatID",SqlDbType.Int,4),
- new SqlParameter("@ConID",SqlDbType.Int,4),
- new SqlParameter("@ConSort",SqlDbType.Int,4),
- // new SqlParameter("@MatName",SqlDbType.VarChar,100),
- new SqlParameter("@MatSort",SqlDbType.Int,4),
- new SqlParameter("@nf",SqlDbType.VarChar,4),
- new SqlParameter("@jd",SqlDbType.VarChar,1),
- new SqlParameter("@hz",SqlDbType.VarChar,1),
- new SqlParameter("@JcTransactor",SqlDbType.VarChar,50),
- new SqlParameter("@ZgTransactor",SqlDbType.VarChar ,50),
- new SqlParameter("@ZgHZFName",SqlDbType.VarChar,100),
- new SqlParameter("@ZGxFName",SqlDbType.VarChar,100),
- new SqlParameter("@ZGdFName",SqlDbType.VarChar,100),
- new SqlParameter("@WZjTransactor",SqlDbType.VarChar,50),
- new SqlParameter("@WZjIdea",SqlDbType.VarChar,200),
- new SqlParameter("@WZhTransactor",SqlDbType.VarChar,50),
- new SqlParameter("@WZhFName",SqlDbType.VarChar,100),
- new SqlParameter("@WZqTransactor",SqlDbType.VarChar,50),
- new SqlParameter("@WZqFName",SqlDbType.VarChar,100),
- new SqlParameter("@GcglTransactor",SqlDbType.VarChar,50),
- new SqlParameter("@GcglIdea",SqlDbType.VarChar,200),
- new SqlParameter("@GSldTansactor",SqlDbType.VarChar ,50),
- new SqlParameter("@GSldIdea",SqlDbType.VarChar,200),
- new SqlParameter("@WZfTransactor",SqlDbType.VarChar,50),
- new SqlParameter("@WZfIdea",SqlDbType.VarChar,200),
- new SqlParameter("@ZGgTransactor",SqlDbType.VarChar,50),
- new SqlParameter("@ZGgIdea",SqlDbType.VarChar,200),
- new SqlParameter("@status",SqlDbType.Int,4)
- };
- parameters[0].Direction = ParameterDirection.Output;
- parameters[1].Value = prjOldMatInfo.ConID;
- parameters[2].Value = prjOldMatInfo.ConSort;
- // parameters[3].Value = prjOldMatInfo.;
- parameters[3].Value = prjOldMatInfo.MatSort;
- parameters[4].Value = prjOldMatInfo.NF;
- parameters[5].Value = prjOldMatInfo.JD;
- parameters[6].Value = prjOldMatInfo.HZ;
- parameters[7].Value = prjOldMatInfo.JcTransactor;
- parameters[8].Value = prjOldMatInfo.ZgTransactor;
- parameters[9].Value = prjOldMatInfo.ZgHZFName;
- parameters[10].Value = prjOldMatInfo.ZGxFName;
- parameters[11].Value = prjOldMatInfo.ZGdFName;
- parameters[12].Value = prjOldMatInfo.WZjTransactor;
- parameters[13].Value = prjOldMatInfo.WZjIdea;
- parameters[14].Value = prjOldMatInfo.WZhTransactor;
- parameters[15].Value = prjOldMatInfo.WZhFName;
- parameters[16].Value = prjOldMatInfo.WZqTransactor;
- parameters[17].Value = prjOldMatInfo.WZqFName;
- parameters[18].Value = prjOldMatInfo.GcglTransactor;
- parameters[19].Value = prjOldMatInfo.GcglIdea;
- parameters[20].Value = prjOldMatInfo.GSldTansactor;
- parameters[21].Value = prjOldMatInfo.GSldIdea;
- parameters[22].Value = prjOldMatInfo.WZfTransactor;
- parameters[23].Value = prjOldMatInfo.WZfIdea;
- parameters[24].Value = prjOldMatInfo.ZGgTransactor;
- parameters[25].Value = prjOldMatInfo.ZGgIdea;
- parameters[26].Value = prjOldMatInfo.Status;
- try
- {
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.StoredProcedure, "p_PrjOldMat_add", parameters);
- return (int)parameters[0].Value;
- }
- catch
- {
- return -1;
- }
- }
- public int UpdateOldMatName(int matid, string matname)
- {
- SqlParameter [] parameters ={
- new SqlParameter ("@MatID",SqlDbType .Int,4),
- new SqlParameter ("@MatName",SqlDbType.VarChar ,100),
- new SqlParameter ("@returnValue",SqlDbType.Int,4)
- };
- parameters[0].Value = matid;
- parameters[1].Value = matname;
- parameters[2].Direction = ParameterDirection.ReturnValue;
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.StoredProcedure, "p_MatName_update", parameters);
- return (int)parameters[2].Value;
- }
- }
- #endregion
- #region 废旧物资汇总类
- public class PrjOldMatHZManager
- {
- public PrjOldMatHZManager()
- { }
- public int AddPrjOldMatHZ(PrjOldMatHZInfo prjOldMatHZInfo)
- {
- SqlParameter[] parameters ={
- new SqlParameter("@MatHZID",SqlDbType.Int,4),
- new SqlParameter("@HZ",SqlDbType.VarChar,1),
- new SqlParameter("@nf",SqlDbType.VarChar,4),
- new SqlParameter("@jd",SqlDbType.VarChar,1),
- new SqlParameter("@MatHzName",SqlDbType.VarChar,100),
- new SqlParameter("@HzFName",SqlDbType.VarChar,100),
- new SqlParameter("@WzTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@GcglTransactor",SqlDbType.VarChar,20),
- new SqlParameter("@GcglIdea",SqlDbType.VarChar,200),
- new SqlParameter("@FgTransactor",SqlDbType.VarChar,20),
- new SqlParameter("@FgIdea",SqlDbType.VarChar,200),
- new SqlParameter("@JcoTransactor",SqlDbType.VarChar,20),
- new SqlParameter("@JcoIdea",SqlDbType.VarChar,200),
- new SqlParameter("@status",SqlDbType.Int,4),
- };
- parameters[0].Direction = ParameterDirection.Output;
- parameters[1].Value = prjOldMatHZInfo.HZ;
- parameters[2].Value = prjOldMatHZInfo.NF;
- parameters[3].Value = prjOldMatHZInfo.JD;
- parameters[4].Value = prjOldMatHZInfo.MatHZName;
- parameters[5].Value = prjOldMatHZInfo.HzFName;
- parameters[6].Value = prjOldMatHZInfo.WzTransactor;
- parameters[7].Value = prjOldMatHZInfo.GcglTransactor;
- parameters[8].Value = prjOldMatHZInfo.GcglIdea;
- parameters[9].Value = prjOldMatHZInfo.FgTransactor;
- parameters[10].Value = prjOldMatHZInfo.FgIdea;
- parameters[11].Value = prjOldMatHZInfo.JcoTransactor;
- parameters[12].Value = prjOldMatHZInfo.JcoIdea;
- parameters[13].Value = prjOldMatHZInfo.Status;
- try
- {
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.StoredProcedure, "p_PrjOldMatHZ_add", parameters);
- return (int)parameters[0].Value;
- }
- catch
- {
- return -1;
- }
- }
- }
- #endregion
- #region 废旧物资汇总类
- public class PrjAlertManager
- {
- public PrjAlertManager()
- { }
- public int AddPrjAlert(PrjAlertInfo prjAlertInfo)
- {
- SqlParameter[] parameters ={
- new SqlParameter("@AlertID",SqlDbType.Int,4),
- new SqlParameter("@ConID",SqlDbType.Int,4),
- new SqlParameter("@ConSort",SqlDbType.VarChar,2),
- new SqlParameter("@AlertName",SqlDbType.VarChar,100),
- new SqlParameter("@BgFName",SqlDbType.VarChar,100),
- new SqlParameter("@JcTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@JcFName",SqlDbType.VarChar,100),
- new SqlParameter("@ZgTransactor",SqlDbType.VarChar,30),
- new SqlParameter("@ZgFName",SqlDbType.VarChar,100),
- new SqlParameter("@GcglTransactor",SqlDbType.VarChar,20),
- new SqlParameter("@GcglIdea",SqlDbType.VarChar,200),
- new SqlParameter("@FgTransactor",SqlDbType.VarChar,20),
- new SqlParameter("@FgIdea",SqlDbType.VarChar,200),
- new SqlParameter("@status",SqlDbType.Int,4),
- };
- parameters[0].Direction = ParameterDirection.Output;
- parameters[1].Value = prjAlertInfo.ConID;
- parameters[2].Value = prjAlertInfo.ConSort;
- parameters[3].Value = prjAlertInfo.AlertName;
- parameters[4].Value = prjAlertInfo.BgFName;
- parameters[5].Value = prjAlertInfo.Jctransactor;
- parameters[6].Value = prjAlertInfo.Jcfname;
- parameters[7].Value = prjAlertInfo.Zgtransactor;
- parameters[8].Value = prjAlertInfo.Zgfname;
- parameters[9].Value = prjAlertInfo.Gcgltransactor;
- parameters[10].Value = prjAlertInfo.Gcglidea;
- parameters[11].Value = prjAlertInfo.Fgtransactor;
- parameters[12].Value = prjAlertInfo.Fgidea;
- parameters[13].Value = prjAlertInfo.Status;
- try
- {
- SqlHelper.ExecuteNonQuery(SqlHelper.connectionString, CommandType.StoredProcedure, "p_tb_PrjAlert_add", parameters);
- return (int)parameters[0].Value;
- }
- catch
- {
- return -1;
- }
- }
- }
- #endregion
- }