Ejemplo n.º 1
0
        public static ArrayList List(int actionId,string leadIdOrGuid,string category,string area,
            int spId,int buyerId,short mailed,short viewed,short evaled,Pager pager)
        {
            /*
             MatchedLeadList
            @actionId int=0,		--ָ������ID
            @leadId varchar(32)='',		--ָ��Lead
            @cate varchar(30)='',		--ָ������
            @area varchar(6)='',		--ָ��ij������
            @spId int=0,			--ָ����Ӧ��
            @buyerId int=0,			--ָ��Buyer
            @mailed smallint=-1,		--����-1ʱָ���ʼ�״̬
            @viewed smallint=-1,		--����-1ʱָ���鿴״̬
            @evaled smallint=-1,		--����-1ʱָ������״̬
            @pageIndex int=1,		--ָ����ҳҳ��
            @pageSize int=20,		--ָ����ҳ��С
            @sort int=0			--ָ������
             */

            ArrayList list = new ArrayList();

            SqlParameter[] prams ={
                Database.MakeInParam("@actionId",SqlDbType.Int,actionId),
                Database.MakeInParam("@leadId",SqlDbType.VarChar,32,leadIdOrGuid),
                Database.MakeInParam("@cate",SqlDbType.VarChar,30,category),
                Database.MakeInParam("@area",SqlDbType.VarChar,6,area),
                Database.MakeInParam("@spId",SqlDbType.Int,spId),
                Database.MakeInParam("@buyerId",SqlDbType.Int,buyerId),
                Database.MakeInParam("@mailed",SqlDbType.SmallInt,mailed),
                Database.MakeInParam("@viewed",SqlDbType.SmallInt,viewed),
                Database.MakeInParam("@evaled",SqlDbType.SmallInt,evaled),
                Database.MakeInParam("@pageIndex",SqlDbType.Int,pager.PageIndex),
                Database.MakeInParam("@pageSize",SqlDbType.Int,pager.PageSize),
                Database.MakeInParam("@sort",SqlDbType.Int,pager.SortNum)
            };

            SqlDataReader reader = null;

            try
            {
                reader = Database.ExecuteReader(CommandType.StoredProcedure, "MatchedLeadList", prams);
                if (reader.Read())
                {
                    pager.RecordCount = reader.GetInt32(0);

                    if (reader.NextResult())
                    {
                        while (reader.Read())
                        {
                            //0-7:[Id], LeadId, LeadGuid, Category, Area, IndustryRequired, Nature, [Datetime],
                            //8-13:ActionId, SupplierId,SupplierName, BuyerId,BuyerName, MatchedDatetime,
                            //14-17:Mailed, Viewed, Evaluated
                            MatchedLeads mlead = new MatchedLeads();
                            mlead.id = reader.GetInt32(0);
                            mlead.actionId = reader.GetInt32(8);
                            mlead.datetime = reader.GetDateTime(13);
                            mlead.mailed = reader.GetBoolean(14);
                            mlead.viewed = reader.GetBoolean(15);
                            mlead.evaluated = reader.GetBoolean(16);
                            mlead.lead = new Lead(reader.GetInt32(1),reader.GetString(2),reader.GetDateTime(7));
                            mlead.lead.Category = reader.GetString(3);
                            mlead.lead.Area = reader.GetString(4);
                            mlead.lead.IndustryRequire = reader.GetBoolean(5);
                            mlead.lead.NatrueRequire = reader.GetInt16(6);
                            mlead.supplierId = reader.GetInt32(9);
                            mlead.supplierName = reader.GetString(10);
                            mlead.buyerId = reader.GetInt32(11);
                            mlead.buyerName = reader.GetString(12);
                            list.Add(mlead);
                        }
                    }
                }
                reader.Close();
            }
            catch
            {
                throw;
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return list;
        }
Ejemplo n.º 2
0
        public static MatchedLeads Get(int id,int comId)
        {
            /*
             MatchedLeadGet
            @id int,
            @comId int=0
             */

            MatchedLeads mlead = null;

            SqlDataReader reader = null;

            try
            {
                reader = Database.ExecuteReader(CommandType.StoredProcedure, "MatchedLeadGet",
                    new SqlParameter[] {
                        Database.MakeInParam("@id",SqlDbType.Int,id),
                        Database.MakeInParam("@comId",SqlDbType.Int,comId)
                    });
                if (reader.Read())
                {
                    //0-7:[Id], LeadId, LeadGuid, Category, Area, IndustryRequired, Nature, [Datetime],
                    //8-13:ActionId, SupplierId,SupplierName, BuyerId,BuyerName, MatchedDatetime,
                    //14-17:Mailed, Viewed, Evaluated, MatchStatus
                    mlead = new MatchedLeads();
                    mlead.id = reader.GetInt32(0);
                    mlead.actionId = reader.GetInt32(8);
                    mlead.datetime = reader.GetDateTime(13);
                    mlead.mailed = reader.GetBoolean(14);
                    mlead.viewed = reader.GetBoolean(15);
                    mlead.evaluated = reader.GetBoolean(16);
                    mlead.lead = new Lead(reader.GetInt32(1), reader.GetString(2), reader.GetDateTime(7));
                    mlead.lead.Category = reader.GetString(3);
                    mlead.lead.Area = reader.GetString(4);
                    mlead.lead.IndustryRequire = reader.GetBoolean(5);
                    mlead.lead.NatrueRequire = reader.GetInt16(6);
                    mlead.supplierId = reader.GetInt32(9);
                    mlead.supplierName = reader.GetString(10);
                    mlead.buyerId = reader.GetInt32(11);
                    mlead.buyerName = reader.GetString(12);
                }
                reader.Close();
            }
            catch
            {
                //
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return mlead;
        }