Ejemplo n.º 1
0
        //:TODO 询盘写入数据
        public static void EnquirySave(string ipString, string email, string content, string productUrl,
                                       string productName,
                                       string yourName, string company, string tel, string msn, string language, string country, string recievedId)
        {
            if (string.IsNullOrWhiteSpace(content))
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(email))
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(productUrl))
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(tel))
            {
                //return;
                tel = "";
            }
            if (string.IsNullOrWhiteSpace(yourName))
            {
                //return;
                yourName = "";
            }
            if (string.IsNullOrWhiteSpace(company))
            {
                company = "";
            }
            if (string.IsNullOrWhiteSpace(msn))
            {
                //return;
                msn = "";
            }
            if (!CheckTools.IsValidEmail(email))
            {
                return;
            }
            //if (!CheckTools.IsAllNumber(tel))
            //{
            //    return;
            //}

            //add by luoyaqi 20140712
            Manager manger = managerRepository.GetManagerByUserName(recievedId.Trim());

            if (manger == null)
            {
                return;
            }

            long languageId = 0;

            BaseDictionary baseDictionary = baseDictionaryRepository.GetDictionaryByValue(language);

            if (baseDictionary != null)
            {
                Enquiry enquiry = EnquiryFactory.Create(ipString, email, content, productUrl, productName, yourName,
                                                        company, tel, msn,
                                                        language, baseDictionary.Id, country, manger.Id, manger.UserName);

                enquiry.EnquiryTimes  = enquiryRepository.GetEnquiryTimesByEmail(email) + 1;
                enquiry.ReceiverEmail = manger.UserName;
                enquiryRepository.Save(enquiry);
                SendEmail("YiSearch 邮件询盘提醒", "YiSearch 邮件询盘提醒", manger.BindEmail);
            }
        }