/// <summary> /// 添加信息 /// </summary> /// <param name="institution">LINQ信息</param> /// <param name="deptList">部门信息</param> /// <param name="billEnum">单据类型</param> /// <param name="error">错误信息</param> /// <returns>成功返回True</returns> public bool AddInfo(FM_InstitutionProcess institution, List <string> deptList, out string error) { error = null; DepotManagementDataContext ctx = CommentParameter.DepotDataContext; IBillMessagePromulgatorServer serverBill = BasicServerFactory.GetServerModule <IBillMessagePromulgatorServer>(); serverBill.BillType = serverBill.GetBillTypeEnum(institution.TypeCode).ToString(); try { institution.Propoer = BasicInfo.LoginName; institution.PropoerTime = ServerTime.Time; institution.BillStatus = InstitutionBillStatus.等待科长审查.ToString(); ctx.FM_InstitutionProcess.InsertOnSubmit(institution); List <FM_InstitutionProcessPointDept> listPoint = new List <FM_InstitutionProcessPointDept>(); FM_InstitutionProcessPointDept tempLnq = new FM_InstitutionProcessPointDept(); if (deptList != null) { foreach (string item in deptList) { List <string> list = serverBill.GetUserCodes(serverBill.GetDeptPrincipalRoleName(item).ToList(), null); foreach (string workID in list) { tempLnq = new FM_InstitutionProcessPointDept(); tempLnq.BillNo = institution.BillNo; tempLnq.PersonnelType = RoleStyle.负责人.ToString(); tempLnq.Personnel = workID; listPoint.Add(tempLnq); } if (!IsThreeTripFile(institution.SortID)) { list = serverBill.GetUserCodes(serverBill.GetDeptLeaderRoleName(item).ToList(), null); foreach (string workID in list) { tempLnq = new FM_InstitutionProcessPointDept(); tempLnq.BillNo = institution.BillNo; tempLnq.PersonnelType = RoleStyle.分管领导.ToString(); tempLnq.Personnel = workID; listPoint.Add(tempLnq); } } } var varData = (from a in listPoint select new { a.BillNo, a.Personnel, a.PersonnelType }).Distinct(); listPoint = new List <FM_InstitutionProcessPointDept>(); foreach (var item in varData) { tempLnq = new FM_InstitutionProcessPointDept(); tempLnq.PersonnelType = item.PersonnelType; tempLnq.Personnel = item.Personnel; tempLnq.BillNo = item.BillNo; listPoint.Add(tempLnq); } ctx.FM_InstitutionProcessPointDept.InsertAllOnSubmit(listPoint); } ctx.SubmitChanges(); serverBill.DestroyMessage(institution.BillNo); serverBill.SendNewFlowMessage(institution.BillNo, string.Format("{0}号文件审查流程已提交,请等待上级审核", institution.BillNo), BillFlowMessage_ReceivedUserType.角色, serverBill.GetSuperior(CE_RoleStyleType.级领导, BasicInfo.LoginID)); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }