Ejemplo n.º 1
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (Request["id"] != null)
     {
         CurrentLead = Lead.Get(Request["id"].Trim());
         CurrentLeadInfo = CurrentLead.GetInfo();
     }
 }
Ejemplo n.º 2
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (Request.PathInfo.Split('/').Length != 2)
            {
                Response.Redirect("/MarketingService/allCategories.aspx");
                Response.End();
            }

            guid = Request.PathInfo.Split('/')[1].Trim();

            if (guid.Length != 32)
            {
                Response.Redirect("/MarketingService/allCategories.aspx");
                Response.End();
            }

            CurrentLead = Lead.Get(guid);
            if (CurrentLead == null)
            {
                Response.Redirect("/MarketingService/allCategories.aspx");
                Response.End();
            }

            CurrentLeadInfo = CurrentLead.GetInfo();
            if (CurrentLeadInfo == null)
            {
                Response.Redirect("/MarketingService/allCategories.aspx");
                Response.End();
            }

            CurrentBuyer = Buyer.Get(CurrentLead.BuyerId);
            if (CurrentBuyer == null)
            {
                Response.Redirect("/MarketingService/allCategories.aspx");
                Response.End();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// ��ȡLead�б�
        /// </summary>
        /// <param name="bid">BuyerId</param>
        /// <param name="cate">�������</param>
        /// <param name="area">����</param>
        /// <param name="indusRequire">�Ƿ�Ҫ����ҵ����</param>
        /// <param name="natureRequire">��ҵ����Ҫ��</param>
        /// <param name="chked">���״̬</param>
        /// <param name="matchSta">ƥ��״̬</param>
        /// <param name="start">��ʼ����</param>
        /// <param name="end">��ֹ����</param>
        /// <param name="pager">��ҳ</param>
        /// <returns></returns>
        public static ArrayList List(int bid,string cate, string area, int indusRequire,short natureRequire, short chk, short matchSta,DateTime start,DateTime end, Pager pager)
        {
            /*
            LeadList
            @buyerId int=0,
            @category varchar(30)='',
            @area varchar(100)='',
            @indusReq smallint=-1,
            @natureReq smallint=-2,
            @chk smallint=-1,
            @mSta smallint=-1,
            @start varchar(20)='',
            @end varchar(20)='',
            @pageIndex int=1,
            @pageSize int=20,
            @sort int=0
            */

            //[Id],Guid, BuyerId,BuyerName,Category, Area, IndustryRequired, Nature, [Datetime], CheckStatus,MatchStatus

            ArrayList list = new ArrayList();

            SqlParameter[] prams ={
                Database.MakeInParam("@buyerId",SqlDbType.Int,bid),
                Database.MakeInParam("@category",SqlDbType.VarChar,30,cate),
                Database.MakeInParam("@area",SqlDbType.VarChar,100,area),
                Database.MakeInParam("@indusReq",SqlDbType.SmallInt,indusRequire),
                Database.MakeInParam("@natureReq",SqlDbType.SmallInt,natureRequire),
                Database.MakeInParam("@chk",SqlDbType.SmallInt,chk),
                Database.MakeInParam("@mSta",SqlDbType.SmallInt,matchSta),
                Database.MakeInParam("@start",SqlDbType.VarChar,20,start==DateTime.MinValue?"":start.ToShortDateString()),
                Database.MakeInParam("@end",SqlDbType.VarChar,20,end==DateTime.MinValue?"":end.ToShortDateString()),
                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, "LeadList", prams);
                if (reader.Read())
                {
                    pager.RecordCount = reader.GetInt32(0);

                    if (reader.NextResult())
                    {
                        while (reader.Read())
                        {
                            Lead lead = new Lead();
                            lead.id = reader.GetInt32(0);
                            lead.guid = reader.GetString(1);
                            lead.buyerId = reader.GetInt32(2);
                            lead.buyerName = reader.GetString(3);
                            lead.category = reader.GetString(4);
                            lead.area = reader.GetString(5);
                            lead.industryRequire = reader.GetBoolean(6);
                            lead.natureRequire = reader.GetInt16(7);
                            lead.datetime = reader.GetDateTime(8);
                            lead.checkStatus = (LeadCheckStatus)reader.GetInt16(9);
                            lead.matchStatus = (LeadMatchStatus)reader.GetInt16(10);
                            lead.publicStatus = reader.GetInt16(11);
                            list.Add(lead);
                        }
                    }
                }
                reader.Close();
            }
            catch
            {

            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return list;
        }
Ejemplo n.º 4
0
        public static Lead Get(string guid)
        {
            /*
             LeadGet
            @id varchar(32)
             */

            //[Id],Guid, BuyerId,BuyerName,Category, Area, IndustryRequired, Nature, [Datetime], CheckStatus,MatchStatus

            Lead lead = null;

            SqlDataReader reader = null;

            try
            {
                reader = Database.ExecuteReader(CommandType.StoredProcedure, "LeadGet",
                    new SqlParameter[] {Database.MakeInParam("@id",SqlDbType.VarChar,32,guid) });
                if (reader.Read())
                {
                    lead = new Lead();
                    lead.id = reader.GetInt32(0);
                    lead.guid = reader.GetString(1);
                    lead.buyerId = reader.GetInt32(2);
                    lead.buyerName = reader.GetString(3);
                    lead.category = reader.GetString(4);
                    lead.area = reader.GetString(5);
                    lead.industryRequire = reader.GetBoolean(6);
                    lead.natureRequire = reader.GetInt16(7);
                    lead.datetime = reader.GetDateTime(8);
                    lead.checkStatus = (LeadCheckStatus)reader.GetInt16(9);
                    lead.matchStatus = (LeadMatchStatus)reader.GetInt16(10);
                    lead.publicStatus = reader.GetInt16(11);
                }
                reader.Close();
            }
            catch
            {
                //
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return lead;
        }
Ejemplo n.º 5
0
        private void SaveRequire()
        {
            //����Buyer
            if (Request.Form["email"] != null &&
                Request.Form["uname"] != null &&
                Request.Form["ugender"] != null &&
                Request.Form["utitle"] != null &&
                Request.Form["comName"] != null &&
                Request.Form["comIndustry"] != null &&
                Request.Form["comNature"] != null &&
                Request.Form["comEmployee"] != null &&
                Request.Form["comLocation"] != null &&
                Request.Form["comAddress"] != null &&
                Request.Form["comPhone"] != null)
            {
                string buyerGuid = Request.Form["buyerId"]==null?"":Request.Form["buyerId"].Trim();
                bool isPublic = Request.Form["isPublic"] == null ? false : (Request.Form["isPublic"].Trim() == "1" ? true : false);

                if (String.IsNullOrEmpty(buyerGuid) && Company.IsExistsEmail(Request.Form["email"].Trim()))
                {
                    Response.Write("existEmail");
                    return;
                }

                if (String.IsNullOrEmpty(buyerGuid))
                {
                    buyerGuid = Util.NewGuid;
                }

                Buyer buyer = new Buyer();
                buyer.InviteUserId = GetInviteUserId;
                buyer.Email = Request.Form["email"].Trim();
                buyer.Name = Request.Form["uname"].Trim();
                buyer.Gender = Convert.ToChar(Request.Form["ugender"].Trim());
                buyer.Title = Request.Form["utitle"].Trim();
                buyer.CompanyName = Request.Form["comName"].Trim();
                buyer.Industry = Request.Form["comIndustry"].Trim();
                buyer.Nature = Request.Form["comNature"].Trim();

                try
                {
                    buyer.Employees[0] = Convert.ToInt32(Request.Form["comEmployee"].Split(',')[0]);
                    buyer.Employees[1] = Convert.ToInt32(Request.Form["comEmployee"].Split(',')[1]);
                }
                catch
                {
                    //
                }

                buyer.ZIP = Request.Form["comLocation"].Trim();
                buyer.Address = Request.Form["comAddress"].Trim();
                buyer.PhoneNumber = Request.Form["comPhone"].Trim();
                buyer.Website = Request.Form["comWebsite"] != null ? Request.Form["comWebsite"].Trim() : "";

                int buyerId = buyer.Save(buyerGuid);

                if (buyerId > 0)
                {
                    //���¿ͻ�Email��Cookie
                    Util.WriteCookie("KEBIBI_BUYER_EMAIL", buyer.Email, 360);

                    //����Buyer Cookie
                    buyer.WriteCookie(360);

                    //����Lead
                    Lead lead = new Lead(LeadGuid, CurrentLeadInfo.Category, buyerId);
                    lead.Area = CurrentLeadInfo.Area;
                    lead.IndustryRequire = CurrentLeadInfo.IndustryRequired;
                    lead.NatrueRequire = CurrentLeadInfo.Nature;

                    lead.PublicStatus = isPublic ? (short)1 : (short)0;

                    if (lead.Save())
                    {
                        //�ƶ���ʱ�����ļ�
                        CurrentLeadInfo.Move(GeneralConfig.AppDataPath + "\\leads\\" + lead.Category + "\\" + DateTime.Now.ToString("yyyyMM")+"\\");

                        //�����ʼ�֪ͨ
                        MailTempItem mailTemp = MailTemplates.GetTemplate("buyer_require_over_email");
                        string[] args = new string[] {
                            buyer.CompanyName,
                            lead.Id.ToString(),
                            lead.Datetime.ToShortDateString(),
                            lead.Category,
                            lead.CategoryName,
                            CurrentLeadInfo.ToHtmlListForBuyer2("<p>{0}��{1}</p>")
                        };

                        SmtpMail sm = SmtpMail.Instance;
                        sm.AddRecipient(new string[] { buyer.Email });
                        sm.Html = mailTemp.Html;
                        sm.Subject = String.Format(mailTemp.Subject, args);
                        sm.Body = String.Format(mailTemp.Body, args);

                        bool snd = sm.Send();

                        //ɾ����ʱLead Guid��Cookie
                        Util.RemoveCookie(QuestionaryHandler._COOKIE_NAME);

                        //���浱ǰLead��ID��Cookie
                        Util.WriteCookie("KEBIBI_REQUIRE_INFO", CrypticString.Encrypt("id="+lead.Id.ToString()+"&guid="+lead.Guid+"&date="+lead.Datetime.ToShortDateString()+"&email="+buyer.Email+"&zip="+buyer.ZIP+"&zipName="+buyer.ZIPName+"&category="+lead.Category+"&categoryName="+lead.CategoryName,true));

                        Response.Write("true");
                        return;
                    }
                }
            }

            Response.Write("false");
        }