示例#1
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();
            }
        }
示例#2
0
        public static Buyer GetCookie()
        {
            if (!Cookies.HasCookie(COOKIE_NAME))
            {
                return null;
            }

            Buyer b = new Buyer();
            try
            {
                b.id = Convert.ToInt32(Cookies.GetCookieValue(COOKIE_NAME, "ID"));
            }
            catch
            {
                //
            }

            b.guid = Cookies.GetCookieValue(COOKIE_NAME, "GUID");
            b.email = Cookies.GetCookieValue(COOKIE_NAME, "EMAIL");
            b.name = Cookies.GetCookieValue(COOKIE_NAME, "NAME");
            b.gender = Convert.ToChar(Cookies.GetCookieValue(COOKIE_NAME, "GENDER"));
            b.title = Cookies.GetCookieValue(COOKIE_NAME, "TITLE");
            b.companyName = Cookies.GetCookieValue(COOKIE_NAME, "COMNAME");
            b.industry = Cookies.GetCookieValue(COOKIE_NAME, "INDUSTRY");
            b.nature = Cookies.GetCookieValue(COOKIE_NAME, "NATURE");

            try
            {
                string emp=Cookies.GetCookieValue(COOKIE_NAME, "EMPLOYEE");
                b.employees[0] = Convert.ToInt32(emp.Split(',')[0]);
                b.employees[1] = Convert.ToInt32(emp.Split(',')[1]);
            }
            catch
            {
                //
            }

            b.zip = Cookies.GetCookieValue(COOKIE_NAME, "ZIP");
            b.address = Cookies.GetCookieValue(COOKIE_NAME, "ADDRESS");
            b.phoneNumber = Cookies.GetCookieValue(COOKIE_NAME, "PHONE");
            b.website = Cookies.GetCookieValue(COOKIE_NAME, "WEB");

            return b;
        }
示例#3
0
        /// <summary>
        /// ��ȡָ��Guid��Email��Buyer����
        /// </summary>
        /// <param name="guidOrEmail"></param>
        /// <returns></returns>
        public static Buyer Get(string guidOrEmail)
        {
            /*BuyerGet
                @id varchar(50)	--Id,Guid or Email
             */

            /*[Id], GroupId, Guid, Email, [Name], Gender,
             * CompanyName, Industry,Nature, Address, PhoneNumber,
             * ZIP, Website, FirstLogin, LastLogin,
             * LastIP, LoginTimes, Points, Status, Title, Employees
             */

            Buyer buyer = null;
            SqlParameter[] prams ={ Database.MakeInParam("@id", SqlDbType.VarChar, 50, guidOrEmail) };
            SqlDataReader reader = null;
            try
            {
                reader = Database.ExecuteReader(CommandType.StoredProcedure, "BuyerGet", prams);

                if (reader.Read())
                {
                    buyer = new Buyer();
                    buyer.id = reader.GetInt32(0);
                    buyer.groupId = reader.GetInt32(1);
                    buyer.guid = reader.GetString(2);
                    buyer.email = reader.GetString(3);
                    buyer.name = reader.GetString(4);
                    buyer.gender = Convert.ToChar(reader.GetString(5));
                    buyer.companyName = reader.GetString(6);
                    buyer.industry = reader.GetString(7);
                    buyer.nature = reader.GetString(8);
                    buyer.address = reader.GetString(9);
                    buyer.phoneNumber = reader.GetString(10);
                    buyer.zip = reader.GetString(11);
                    buyer.website = reader.GetString(12);
                    buyer.firstLogin = reader.GetDateTime(13);
                    buyer.lastLogin = reader.GetDateTime(14);
                    buyer.lastIP = reader.GetString(15);
                    buyer.loginTimes = reader.GetInt32(16);
                    buyer.points = reader.GetInt32(17);
                    buyer.status = (CompanyStatus)(reader.GetInt16(18));
                    buyer.title = reader.GetString(19);

                    string emps = reader.IsDBNull(20)?"0,0":reader.GetString(20);
                    buyer.employees = Util.SplitStringToIntArray(emps, 2);

                }
                reader.Close();
            }
            catch
            {
                //
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return buyer;
        }
示例#4
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");
        }