Beispiel #1
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (Request["id"] != null)
     {
         CurrentLead = Lead.Get(Request["id"].Trim());
         CurrentLeadInfo = CurrentLead.GetInfo();
     }
 }
        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();
            }
        }
        private void SaveTempLeads()
        {
            string tempGuid = Util.GetCookie(_COOKIE_NAME);
            if (tempGuid.Length != 32)
            {
                tempGuid = Util.NewGuid;
            }

            LeadInfo info = new LeadInfo(tempGuid);
            info.Category = Request.Form["currentCategory"].Trim();
            ArrayList questions = Question.List(info.Category);
            if (questions.Count == 0)
            {
                Response.Write("false:4");
                return;
            }

            foreach (Question question in questions)
            {
                bool spVisilble = (question.Decoration == QuestionDecoration.ForSupplier || question.Decoration == QuestionDecoration.ForSupplierAndSampleLeads);
                bool sampVisible = (question.Decoration == QuestionDecoration.ForSampleLeads || question.Decoration == QuestionDecoration.ForSupplierAndSampleLeads);
                string details = "";

                if (!String.IsNullOrEmpty(question.VariableName.Trim()))
                {
                    details = Request.Form[question.VariableName] == null ? "" : Request.Form[question.VariableName].Trim();
                    switch (question.VariableName.ToLower())
                    {
                        case "sparea":
                            info.Area = TrimSpAreas(details,5);
                            details = ConvertAreaCodeToName(info.Area);
                            break;

                        case "spindustry":
                            info.IndustryRequired = details == "1";
                            details = info.IndustryRequired ? "�ǵ�" : "����ν";
                            break;

                        case "spnature":
                            try
                            {
                                info.Nature = Convert.ToInt16(details);
                                if (info.Nature==0)
                                {
                                    details = "���ڹ�˾";
                                }
                                else if (info.Nature == 1)
                                {
                                    details = "���ʹ�˾";
                                }
                                else
                                {
                                    details = "��Ҫ��";
                                }
                            }
                            catch
                            {
                                //
                            }
                            break;

                        case "byarea":
                            info.BuyerArea = details;
                            details = ConvertAreaCodeToName(info.BuyerArea);
                            break;

                        case "byemail":
                            info.Email = details;
                            break;
                    }
                }
                else
                {
                    details = Request.Form["QUESTION_" + question.Id] == null ? "" : Request.Form["QUESTION_" + question.Id].Trim();
                }

                LeadInfoItem item = new LeadInfoItem(question.Id, question.VariableName, question.Title,question.RequestTitle, details, spVisilble, sampVisible);
                info.AddRequest(item);
            }

            if (info.SaveAs(GeneralConfig.AppDataPath + "\\Leads\\temp\\"))
            {
                Util.WriteCookie(_COOKIE_NAME, info.Guid, 30);
                Util.WriteCookie("KEBIBI_BUYER_EMAIL", info.Email, 360);//�洢Email��Cookie
                Response.Write("true");
                return;
            }
            Response.Write("false:5");
        }
Beispiel #4
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            LeadGuid = Util.GetCookie(QuestionaryHandler._COOKIE_NAME);
            CurrentLeadInfo = LeadInfo.Get(LeadGuid);
            if (CurrentLeadInfo == null)
            {
                Response.Redirect("/MarketingService/allCategories.aspx");
                Response.End();
                return;
            }

            if (CurrentLeadInfo.Guid != LeadGuid)
            {
                Response.Redirect("/MarketingService/allCategories.aspx");
                Response.End();
                return;
            }

            if (Request.HttpMethod == "POST")
            {
                Response.Clear();
                if (Request.Form["ajaxAction"] != null)
                {
                    switch (Request.Form["ajaxAction"].Trim())
                    {
                        //�ύ���󣬲�����Buyer����
                        case "BuyerSignPage.saveRequire":
                            SaveRequire();
                            break;

                        //Buyer��֤�ʼ���ַ
                        case "BuyerSignPage.validataEmail":
                            ValidataEmail();
                            break;
                    }
                }
                Response.End();
                return;
            }

            LeadInfoHtml = new StringBuilder();
            foreach (LeadInfoItem item in CurrentLeadInfo.Requests)
            {
                LeadInfoHtml.AppendLine("<h2 class=\"midFnt clr333\">" + item.Title + "</h2>");
                LeadInfoHtml.AppendLine("<p class=\"ident midFnt clr666\">" + item.Details + "</p>");
            }

            Buyer buyer = Buyer.GetCookie();
            if (buyer != null)
            {
                if (String.Equals(buyer.Email,CurrentLeadInfo.Email,StringComparison.OrdinalIgnoreCase))
                {
                    CurrentBuyerInfo[0] = buyer.Id.ToString();
                    CurrentBuyerInfo[1] = buyer.Guid;
                    CurrentBuyerInfo[2] = buyer.Email;
                    CurrentBuyerInfo[3] = buyer.Name;
                    CurrentBuyerInfo[4] = buyer.Gender.ToString();
                    CurrentBuyerInfo[5] = buyer.CompanyName;
                    CurrentBuyerInfo[6] = buyer.Industry;
                    CurrentBuyerInfo[7] = buyer.Nature;
                    CurrentBuyerInfo[8] = buyer.Address;
                    CurrentBuyerInfo[9] = buyer.ZIP;
                    CurrentBuyerInfo[10] = buyer.PhoneNumber;
                    CurrentBuyerInfo[11] = buyer.Title;
                    CurrentBuyerInfo[12] = buyer.Employees[0].ToString() + "," + buyer.Employees[1].ToString();
                    CurrentBuyerInfo[13] = buyer.Website;
                }
            }
        }