public static CustomerVM TransformFromCustomerDT(CustomerDT customer, string creditCardType) { return(new CustomerVM() { Address = customer.Address, AuthorizeProfileId = customer.AuthorizeProfileId, BadLoginCount = customer.BadLoginCount, CancelledDate = customer.CancelledDate, City = customer.City, CreatedAt = customer.CreatedAt, Email = customer.Email, FirstName = customer.FirstName, Id = customer.Id, LastBillDate = customer.LastBillDate, LastName = customer.LastName, NcId = customer.NcId, NextBillDate = customer.NextBillDate, Phone = customer.Phone, Referrer = customer.Referrer, Refunded = customer.Refunded, Site = customer.Site, SiteId = customer.SiteId, StateId = customer.StateId, Status = customer.Status.ToString(), ZipCode = customer.ZipCode, CreditCardType = creditCardType, EmailForm = customer.EmailForm }); }
static void Main(string[] args) { using (CastleClub.BusinessLogic.Data.CastleClubEntities entities = new BusinessLogic.Data.CastleClubEntities()) { var sites = entities.Sites.ToList(); int capEmail = int.Parse(System.Configuration.ConfigurationManager.AppSettings["CapEmail"]); foreach (var site in sites) { if ((site.SendWelcomeEmail == true) && (site.WelcomeEmailDelay != null) && (site.WelcomeEmailDelay > 0)) { int delay = site.WelcomeEmailDelay == null ? 0: (int)site.WelcomeEmailDelay; DateTime mindate = DateTime.Now.Date.AddDays(-1 * (delay)); DateTime maxdate = DateTime.Now.Date.AddDays(-1 * (delay - 1)); var customerlist = entities.Customers.Where(x => x.CreatedAt >= mindate && x.CreatedAt < maxdate && x.WelcomeEmail != true && x.SiteId == site.Id && x.StatusId == "ACTIVE").ToList(); foreach (var customer in customerlist) { if (capEmail == 0 || SitesManager.GetEmailSentToday() < capEmail) { CustomerDT cust = customer.GetDT(false); SendEmail(site.Id, cust, cust.UnEncryptPass); //customer.Password = cust.Password; customer.WelcomeEmail = true; customer.WelcomeEmailDelay = delay; customer.WelcomeEmailSent = DateTime.Now; customer.UnEncryptPass = ""; entities.SaveChanges(); } } } } } }
public static int Add(CustomerDT customer) { using (SqlConnection connection = DBConnection.NewConnection()) { SqlCommand command = new SqlCommand("sp_AddCustomer", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@OwnerId", customer.OwnerId); command.Parameters.AddWithValue("@FirstName", customer.FirstName); command.Parameters.AddWithValue("@LastName", customer.LastName); command.Parameters.AddWithValue("@Email", customer.Email); command.Parameters.AddWithValue("@Gender", customer.Gender); command.Parameters.AddWithValue("@RegistrationDate", customer.RegistrationDate); command.Parameters.AddWithValue("@TechnologyList", customer.TechnologyList.ToJson()); try { connection.Open(); return(Convert.ToInt32(command.ExecuteScalar())); } catch (Exception) { return(-1); } } }
public ActionResult FullForm(FullFormVM model) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; if (!ModelState.IsValid) { model.States = LocationsManager.GetStates(); return(View(model)); } int ncid = GetNcId(); int visitId = GetVisitId(); CustomerDT customer = new CustomerDT(); customer.SiteId = model.SiteId; customer.NcId = ncid; customer.Email = model.Email; customer.FirstName = model.FirstName; customer.LastName = model.LastName; customer.Address = model.Address; customer.City = model.City; customer.StateId = model.StateId; customer.ZipCode = model.ZipCode; CreditCardDT cc = new CreditCardDT(); cc.CardNumber = model.CardNumber; cc.CVV = model.CVV; cc.ExpDate = CreditCardHelper.GetExpDate(model.ExpMonth, model.ExpYear); CCType cardType = CCType.VISA; Enum.TryParse(model.CardType.ToString(), out cardType); cc.Type = cardType; var referrer = ReferrersManagers.GetReferrer(model.Referrer); try { customer = CustomersManager.NewCustomer(((SiteDT)ViewBag.Site), customer, cc, visitId, referrer.Id, false); } catch (Exception ex) { SendExceptionEmail(ex.ToString()); CastleClub.BusinessLogic.Utils.EventViewer.Writte("CastleClub", "CastleClubFrontend", ex.Message + "\n" + ex.ToString(), System.Diagnostics.EventLogEntryType.Error); } if (customer != null) { ViewBag.Customer = customer; } else { return(View("Error")); } return(View("Welcome")); }
public static bool CreateNewCustomerPaymentProfile(SiteDT site, CustomerDT customer, string cardNumber, string expirationDate, out long paymentProfile, out string message) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; using (ServiceSoapClient client = new ServiceSoapClient()) { paymentProfile = 0; message = string.Empty; var merchant = new MerchantAuthenticationType() { name = site.AuthorizeLoginId, transactionKey = site.AuthorizeTransactionKey }; CustomerPaymentProfileType customerPPT = new CustomerPaymentProfileType(); customerPPT.customerType = CustomerTypeEnum.individual; customerPPT.customerTypeSpecified = true; customerPPT.billTo = new CustomerAddressType() { firstName = customer.FirstName, lastName = customer.LastName, address = customer.Address, city = customer.City, country = "USA", state = customer.StateId, zip = customer.ZipCode }; CreditCardType ccT = new CreditCardType(); ccT.cardNumber = cardNumber; ccT.expirationDate = expirationDate; ccT.cardCode = string.Empty; PaymentType payment = new PaymentType(); payment.Item = ccT; customerPPT.payment = payment; var resp = client.CreateCustomerPaymentProfile(merchant, customer.AuthorizeProfileId, customerPPT, ValidationModeEnum.testMode); if (resp.resultCode == MessageTypeEnum.Ok) { paymentProfile = resp.customerPaymentProfileId; return(true); } else { message = resp.messages.Select(x => x.code + ": " + x.text).Aggregate((a, b) => a + "\n" + b); } return(false); } }
public ActionResult BillingInfo(string customerId) { int id = 0; Int32.TryParse(customerId, out id); CustomerDT customer = CustomersManager.GetCustomer(id); List <InvoiceDT> invoices = CustomersManager.GetCustomerInvoices(id); decimal balance = CustomersManager.GetCustomerBalance(id); string cardType = string.Empty; ViewBag.Customer = customer; ViewBag.Invoices = invoices; ViewBag.Balance = balance; ViewBag.CardNumber = CustomersManager.GetLastFourDigitCreditCards(customer.Id, out cardType); ViewBag.CardType = cardType; return(View()); }
public ActionResult Welcome() { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; if (CastleClub.BusinessLogic.Data.GlobalParameters.EmailWelcome) { SiteDT site = ViewBag.Site; CustomerDT customer = ViewBag.Customer; CastleClub.BusinessLogic.Utils.Email.SendEmail(site.Email, CastleClub.BusinessLogic.Data.GlobalParameters.EmailPassword, CastleClub.BusinessLogic.Data.GlobalParameters.Smtp, string.Format(Properties.Resources.EmailWelcomeSubjet, site.Name), string.Format(Properties.Resources.EmailWelcomeBody, customer.FirstName + " " + customer.LastName, customer.Email, customer.ClearPassword, site.Name, site.ShortName, "PartsGeek", site.Price, site.PricePerQuarter, site.Phone, site.Email, site.OfferDomain), new List <string>() { customer.Email }, true); } return(View("Welcome")); }
private static void SendEmail(int SiteID, CustomerDT Customer, string ClearPassword) { SiteDT siteDT = SitesManager.GetSite(SiteID); string body = string.Format(Email.WelcomeBodyEmail(), Customer.FirstName, Customer.Email, ClearPassword, siteDT.Name, siteDT.Name, "PartsGeek", siteDT.Price, siteDT.PricePerQuarter, siteDT.Phone, siteDT.Email, siteDT.OfferDomain); string subject = string.Format(Email.WelcomeSubjectEmail(), siteDT.Name); /**/ CastleClub.BusinessLogic.Utils.Email.SendEmailWithBCC(siteDT.Email, siteDT.PasswordEmail, siteDT.SmtpAddress, subject, body , new List <string>() { Customer.Email }, new List <string>() { siteDT.WelcomeEmailBCC }, true); /**/ }
public static bool UpdateCustomerPaymentProfile(SiteDT site, CustomerDT customer, CreditCardDT creditCard) { using (ServiceSoapClient client = new ServiceSoapClient()) { var merchant = new MerchantAuthenticationType() { name = site.AuthorizeLoginId, transactionKey = site.AuthorizeTransactionKey }; var paymentProfileResponse = client.GetCustomerPaymentProfile(merchant, customer.AuthorizeProfileId, creditCard.AuthorizePaymentProfileId); if (paymentProfileResponse.resultCode == MessageTypeEnum.Ok) { CreditCardType creditCardType = new CreditCardType() { cardCode = string.Empty, cardNumber = creditCard.CardNumber, expirationDate = creditCard.ExpDate }; var customerUpdate = new CustomerPaymentProfileExType() { billTo = paymentProfileResponse.paymentProfile.billTo, customerPaymentProfileId = paymentProfileResponse.paymentProfile.customerPaymentProfileId, payment = new PaymentType() { Item = creditCardType } }; var updateResponse = client.UpdateCustomerPaymentProfile(merchant, customer.AuthorizeProfileId, null, ValidationModeEnum.none); if (updateResponse.resultCode == MessageTypeEnum.Ok) { return(true); } } return(false); } }
public CustomerDT GetDT(bool loadNotes) { CustomerDT res = new CustomerDT(); res.Id = Id; res.MemberId = Site != null && !string.IsNullOrEmpty(Site.GroupId) && Id > 0 ? String.Format("M{0}-{1}", Site.GroupId, Id) :string.Empty; res.SiteId = SiteId; res.Site = Site != null ? Site.Name : string.Empty; res.Referrer = Referrer != null ? Referrer.Name : string.Empty; res.NcId = NcId; res.Email = Email; res.Password = Password; res.SaltKey = SaltKey; res.FirstName = FirstName; res.LastName = LastName; res.Phone = Phone; res.Address = Address; res.City = City; res.StateId = StateId; res.ZipCode = ZipCode; res.AuthorizeProfileId = AuthorizeProfileId; res.CreatedAt = CreatedAt; res.Status = Status; res.Refunded = Refunded; res.LastBillDate = LastBillDate.HasValue ? LastBillDate.Value : DateTime.MinValue; res.NextBillDate = NextBillDate; res.CancelledDate = CancelledDate.HasValue ? CancelledDate.Value : DateTime.MinValue; res.BadLoginCount = BadLoginCount; res.EmailForm = EmailForm; res.WelcomeEmail = WelcomeEmail; res.welcomeEmailDelay = WelcomeEmailDelay; res.WelcomeEmailSent = WelcomeEmailSent; res.UnEncryptPass = UnEncryptPass; res.CancelForFailedBilling = CancelForFailedBilling; if (loadNotes) { res.Notes = Notes.ToList().Select(n => n.GetDT()).ToList(); } return(res); }
public ActionResult EmailForm(EmailFormVM model) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; if (!ModelState.IsValid) { return(View(model)); } if (Request.QueryString.AllKeys.Contains("s") && Request.QueryString.AllKeys.Contains("t")) { string siteIdentifier = Request.QueryString.GetValues("s").FirstOrDefault(); var referrer = ReferrersManagers.GetReferrer(siteIdentifier); int ncid = GetNcId(); int visitId = GetVisitId(); string email = model.Email; string token = Request.QueryString.GetValues("t").FirstOrDefault(); CustomerDT customer = null; try { customer = CustomersManager.NewCustomer(((SiteDT)ViewBag.Site), email, token, ncid, visitId, referrer.GetDT()); ViewBag.Customer = customer; } catch (Exception ex) { SendExceptionEmail(ex.ToString()); } if (customer != null) { return(View("Welcome")); } else { return(View("Error")); } } throw new Exception(); }
public static bool CreateCustomerProfileTransactionAuthCapture(SiteDT site, InvoiceDT invoice, CustomerDT customer, CreditCardDT creditCard, out long transactionId, out string message, out string code) { MerchantAuthenticationType merchantAT = new MerchantAuthenticationType(); merchantAT.name = site.AuthorizeLoginId; merchantAT.transactionKey = site.AuthorizeTransactionKey; ProfileTransactionType profileTT = new ProfileTransactionType(); ProfileTransAuthCaptureType profileTACT = new ProfileTransAuthCaptureType(); OrderExType orderET = new OrderExType(); orderET.invoiceNumber = invoice.Id.ToString(); profileTACT.amount = invoice.Amount; profileTACT.customerProfileId = customer.AuthorizeProfileId; profileTACT.customerPaymentProfileId = creditCard.AuthorizePaymentProfileId; profileTACT.order = orderET; profileTT.Item = profileTACT; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServiceSoapClient client = new ServiceSoapClient(); CreateCustomerProfileTransactionResponseType resp = client.CreateCustomerProfileTransaction(merchantAT, profileTT, String.Empty); code = string.Empty; if (resp.directResponse != null) { PaymentGatewayResponse paymentGatewayResponse = new PaymentGatewayResponse(resp.directResponse); transactionId = paymentGatewayResponse.TransactionId; message = paymentGatewayResponse.ResponseReasonText; code = resp.messages != null && resp.messages.Count() > 0 ? resp.messages.Select(x => x.code + " - " + x.text).Aggregate((a, b) => a + "; " + b) : string.Empty; } else { transactionId = 0; if (resp.messages.Length > 0) { message = resp.messages[0].text; } else { message = ""; } } return(resp.resultCode == MessageTypeEnum.Ok); }
public static bool CreateCustomerProfileTransactionRefund(SiteDT site, InvoiceDT invoice, TransactionDT transaction, CustomerDT customer, CreditCardDT creditCard, out long transactionId, out string message) { //This datetime is when system change. int deployYear = CastleClub.BusinessLogic.Data.GlobalParameters.DeployYear; int deployMonth = CastleClub.BusinessLogic.Data.GlobalParameters.DeployMonth; int deployDay = CastleClub.BusinessLogic.Data.GlobalParameters.DeployDay; if (invoice.BilledDate >= new DateTime(deployYear, deployMonth, deployDay)) { MerchantAuthenticationType merchantAT = new MerchantAuthenticationType(); merchantAT.name = site.AuthorizeLoginId; merchantAT.transactionKey = site.AuthorizeTransactionKey; ProfileTransactionType profileTT = new ProfileTransactionType(); ProfileTransRefundType profileTRT = new ProfileTransRefundType(); OrderExType orderET = new OrderExType(); orderET.invoiceNumber = invoice.Id.ToString(); profileTRT.amount = invoice.Amount; profileTRT.transId = transaction.AuthorizeTransactionId.ToString(); profileTRT.customerProfileId = customer.AuthorizeProfileId; profileTRT.customerProfileIdSpecified = true; profileTRT.customerPaymentProfileId = creditCard.AuthorizePaymentProfileId; profileTRT.customerPaymentProfileIdSpecified = true; profileTRT.order = orderET; profileTT.Item = profileTRT; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServiceSoapClient client = new ServiceSoapClient(); CreateCustomerProfileTransactionResponseType resp = client.CreateCustomerProfileTransaction(merchantAT, profileTT, String.Empty); if (resp.directResponse != null) { PaymentGatewayResponse paymentGatewayResponse = new PaymentGatewayResponse(resp.directResponse); transactionId = paymentGatewayResponse.TransactionId; message = paymentGatewayResponse.ResponseReasonText; } else { transactionId = 0; if (resp.messages.Length > 0) { message = resp.messages[0].text; } else { message = ""; } } return(resp.resultCode == MessageTypeEnum.Ok); } else { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; using (ServiceSoapClient client = new ServiceSoapClient()) { MerchantAuthenticationType merchant = new MerchantAuthenticationType() { name = site.AuthorizeLoginId, transactionKey = site.AuthorizeTransactionKey }; ProfileTransactionType profileTT = new ProfileTransactionType(); ProfileTransRefundType profileTRT = new ProfileTransRefundType(); profileTRT.amount = invoice.Amount; profileTRT.transId = transaction.AuthorizeTransactionId.ToString(); profileTRT.creditCardNumberMasked = "XXXX" + creditCard.LastFourDigit; profileTT.Item = profileTRT; var resp = client.CreateCustomerProfileTransaction(merchant, profileTT, string.Empty); if (resp.resultCode == MessageTypeEnum.Ok) { PaymentGatewayResponse paymentGatewayResponse = new PaymentGatewayResponse(resp.directResponse); transactionId = paymentGatewayResponse.TransactionId; message = paymentGatewayResponse.ResponseReasonText; } else { transactionId = 0; message = string.Empty; message = resp.messages != null && resp.messages.Count() > 0 ? resp.messages.Select(a => a.text).Aggregate((a, b) => a + " - " + b) : string.Empty; } return(resp.resultCode == MessageTypeEnum.Ok); } } }
public static bool CreateCustomerProfile(SiteDT site, CustomerDT customer, CreditCardDT cc, out long customerProfileId, out long customerPaymentProfileId) { // if (1 == 0) { MerchantAuthenticationType merchantAT = new MerchantAuthenticationType(); merchantAT.name = site.AuthorizeLoginId; merchantAT.transactionKey = site.AuthorizeTransactionKey; CustomerProfileType customerPT = new CustomerProfileType(); customerPT.merchantCustomerId = customer.Id.ToString(); customerPT.email = customer.Email; customerPT.paymentProfiles = new CustomerPaymentProfileType[1]; CustomerPaymentProfileType customerPPT = new CustomerPaymentProfileType(); customerPPT.customerType = CustomerTypeEnum.individual; customerPPT.customerTypeSpecified = true; customerPPT.billTo = new CustomerAddressType() { firstName = customer.FirstName, lastName = customer.LastName, address = customer.Address, city = customer.City, country = "USA", state = customer.StateId, zip = customer.ZipCode }; CreditCardType ccT = new CreditCardType(); ccT.cardNumber = cc.CardNumber; ccT.expirationDate = cc.ExpDate; ccT.cardCode = cc.CVV; PaymentType payment = new PaymentType(); payment.Item = ccT; customerPPT.payment = payment; customerPT.paymentProfiles[0] = customerPPT; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServiceSoapClient client = new ServiceSoapClient(); CreateCustomerProfileResponseType resp = client.CreateCustomerProfile(merchantAT, customerPT, ValidationModeEnum.testMode); customerProfileId = resp.customerProfileId; customerPaymentProfileId = resp.customerPaymentProfileIdList.Length == 1 ? resp.customerPaymentProfileIdList[0] : 0; if (resp.resultCode != MessageTypeEnum.Ok) { string errorValidate = resp.validationDirectResponseList != null && resp.validationDirectResponseList.Count() > 0 ? resp.validationDirectResponseList.ToList().Aggregate((a, b) => a + " || " + b) : string.Empty; string error = resp.messages != null && resp.messages.Count() > 0 ? resp.messages.ToList().Select(a => a.text).Aggregate((a, b) => a + " || " + b) : string.Empty; LoggingUtilities.Logger.LogEntry("Resp Error code:" + resp.resultCode.ToString() + ". Errors: " + error + "Error V: " + errorValidate); } return(resp.resultCode == MessageTypeEnum.Ok); /* } * * else * { * customerProfileId = 1; * customerPaymentProfileId = 1; * return true; * }*/ }
public static void ProcessInvoices() { using (CastleClubEntities entities = new CastleClubEntities()) { if (CastleClub.BusinessLogic.Data.GlobalParameters.Procces) { int maxFailCount = CastleClub.BusinessLogic.Data.GlobalParameters.FailCount; int yearMin = CastleClub.BusinessLogic.Data.GlobalParameters.YearMin; DateTime min = new DateTime(yearMin, 1, 1); List <Invoice> list = entities.Invoices.Where(i => (i.Customer.CancelledDate == null) && (i.CreatedAt >= min) && (!i.FailCount.HasValue || i.FailCount.Value < maxFailCount) && (i.StatusId == InvoiceStatus.NEW.ToString() || i.StatusId == InvoiceStatus.BILLEDFAIL.ToString())).ToList(); foreach (Invoice invoice in list) { try { SiteDT siteDT = invoice.Customer.Site.GetDT(); InvoiceDT invoiceDT = invoice.GetDT(); CustomerDT customerDT = invoice.Customer.GetDT(false); CreditCardDT creditCardDT = invoice.Customer.CreditCards.FirstOrDefault().GetDT(); Transaction transaction = new Transaction(); transaction.InvoiceId = invoiceDT.Id; transaction.CreditCardId = creditCardDT.Id; transaction.AuthorizeTransactionId = 0; transaction.TypeId = TransactionType.SALE.ToString(); transaction.StatusId = TransactionStatus.FAILED.ToString(); transaction.SubmitDate = DateTime.Now; entities.Transactions.Add(transaction); entities.SaveChanges(); long transactionId = 0; string message = ""; string code = string.Empty; bool succesfull = CIM.CreateCustomerProfileTransactionAuthCapture(siteDT, invoiceDT, customerDT, creditCardDT, out transactionId, out message, out code); if (succesfull) { invoice.Status = InvoiceStatus.BILLED; invoice.BilledDate = DateTime.Now; transaction.Status = TransactionStatus.SUCCESFULL; transaction.AuthorizeTransactionId = transactionId; invoice.Customer.Referrer.BilledTotal++; invoice.Customer.Referrer.RevenueAmount += invoice.Amount; entities.SaveChanges(); } else { invoice.FailCount = invoice.FailCount.HasValue ? invoice.FailCount.Value + 1 : 1; transaction.Message = message + code; invoice.Status = InvoiceStatus.BILLEDFAIL; entities.SaveChanges(); if (invoice.FailCount >= maxFailCount && entities.NotificationProcess.Any()) { //To do some. //Send email for notification. string smtpAddress = CastleClub.BusinessLogic.Data.GlobalParameters.Smtp; int portNumber = 587; bool enableSSL = true; string emailFrom = CastleClub.BusinessLogic.Data.GlobalParameters.EmailAccount; string password = CastleClub.BusinessLogic.Data.GlobalParameters.EmailPassword; string subject = "Error an ocurred with invoice: " + invoiceDT.Id; string body = "Error ocurred at " + maxFailCount + " time with invoice: " + invoiceDT.Id + ", customerId: " + invoice.CustomerId + ", and with credit card: " + invoice.Customer.CreditCards.FirstOrDefault().Id; using (System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage()) { mail.From = new MailAddress(emailFrom); foreach (var emailTo in entities.NotificationProcess) { mail.To.Add(emailTo.To); } mail.Subject = subject; mail.Body = body; mail.IsBodyHtml = false; using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber)) { smtp.Credentials = new NetworkCredential(emailFrom, password); smtp.EnableSsl = enableSSL; smtp.Send(mail); } } } } } catch (Exception ex) { Utils.EventViewer.Writte("CastleClubAdmin", "PaymentTask - Process", ex.ToString(), System.Diagnostics.EventLogEntryType.Error); } } } } }
public static string CreateCustomer(string data, bool sendEmail) { try { var hash = EncryptionHelper.Unpack(EncryptionHelper.Decrypt(data, cryptKey)); GCDSite site = new GCDSite(hash); GCDCustomer customer = new GCDCustomer(hash); customer.CreatedAt = DateTime.Now; customer.Success = false; if (!string.IsNullOrEmpty(site.GroupID) && !string.IsNullOrEmpty(customer.CreditCardNumber) && !string.IsNullOrEmpty(customer.Email)) { CustomerDT customerDT = new CustomerDT() { Address = customer.Address1, BadLoginCount = 0, CancelledDate = null, City = customer.City, ClearPassword = customer.Password, CreatedAt = customer.CreatedAt, Email = customer.Email, FirstName = customer.FirstName, LastName = customer.LastName, MemberId = customer.MemberID, NcId = 0, NextBillDate = DateTime.Now.AddDays(30), Phone = customer.Phone, StateId = CastleClub.BusinessLogic.Managers.LocationsManager.GetStates().FirstOrDefault(x => x.Name.ToLower() == customer.State.ToLower()).Id, Status = CustomerStatus.ACTIVE, ZipCode = customer.Zip }; //var siteDT = CastleClub.BusinessLogic.Managers.SitesManager.GetSite(customerDT.SiteId); customerDT = CastleClub.BusinessLogic.Managers.CustomersManager.NewCustomer(site.GroupID, customerDT, customer.CreditCardNumber, CreditCardHelper.GetExpDate(customer.CreditCardMonthExpired, customer.CreditCardYearExpired)); if (customerDT != null) { customer.Success = true; //if (sendEmail) /**** * if ((siteDT.SendWelcomeEmail) && (siteDT.WelcomeEmailDelay != null) && (siteDT.WelcomeEmailDelay == 0)) * //send welcome email if it hasn't a delay * { * string smtpAddress = siteDT.SmtpAddress;//CastleClub.BusinessLogic.Data.GlobalParameters.Smtp; * //var siteDT = CastleClub.BusinessLogic.Managers.SitesManager.GetSite(customerDT.SiteId); * * string emailFrom = siteDT.Email; * string passwordEmail = siteDT.PasswordEmail;//CastleClub.BusinessLogic.Data.GlobalParameters.EmailPassword; * string subject = string.Format(Properties.Resources.WelcomeSubjectEmail, siteDT.Name); * // + " " + customer.LastName * string body = string.Format(Properties.Resources.WelcomeBodyEmail, customer.FirstName, * customer.Email, customer.Password, siteDT.Name, siteDT.Name, "PartsGeek", * siteDT.Price, siteDT.PricePerQuarter, siteDT.Phone, siteDT.Email, siteDT.OfferDomain); * * Utils.Email.SendEmail(emailFrom, passwordEmail, smtpAddress, subject, body, new List<string>() { customer.Email }, true); * } * **/ } } else { customer.Messages = "Credit card and email are necessary."; } return(EncryptionHelper.Encrypt(customer.ToString(), cryptKey)); }catch (Exception e) { Utils.EventViewer.Writte("WEBSERVICE", "Create Customers", e.Message + " " + e.StackTrace, System.Diagnostics.EventLogEntryType.Error); throw e; } }