/// <summary> /// 获取合同号 /// </summary> void GetHeTongHao() { StringBuilder s = new StringBuilder(); var info = new EyouSoft.Model.ConStructure.MAutocompleteChaXunInfo(); info.Length = 10; info.HeTongCode = Utils.GetQueryStringValue("q"); info.HeTongId = Utils.GetQueryStringValue("yuanhetongid"); info.LeiXing = null; info.Status = EyouSoft.Model.EnumType.ConStructure.ContractStatus.领用; var items = new EyouSoft.BLL.ConStructure.BContractNum().GetAutocompleteHeTongs(CompanyId, info); if (items == null || items.Count == 0) { Utils.RCWE("未匹配到该合同号| "); } foreach (var item in items) { s.Append(item.ContractCode + "|" + item.ContractId + "\n"); } items = null; Utils.RCWE(s.ToString()); }
/// <summary> /// 根据条件获得合同号列表 /// </summary> /// <param name="companyId">公司编号</param> /// <param name="info">查询</param> /// <returns></returns> public IList <Model.ConStructure.MContractNumList> GetAutocompleteHeTongs(string companyId, EyouSoft.Model.ConStructure.MAutocompleteChaXunInfo info) { if (string.IsNullOrEmpty(companyId) || info == null) { return(null); } if (info.Length < 1) { info.Length = 1; } return(dal.GetAutocompleteHeTongs(companyId, info)); }
/// <summary> /// 根据条件获得合同号列表 /// </summary> /// <param name="companyId">公司编号</param> /// <param name="info">查询</param> /// <returns></returns> public IList <Model.ConStructure.MContractNumList> GetAutocompleteHeTongs(string companyId, EyouSoft.Model.ConStructure.MAutocompleteChaXunInfo info) { IList <EyouSoft.Model.ConStructure.MContractNumList> ResultList = null; string sql = string.Empty; sql += string.Format(" SELECT TOP {0} [ContractId],[ContractCode] FROM [tbl_ContractNum] ", info.Length); sql += string.Format(" WHERE [CompanyId]='{0}' AND [IsDelete]='0' ", companyId); if (!string.IsNullOrEmpty(info.HeTongCode)) { sql += string.Format(" AND [ContractCode] LIKE '%{0}%' ", info.HeTongCode); } if (info.LeiXing.HasValue) { sql += string.Format(" AND [ContractType]={0} ", (int)info.LeiXing.Value); } if (info.Status.HasValue || !string.IsNullOrEmpty(info.HeTongId)) { sql += " AND(1=0 "; if (info.Status.HasValue) { sql += string.Format(" OR [ContractStatus]={0} ", (int)info.Status.Value); } if (!string.IsNullOrEmpty(info.HeTongId)) { sql += string.Format(" OR [ContractId]='{0}' ", info.HeTongId); } sql += " ) "; } DbCommand dc = this._db.GetSqlStringCommand(sql); using (IDataReader dr = EyouSoft.Toolkit.DAL.DbHelper.ExecuteReader(dc, this._db)) { ResultList = new List <EyouSoft.Model.ConStructure.MContractNumList>(); EyouSoft.Model.ConStructure.MContractNumList model = null; while (dr.Read()) { model = new EyouSoft.Model.ConStructure.MContractNumList(); model.ContractId = dr.GetString(dr.GetOrdinal("ContractId")); model.ContractCode = dr["ContractCode"].ToString(); ResultList.Add(model); } }; return(ResultList); }