/// <summary> /// ���ļ���ʼ��ƥ���� /// </summary> private void InitMatchResult() { Result = MatchResult.CreateFromFile(ActionId) as SupplierMatcherResult; CurrentLeadId = Result.ItemToMatch.Id; StringBuilder html = new StringBuilder(); string temp=SystemControlTemplates.GetTemplate("matched_suppliers_list"); foreach (MatchedSupplierInfo spInfo in Result.MatchedItems.Items) { html.AppendFormat(temp, spInfo.Id, spInfo.CompanyName, spInfo.MatchStatus, spInfo.MatchStatusDetails.AreaMatchStatus, spInfo.MatchStatusDetails.IndustryMatchStatus, spInfo.GeneralScore, spInfo.Priority); } MatchedSuppliersList = html.ToString(); }
public override MatchResult Match() { /* SupplierListForMatch @leadId varchar(32)='', --ָ��Lead,Lead��Category����@category���� @category varchar(30)='', --ָ������ @sortBy smallint=0, --ָ������,0-����������,1-��ҵרע������,2-���ȼ����� @balance int=0, --����0ʱ���ƹ�Ӧ���������趨ֵ @chkIndustry bit=0, --Ϊ1ʱ��ʾ�����ҵ����Ҫ�� @chkNature bit=0 --Ϊ1ʱ�����ҵ����Ҫ�� */ actionId = MatchActions.GetNewLeadsMatchActionID(leadsId); MatchResult result = new SupplierMatcherResult(actionId, leadsId, supplierSortPriority); SqlParameter[] prams ={ Database.MakeInParam("@leadId",SqlDbType.Int,leadsId), Database.MakeInParam("@category",SqlDbType.VarChar,30,""), Database.MakeInParam("@sortBy",SqlDbType.SmallInt,(short)supplierSortPriority), Database.MakeInParam("@balance",SqlDbType.Int,allowZeroBalance?0:1), Database.MakeInParam("@chkIndustry",SqlDbType.Bit,preCheckIndustry), Database.MakeInParam("@chkNature",SqlDbType.Bit,preCheckNature) }; SqlDataReader reader = null; try { reader = Database.ExecuteReader(CommandType.StoredProcedure, "SupplierListForMatch", prams); while (reader.Read()) { IMatchedItem item = new MatchedSupplierInfo(result.ItemToMatch,reader); result.AddItem(item); } reader.Close(); } catch { throw; } finally { if (reader != null) { reader.Close(); } } //��ʼ��Ŀ��Leads��ƥ��״̬ΪMatchNone Lead.SetMatchStatus(leadsId.ToString(), LeadMatchStatus.MatchNone); //����ƥ������Ľ������������ƥ��״̬ MatchActions.UpdateResults(actionId, result.MatchedItems.Items.Count); return result; }