/// <summary> /// 删除申请信息 /// </summary> /// <param name="contraApprovalID">合同申请ID</param> /// <returns></returns> public bool DeleteContraApproval(string[] contraApprovalID) { try { ApplicationsForContracts afcs = new ApplicationsForContracts(); var entitys = from ent in afcs.GetTable().ToList() where contraApprovalID.Contains(ent.CONTRACTAPPID) select ent; if (entitys.Count() > 0) { foreach (var obj in entitys) { Delete(obj); } int i = dal.SaveContextChanges(); if (i > 0) { return true; } } return false; } catch (Exception ex) { Tracer.Debug("合同申请ContractApprovalBLL-DeleteContraApproval" + System.DateTime.Now.ToString() + " " + ex.ToString()); return false; throw (ex); } }
/// <summary> /// 根据条件查询合同的申请信息 /// </summary> /// <param name="ContractApprovalName">标题</param> /// <param name="strID">合同ID</param> /// <param name="strContractLevel">级别</param> /// <param name="strContractLogo">申请标志</param> /// <returns></returns> public List<V_ContractApplications> GetApprovalRoomInfosListBySearch(string ContractApprovalName, string strID, string strContractLevel, string strContractLogo) { try { ApplicationsForContracts afcs = new ApplicationsForContracts(); var q = from p in afcs.GetTable().ToList() select new V_ContractApplications { contractApp = p }; if (!string.IsNullOrEmpty(ContractApprovalName)) { q = q.Where(s => ContractApprovalName.Contains(s.contractApp.CONTRACTTITLE)); } if (!string.IsNullOrEmpty(strID)) { q = q.Where(s => strID.Contains(s.contractApp.CONTRACTCODE)); } if (!string.IsNullOrEmpty(strContractLevel)) { q = q.Where(s => strContractLevel.Contains(s.contractApp.CONTRACTLEVEL)); } if (!string.IsNullOrEmpty(strContractLogo)) { q = q.Where(s => strContractLogo.Contains(s.contractApp.CONTRACTFLAG)); } if (q.Count() > 0) { return q.ToList<V_ContractApplications>(); } return null; } catch (Exception ex) { return null; } }
/// <summary> /// 获取所有的申请信息 /// </summary> /// <returns>返回结果</returns> public IQueryable<T_OA_CONTRACTAPP> GetContractApplications() { ApplicationsForContracts afcs = new ApplicationsForContracts(); var entity = from p in afcs.GetTable() orderby p.CREATEDATE descending select p; return entity.Count() > 0 ? entity : null; }
/// <summary> /// 获取申请信息 /// </summary> /// <returns></returns> public List<T_OA_CONTRACTAPP> GetApprovalRooms() { ApplicationsForContracts afcs = new ApplicationsForContracts(); var query = from p in afcs.GetTable() orderby p.CREATEDATE descending select p; return query.ToList<T_OA_CONTRACTAPP>(); }
public List<string> GetApprovalRoomNameInfos() { ApplicationsForContracts afcs = new ApplicationsForContracts(); var query = from p in afcs.GetTable() orderby p.CREATEDATE descending select p.CONTRACTTITLE; return query.ToList<string>(); }
/// <summary> /// 检查是否存在该申请合同 /// </summary> /// <param name="contractNumber">合同编号</param> /// <param name="contractTitle">合同标题</param> /// <param name="contractType">合同类型</param> /// <param name="contractLelve">合同级别</param> /// <returns></returns> public bool IsExistContractApproval(string contractNumber, string contractTitle, string contractType, string contractLelve) { ApplicationsForContracts afcs = new ApplicationsForContracts(); bool IsExist = false; var q = from cnt in afcs.GetTable() where cnt.CONTRACTCODE == contractNumber && cnt.CONTRACTTITLE == contractTitle && cnt.CONTRACTTYPEID == contractType && cnt.CONTRACTLEVEL == contractLelve orderby cnt.CREATEUSERID select cnt; if (q.Count() > 0) { IsExist = true; } return IsExist; }
/// <summary> /// 修改申请信息 /// </summary> /// <param name="contraApproval">申请名称</param> /// <returns></returns> public bool UpdateContraApproval(T_OA_CONTRACTAPP contraApproval) { bool result = false; try { ApplicationsForContracts afcs = new ApplicationsForContracts(); var users = from ent in dal.GetObjects<T_OA_CONTRACTAPP>() where ent.CONTRACTAPPID == contraApproval.CONTRACTAPPID select ent; if (users.Count() > 0) { var user = users.FirstOrDefault(); contraApproval.UPDATEDATE = Convert.ToDateTime(DateTime.Now.ToShortDateString()); user.CONTRACTFLAG = contraApproval.CONTRACTFLAG;//合同标志 user.CONTRACTTITLE = contraApproval.CONTRACTTITLE;//标题 user.CHECKSTATE = contraApproval.CHECKSTATE;//审批状态 user.CONTENT = contraApproval.CONTENT;//正文 user.CONTRACTTYPEID = contraApproval.CONTRACTTYPEID;//类型ID user.CONTRACTLEVEL = contraApproval.CONTRACTLEVEL;//级别 user.CONTRACTCODE = contraApproval.CONTRACTCODE;//合同编号 user.UPDATEUSERID = contraApproval.UPDATEUSERID;//修改人ID user.UPDATEUSERNAME = contraApproval.UPDATEUSERNAME;//修改人姓名 user.PARTYA = contraApproval.PARTYA;//甲方 user.PARTYB = contraApproval.PARTYB;//乙方 user.STARTDATE = contraApproval.STARTDATE;//开始时间 user.ENDDATE = contraApproval.ENDDATE;//结束时间 user.EXPIRATIONREMINDER = contraApproval.EXPIRATIONREMINDER;//到期提醒天数 int i = Update(user); if (i > 0) { if (contraApproval.CHECKSTATE == "2") { List<object> objArds = new List<object>(); DateTime Days = Convert.ToDateTime(contraApproval.ENDDATE).AddDays(-Convert.ToInt32(contraApproval.EXPIRATIONREMINDER)); string NewsLinks = " <AssemblyName>SMT.SaaS.OA.UI</AssemblyName>" + "<PublicClass>SMT.SaaS.OA.UI.Utility</PublicClass>" + "<ProcessName>CreateFormFromEngine</ProcessName>" + "<PageParameter>SMT.SaaS.OA.UI.Views.ContractManagement.ApplicationsForContractsPages</PageParameter>" + "<ApplicationOrder>" + contraApproval.CONTRACTAPPID + "</ApplicationOrder>" + "<FormTypes>Audit</FormTypes> "; objArds.Add(contraApproval.OWNERCOMPANYID); objArds.Add("OA"); objArds.Add("Contrat"); objArds.Add(contraApproval.CONTRACTAPPID); objArds.Add(Days.ToString("yyyy/MM/d")); objArds.Add("09:00"); objArds.Add("Day"); objArds.Add(contraApproval.PARTYA); objArds.Add(contraApproval.PARTYB + "的合同于" + Convert.ToDateTime(contraApproval.ENDDATE).ToString("yyyy-MM-dd") + ",到期"); objArds.Add(NewsLinks); objArds.Add(""); objArds.Add(""); objArds.Add(""); objArds.Add("Г"); objArds.Add(""); Utility.SendEngineEventTriggerData(objArds); } result = true; } } return result; } catch (Exception ex) { Tracer.Debug("合同申请ContractApprovalBLL-UpdateContraApproval" + System.DateTime.Now.ToString() + " " + ex.ToString()); throw (ex); } }