예제 #1
0
 public static List<string> GetRegions(string countryname)
 {
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         List<string> response = new List<string>();
         if (countryname.ToUpper() == "U.S.A.")
         {
             var states = (from a in context.States
                           where a.staIsActive == true
                           select a.staName);
             foreach (var state in states)
             {
                 response.Add(state);
             }
         }
         else
         {
             var regions = (from a in context.Nodes
                            where a.nodName == countryname
                            join b in context.Relations
                            on a.nodID equals b.nodParentID
                            join c in context.Nodes
                            on b.nodChildID equals c.nodID
                            select c.nodName);
             foreach (var region in regions)
             {
                 response.Add(region);
             }
         }
         return response;
     }
 }
예제 #2
0
 public bool SendEmail(string username, string password, string subject, string fromaddress, string toaddress, string cc, string bcc, string body, bool isbodyhtml, string smtp)
 {
     if (username == ConfigurationManager.AppSettings["mailserviceuser"]
         && password == ConfigurationManager.AppSettings["mailservicepwd"])
     {
  
         HarperLINQ.SimpleMail mail = new SimpleMail();
         try
         {
             mail.bccemail = bcc;
             mail.body = body;
             mail.ccemail = cc;
             mail.datecreated = DateTime.Now;
             mail.fromemail = fromaddress;
             mail.isHtml = isbodyhtml;
             mail.ishtml = isbodyhtml;
             mail.smtpAddress = smtp;
             mail.subject = subject;
             mail.toemail = toaddress;
             using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
             {
                 context.SimpleMails.InsertOnSubmit(mail);
                 context.SubmitChanges();
             }
             return true;
         }
         catch
         {
             return false;
         }
     }
     else { return false; }
 }
예제 #3
0
 public ReferralOffer(string keycode_in, string pubcode_in)
 {
     try
     {
         using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
         {
             ReferralOffer offer = (from a in context.ReferralOffers
                                  where a.keycode == keycode_in
                                  && a.pubcode == pubcode_in
                                  && a.isactive == true
                                  select a).SingleOrDefault();
             if (offer != null)
             {
                 SetData(offer);
             }
         }
     }
     catch (Exception ex)
     {
         LogEntry = new tbl_AppEventLog(string.Empty, 
             "BusinessLogic", 
             "DataLoadException",
             "Error loading tbl_ReferralOffer object", 
             string.Format("keycode_in is '{0}', pubcode_in is '{1}'", new object[] {keycode_in, pubcode_in}),
             ex.Message, 
             string.Empty, 
             "Constructor: tbl_ReferralOffer(string keycode_in, string pubcode_in) ");
         LogEntry.Save();
         throw new DataLoadException(ex.Message);
     }
 }
예제 #4
0
 public tbl_Customer(string username_or_emailaddress, bool isusername)
 {
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         tbl_Customer customer;
         if (isusername)
         {
             this.cusUserName = username_or_emailaddress;
             customer = (from a in context.tbl_Customers
                         where a.cusUserName == this.cusUserName
                         select a).SingleOrDefault();
         }
         else
         {
             this.cusEmail = username_or_emailaddress;
             customer = (from a in context.tbl_Customers
                         where a.cusEmail == this.cusEmail
                         select a).SingleOrDefault();
         }
         if (customer != null)
         {
             SetData(customer);
         } 
         var sfgid = (from a in context.SFG_CustomerNumbers
                        where a.cusID == this.cusID
                        select a.SFGCustNum).SingleOrDefault();
         if (sfgid != null)
         {
             string s = sfgid.ToString();
             this.SfgId = long.Parse(s);
         }
     }       
 }
예제 #5
0
 public static SFG_ProdCode GetFromIntCode(string intcode)
 {
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         return (from a in context.SFG_ProdCodes where a.IntCode == intcode select a).Single();
     }
 }
예제 #6
0
 public void Save()
 {
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         context.SimpleMails.InsertOnSubmit(this);
         context.SubmitChanges();
     }
 }
예제 #7
0
 public ISO3166(object identifier, IdentifierType identifiertype)
 {           
     try
     {
         using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
         {
             ISO3166 iso = null;
             switch (identifiertype)
             {
                 case IdentifierType.Id:
                     iso = (from a in context.ISO3166s where a.Id == (int)identifier && a.ParentId == null select a).SingleOrDefault();
                     break;
                 case IdentifierType.Country_Code_Alpha2:
                     iso = (from a in context.ISO3166s where a.Alpha2 == (string)identifier && a.ParentId == null select a).SingleOrDefault();
                     break;
                 case IdentifierType.Country_Code_Alpha3:
                     iso = (from a in context.ISO3166s where a.Alpha3 == (string)identifier && a.ParentId == null select a).SingleOrDefault();
                     break;
                 case IdentifierType.Country_Code_Numeric:
                     iso = (from a in context.ISO3166s where a.Numeric == (int)identifier && a.ParentId == null select a).SingleOrDefault();
                     break;
                 case IdentifierType.Level1_Subdivision_Code:
                     iso = (from a in context.ISO3166s where a.Level1_Subdivision == (string)identifier select a).SingleOrDefault();
                     break;
                 case IdentifierType.Level2_Subdivision_Code:
                     iso = (from a in context.ISO3166s where a.Level2_Subdivision == (string)identifier select a).SingleOrDefault();
                     break;
                 case IdentifierType.Name:
                     iso = (from a in context.ISO3166s where a.Name == (string)identifier select a).SingleOrDefault();
                     break;
                 case IdentifierType.DisplayName:
                     iso = (from a in context.ISO3166s where a.DisplayName == (string)identifier select a).SingleOrDefault();
                     break;
             }
             if (iso == null)
             {
                 throw new ObjectNotFoundException(identifier, identifiertype);
             }
             else
             {
                 this.Id = iso.Id;
                 this.Alpha2 = iso.Alpha2;
                 this.Alpha3 = iso.Alpha3;
                 this.Numeric = iso.Numeric;
                 this.Level1_Subdivision = iso.Level1_Subdivision;
                 this.Level2_Subdivision = iso.Level2_Subdivision;
                 this.Name = iso.Name;
                 this.ParentId = iso.ParentId;
                 this.SFGCode = iso.SFGCode;
                 this.DisplayName = iso.DisplayName;
             }
         }
     }
     catch
     {
         throw new IdentifierNotUniqueException(identifier, identifiertype);
     }
 }
예제 #8
0
 public static List<string> GetEventNames()
 {
     List<string> eventnames = new List<string>();
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         eventnames = (from a in context.tbl_AppEventLogs select a.aelEvent).Distinct<string>().ToList<string>();
     }
     eventnames.Sort();
     return eventnames;
 }
예제 #9
0
 public static List<string> GetSeverities()
 {
     List<string> severities = new List<string>();
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         severities = (from a in context.tbl_AppEventLogs select a.aelSeverity).Distinct<string>().ToList<string>();
     }
     severities.Sort();
     return severities;
 }
예제 #10
0
 public static Suffix GetSuffixBySFGCode(string sfgcode)
 {
     Suffix suffix = new Suffix();
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         suffix = (from a in context.Suffixes
                     where a.sfgcode == sfgcode
                     select a).SingleOrDefault();
     }
     return suffix;
 }
예제 #11
0
 public static List<Suffix> GetSuffixes() 
 {
     List<Suffix> suffixes = new List<Suffix>();
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         suffixes = (from a in context.Suffixes
                     where a.displayname != null
                     select a).ToList<Suffix>();
     }
     return suffixes;
 }
예제 #12
0
 public static List<Prefix> GetSFGPrefixes()
 {
     List<Prefix> prefixes = new List<Prefix>();
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         prefixes = (from a in context.Prefixes
                     where a.displayname != null
                     && a.sfgcode != null
                     select a).ToList<Prefix>();
     }
     return prefixes;
 }
예제 #13
0
 public static List<tbl_NetMembership> GetNetMemberships(int cusid)
 {
     List<tbl_NetMembership> subs = new List<tbl_NetMembership>();
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         subs = (from a in context.tbl_NetMemberships
                 where a.cusID == cusid
                 orderby a.nmbDateStart descending
                 select a).ToList();
     }
     return subs;
 }
예제 #14
0
 public static List<Country> GetCountries()
 {
     List<Country> response = new List<Country>();
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         var countries = (from a in context.Countries
                          select a);
         foreach (var country in countries)
         {
             response.Add(country);
         }
     }
     return response;
 }
예제 #15
0
 public tbl_AddressCustomer(int id_in)
 {
     tbl_AddressCustomer address;
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         address = (from a in context.tbl_AddressCustomers
                                        where a.addID == id_in
                                        select a).SingleOrDefault();
     }
     if (address != null)
     {
         SetData(address);
     }
 }
예제 #16
0
 public void Save()
 {
     try
     {
         using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
         {
             context.ReferralOffers.InsertOnSubmit(this);
             context.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         throw new ObjectSaveException(ex.Message);
     }
 }
예제 #17
0
 public tbl_MembershipType(string mtyCode)
 {
     tbl_MembershipType membershiptype = new tbl_MembershipType();
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         membershiptype = (from a in context.tbl_MembershipTypes
                 where a.mtyCode == mtyCode
                 select a).SingleOrDefault();
     }
     if (membershiptype != null)
     {
         this.mtyCode = membershiptype.mtyCode;
         this.mtyGUID = membershiptype.mtyGUID;
         this.mtyName = membershiptype.mtyName;
     }
 }
예제 #18
0
 public static List<Referral> GetNeedsReminderList()
 {
     List<Referral> referrals = new List<Referral>();
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         referrals = (from a in context.Referrals
                      where a.friendid == null
                      && a.reminderemailid == null
                      && a.dateredeemed == null
                      && a.testrecord == false
                      && a.datecreated <= DateTime.Now.AddDays(-10) //this is wrong... seems it will email same folks over and over
                      && a.dateexpires >= DateTime.Now.AddDays(7)
                      orderby a.id
                      select a).ToList<Referral>();
     }
     return referrals;
 }
예제 #19
0
 public tbl_Customer(long cusid_or_sfgid, bool issfgid)
 {
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         if (issfgid)
         {
             this.SfgId = cusid_or_sfgid;
             this.cusID = (from a in context.SFG_CustomerNumbers
                           where a.SFGCustNum == this.SfgId.ToString()
                           select a.cusID).SingleOrDefault();
         }
         else
         {
             this.cusID = (int)cusid_or_sfgid;
         }
         tbl_Customer customer = (from a in context.tbl_Customers
                                  where a.cusID == this.cusID
                                  select a).SingleOrDefault();
         if (customer != null)
         {
             SetData(customer);
         }
         var sfgid = (from a in context.SFG_CustomerNumbers
                      where a.cusID == this.cusID
                      select a.SFGCustNum).SingleOrDefault();
         if (sfgid != null)
         {
             string s = sfgid.ToString();
             this.SfgId = long.Parse(s);
         }
         try
         {
             var membership = (from a in context.tbl_NetMemberships
                               where a.cusID == this.cusID
                               select a).Take(1).ToArray<tbl_NetMembership>()[0];
             if (membership != null)
             {
                 this.MembershipType = membership.mtyCode;
                 this.MembershipExpires = membership.nmbDateEnd;
             }
         }
         catch { }
     }
 }
예제 #20
0
 public void Save()
 {
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         if (this.addID > 0)
         {
             tbl_AddressCustomer address = (from a in context.tbl_AddressCustomers
                                      where a.addID == this.addID
                                      select a).SingleOrDefault();
             GetData(address);
             context.SubmitChanges();
         }
         else
         {
             context.tbl_AddressCustomers.InsertOnSubmit(this);
             context.SubmitChanges();
         }
     }
 }
예제 #21
0
 public GDSData(int id_in)
 {
     try
     {
         using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
         {
             GDSData gdsdata = (from a in context.GDSDatas
                                where a.ID == id_in
                                select a).SingleOrDefault();
             SetData(gdsdata);
         }
     }
     catch (Exception ex)
     {
         LogEntry = new tbl_AppEventLog(string.Empty, "Sideline GDS Report", "DataLoadException",
             "Error loading tbl_GDSData object", string.Format("id_in is '{0}'", id_in),
             ex.Message, string.Empty, "Constructor: GDSData(int id_in)");
         LogEntry.Save();
         throw new DataLoadException(ex.Message);
     }
 }
예제 #22
0
 public void Save()
 {
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         tbl_NetMembership netmembership = (from a in context.tbl_NetMemberships
                                            where a.cusID == this.cusID
                                            && a.mtyCode == this.mtyCode
                                            select a).SingleOrDefault();
         if (netmembership == null)
         {
             netmembership = new tbl_NetMembership();
             context.tbl_NetMemberships.InsertOnSubmit(netmembership);
         }
         netmembership.cusID = this.cusID;
         netmembership.mtyCode = this.mtyCode;
         netmembership.nmbDateCreated = this.nmbDateCreated;
         netmembership.nmbDateEnd = this.nmbDateEnd;
         netmembership.nmbDateStart = this.nmbDateStart;
         netmembership.nmbRenewalCode = this.nmbRenewalCode;
         context.SubmitChanges();
     }
 }
예제 #23
0
 public Referral(string email_in)
 {
     try
     {
         using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
         {
             Referral referral = (from a in context.Referrals
                                  where a.friendemail == email_in
                                  select a).SingleOrDefault();
             if (referral != null)
             {
                 SetData(referral);
             }
         }
     }
     catch (Exception ex)
     {
         LogEntry = new tbl_AppEventLog(string.Empty, "BusinessLogic", "DataLoadException",
             "Error loading tbl_Referral object", string.Format("email_in is '{0}'", email_in),
             ex.Message, string.Empty, "Constructor: tbl_Referral(string email_in) ");
         LogEntry.Save();
         throw new DataLoadException(ex.Message);
     }
 }
예제 #24
0
 //public List<ISO3166> GetAll() { }
 //public List<ISO3166> GetAllOfType(GeographicType geographictype) { }
 public static List<ISO3166> GetRegions(string ParentAlpha2) 
 {
     List<ISO3166> response = new List<ISO3166>(); 
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         response = (from a in context.ISO3166s
                     join b in context.ISO3166s
                     on a.ParentId equals b.Id
                     where b.Alpha2 == ParentAlpha2
                     orderby a.DisplayWeight, a.DisplayName, a.Name
                     select a).ToList();
     }
     return response;
 }    
예제 #25
0
 public static List<ISO3166> GetSFGSafeCountries()
 {
     List<ISO3166> response = new List<ISO3166>();
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         response = (from a in context.ISO3166s
                     where a.ParentId == null
                     && a.SFGCode != null
                     orderby a.DisplayName, a.Name
                     select a).ToList();
     }
     return response;
 }
예제 #26
0
        public BaseResponse RedeemReferralSubscription(int referralid, string firstname, string lastname,
            string emailaddress, string countrycode, string address1, string address2,
            string city, string region, string postal, bool optin, string username, string password)
        {
            List<Message> errors = new List<Message>();
            string errortext = string.Empty;
            try
            {
                HarperLINQ.Referral referral;

                #region input validation
                using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
                {
                    referral = context.Referrals.SingleOrDefault(r => r.id == referralid);
                }
                if (referral == null)
                {
                    errortext = string.Format(BusinessLogicStrings.invalidReferralIdError, referralid);
                    errors.Add(new Message(MessageSources.AndrewHarper, 0, "RedeemReferralException", errortext, "", "", null));
                }
                else if (referral.dateredeemed != null || referral.friendid > 0)
                {
                    errortext = string.Format(BusinessLogicStrings.RedeemedReferralError, referralid);
                    errors.Add(new Message(MessageSources.AndrewHarper, 0, "RedeemReferralException", errortext, "", "", null));
                }
                else if (referral.dateexpires <= DateTime.Now)
                {
                    errortext = string.Format(BusinessLogicStrings.expiredReferralError, referralid);
                    errors.Add(new Message(MessageSources.AndrewHarper, 0, "RedeemReferralException", errortext, "", "", null));
                }
                #endregion
                
                else
                {
                    #region sub order insert
                    Member giftData = new Member();
                    giftData.FirstName = firstname;
                    giftData.LastName = lastname;
                    giftData.OptIn = optin;
                    giftData.Email = emailaddress;

                    giftData.Address = new Address();
                    giftData.Address.Address1 = address1;
                    giftData.Address.Address2 = address2;
                    giftData.Address.City = city;
                    giftData.Address.State = region;
                    giftData.Address.PostalCode = postal;
                    giftData.Address.Country = countrycode;

                    SubscriptionServiceRequest request = new SubscriptionServiceRequest(referral, giftData);
                    baseResponse = SubOrderInsert.RedeemReferralSubscription(request);
                    foreach (Message err in baseResponse.Messages)
                    {
                        errors.Add(err);
                    }
                    #endregion

                    MembershipLogic memberlogic = new MembershipLogic();
                    BaseResponse memberResponse = null;
                    if (errors.Count <= 0)
                    {
                        memberResponse = memberlogic.GetMemberByUserName(emailaddress);
                    }

                    if (!(errors.Count > 0 
                        || memberResponse == null
                        || memberResponse.TypedResponse == null
                        || memberResponse.TypedResponse.Success == false))
                    {
                        using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
                        {
                            GetMemberResponse getMemberResponse = memberResponse.TypedResponse as GetMemberResponse;
                            if (getMemberResponse.MemberFound && getMemberResponse.MemberData != null)
                            {
                                string newMemberId = getMemberResponse.MemberData.MemberId;

                                #region create the user at AH
                                object[] create_response = tbl_Customer.CreateCustomer(address1, address2, "", city, region, 
                                    countrycode, postal, "Z1", password, "PERSONAL", "", 
                                    firstname, "", lastname, "", emailaddress, username, newMemberId, referral.pubcode, DateTime.Now.AddMonths(referral.subscriptionlength).ToShortDateString(), DateTime.Now.ToShortDateString(), username, "");
                                tbl_Customer customer = (tbl_Customer)create_response[1];
                                #endregion

                                #region referral data at AH
                                referral = context.Referrals.SingleOrDefault(r => r.id == referralid);
                                referral.dateredeemed = DateTime.Now;
                                referral.friendid = customer.cusID;
                                context.SubmitChanges();
                                #endregion

                                #region send email
                                Mailer mailer = new Mailer();

                                mailer.SendEmail(
                                    ConfigurationManager.AppSettings["mailserviceuser"], 
                                    ConfigurationManager.AppSettings["mailservicepwd"],
                                    "Welcome to the Andrew Harper Community!", 
                                    ConfigurationManager.AppSettings["referemailfrom"],
                                    referral.friendemail,
                                    string.Empty, 
                                    string.Empty,
                                    referral.GetReferralUserCreatedEmailBody(), 
                                    true, 
                                    ConfigurationManager.AppSettings["smtpserver"]);
                                #endregion
                            }
                        }
                    }
                    else
                    {
                        errortext = string.Format(BusinessLogicStrings.RetrieveMemeberError, new object[] { referralid, emailaddress });
                        errors.Add(new Message(MessageSources.AndrewHarper, 0, "RedeemReferralException", errortext, "", "", null));
                    }
                }

                baseResponse.TypedResponse = new AHResponse();
                if (errors.Count == 0)
                {
                    baseResponse.TypedResponse.Success = true;
                }
                else
                {
                    baseResponse.TypedResponse.Success = false;
                }
            }
            
            catch (Exception ex)
            {
                baseResponse.TypedResponse.Success = false;
                errortext = string.Format(BusinessLogicStrings.UnknownReferralError, ex.Message);
                errors.Add(new Message(MessageSources.AndrewHarper, 0, "RedeemReferralException", errortext, "", "", null));
            }
            foreach (Message error in errors)
            {
                if (baseResponse == null)
                {
                    baseResponse = new BaseResponse();
                }
                baseResponse.Messages.Add(error);

                StringBuilder error_text = new StringBuilder();
                error_text.AppendLine("REFERRAL ERROR LOGGED");
                error_text.AppendLine(string.Format("REFERRALID {0}", referralid));
                baseResponse.Messages.Add(error);
                error_text.AppendLine(string.Format("ERROR: ", new object[] { }));
                EventLogger.LogError("SubscriptionLogic.RedeemReferralSubscription", error_text.ToString(), true);
            }
            return baseResponse;
        }        
 public void Save()
 {
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         tbl_DrupalCartRequest cart = (from a in context.tbl_DrupalCartRequests
                                            where a.id == this.id
                                            select a).SingleOrDefault();
         if (cart == null)
         {
             cart = new tbl_DrupalCartRequest();
             context.tbl_DrupalCartRequests.InsertOnSubmit(cart);
         }
         cart.username = this.username;
         cart.salutation = this.salutation;
         cart.firstname = this.firstname;
         cart.middleinitial = this.middleinitial;
         cart.lastname = this.lastname;
         cart.suffix = this.suffix;
         cart.protitle = this.protitle;
         cart.email = this.email;
         cart.optin = this.optin;
         cart.business = this.business;
         cart.add1 = this.add1;
         cart.add2 = this.add2;
         cart.add3 = this.add3;
         cart.city = this.city;
         cart.state = this.state;
         cart.zip = this.zip;
         cart.country = this.country;
         cart.phone = this.phone;
         cart.fax = this.fax;
         cart.altcity = this.altcity;
         cart.ccnum = this.ccnum;
         cart.ccmonth = this.ccmonth;
         cart.ccyear = this.ccyear;
         cart.amtpaid = this.amtpaid;
         cart.ccname = this.ccname;
         cart.ccadd = this.ccadd;
         cart.cccity = this.cccity;
         cart.ccstate = this.ccstate;
         cart.cczip = this.cczip;
         cart.pubcode = this.pubcode;
         cart.keycode = this.keycode;
         cart.sublen = this.sublen;
         cart.source = this.source;
         cart.customertype = this.customertype;
         cart.expiredate = this.expiredate;
         cart.startdate = this.startdate;
         cart.newsletters = this.newsletters;
         cart.errors = this.errors;
         cart.responsecode = this.responsecode;
         cart.mobilephone = this.mobilephone;
         cart.secondemail = this.secondemail;
         cart.methodofpayment = this.methodofpayment;
         cart.cccountry = this.cccountry;
         cart.ccaddress2 = this.ccaddress2;
         cart.screenname = this.screenname;
         cart.newmemberid = this.newmemberid;
         context.SubmitChanges();
     }
 }
예제 #28
0
 public static List<Referral> GetNonRedeemedList()
 {
     List<Referral> referrals = new List<Referral>();
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         referrals = (from a in context.Referrals
                      where a.friendid == null
                      && a.testrecord == false
                      orderby a.id
                      select a).ToList<Referral>();
     }
     return referrals;
 }
예제 #29
0
 public void Save()
 {
     try
     {
         using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
         {
             if (this.id > 0)
             {
                 Referral referral = (from a in context.Referrals
                                          where a.id == this.id
                                          select a).SingleOrDefault();
                 GetData(referral);
             }
             else
             {
                 context.Referrals.InsertOnSubmit(this);
             }
             context.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         throw new ObjectSaveException(ex.Message);
     }
 }
예제 #30
0
        public string GetReferralUserCreatedEmailBody()
        {
            string sfg_number = string.Empty;
            if (this.friendid == null
                || this.friendid <= 0
                || string.IsNullOrEmpty(this.friendemail))
            {
                throw new Exception(string.Format("Cannot get \"Referral User Created\" email, data is invalid for referral id {0}.", this.id));
            }

            #region get sfg number
            using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
            {
                try
                {
                    sfg_number = (from a in context.SFG_CustomerNumbers
                              where a.cusID == this.friendid
                              select a.SFGCustNum).Single();
                }
                catch
                {
                    throw new Exception(string.Format("Cannot get \"Referral User Created\" email, no SFG number available for referral id {0}.", this.id));
                }
            }
            #endregion

            #region email html
            string body = @"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN""
    ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
<html xmlns=""http://www.w3.org/1999/xhtml"">
<head>
<base target=""_blank"" />
<meta http-equiv=""Content-Type"" content=""text/html; charset=UTF-8"" />
<title>Welcome to the Andrew Harper Community!</title>
</head>
<body style=""font-family: Verdana,Arial,Helvetica,sans-serif; line-height: 1.5; background-color:#EEEEEE"" >
<table cellspacing=""0"" border=""0"" align=""center"" cellpadding=""0"" width=""630"">
  <tr>
    <td align=""center"" style=""color:#000000; font-family:Verdana, sans-serif; font-size: 7pt; line-height: 150%; padding-bottom:5px;""><strong>Andrew Harper Invitation</strong><br />
      Please add <a href=""mailto:[email protected]"" style=""text-decoration: none; color: #36c;"">[email protected]</a> to your address book to ensure that our emails reach your inbox. </td>
  </tr>
</table>
<table width=""630"" align=""center"" cellpadding=""0"" cellspacing=""0"" style=""border: 3px solid #EEEEEE;"" bgcolor=""#ffffff"">
  <tr>
    <td><table cellspacing=""0"" cellpadding=""0"" width=""100%"">
        <tr valign=""top"" align=""center"">
          <td style=""padding-top:10px;""><a href=""http://www.andrewharper.com/""><img src=""http://www.andrewharper.com/ImageStore/Images/referral/ah_logo_redeem.jpg""
                            alt=""Membership Invitation from Your Friend"" style=""border:none;""/></a></td>
        </tr>
      </table></td>
  </tr>
  <tr align=""center"">
    <td valign=""top"" style=""padding-bottom: 25px;""><img alt=""Log in now and start traveling!"" src=""http://www.andrewharper.com/ImageStore/Images/referral/RedemptionEmail_header.jpg""
                            border=""0""  /></td>
  </tr>
  <tr>
    <td><table style=""font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12pt; line-height: 1.5;"">
        <tr>
          <td width=""30px""><img src=""http://www.andrewharper.com/ImageStore/Images/referral/clear.gif"" />			        </td>
          <td valign=""top""><p>Dear [friendname],</p>
            <p>Welcome to the Andrew Harper Community! <b>Your membership number is [friendmemberid].</b></p>
            <p> We look forward to providing you with access to Andrew Harper's legendary travel
              advice month after month. To take advantage of everything your membership had to
              offer, be sure to log in at <a href=""https://www.andrewharper.com/user"" style=""text-decoration:underline; color: #3366CC;"">AndrewHarper.com/user</a> to: </p>
            
            <ul style=""margin-top: 10px; margin-bottom: 10px; list-style-type: disc;"">
              <li><a href=""http://www.andrewharper.com/advanced-search"" style=""text-decoration:underline; color: #3366CC;"">Search</a> Mr. Harper's reviews of more than 1,000 properties worldwide</li>
              <li><a href=""http://www.andrewharper.com/hideaway-report-archive"" style=""text-decoration:underline; color: #3366CC;"">Explore</a> the expanded, digital
                version of the <i>Hideaway Report</i></li>
              <li>Book hotels online at your convenience</li>
              <li><a href=""http://www.andrewharper.com/specialoffers"" style=""text-decoration:underline; color: #3366CC;"">Find</a> exclusive members-only special
                offers at incredible properties</li>
              <li ><a href=""mailto:[email protected]"" style=""text-decoration:underline; color: #3366CC;"">Contact</a> our in-house travel agency
                for customized itineraries and complimentary assistance in planning your next trip</li>
            </ul>
            <p>Thank you again for your order. We look forward to bringing you the world!</p>
            <hr />
            <p style=""color: #e34609; margin: 0px; padding: 0px; font-weight: bold;"">Questions?</p>
            <b>View our <a href=""http://www.andrewharper.com/faq"" style=""text-decoration:underline; color: #3366CC;"">Frequently Asked Questions</a> or<br />
            contact Andrew Harper Member Services.</b><br />
            <div>
              <div style=""float: left; width: 100px; text-transform: uppercase;""> Email </div>
              <a href=""mailto:[email protected]"" style=""text-decoration:underline; color: #3366CC;"">[email protected]</a><br />
              <div style=""float: left; width: 100px; text-transform: uppercase;""> Phone </div>
              (866) 831-4314 USA, +1 (512) 904-7342 International <br />
              <div style=""float: left; width: 100px; text-transform: uppercase;""> Hours </div>
              Monday-Friday, 8 a.m.-6 p.m. (CST) </div></td>
          <td width=""30px""><img src=""http://www.andrewharper.com/ImageStore/Images/referral/clear.gif"" />			        </td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align=""center"" style=""font-size: 7pt; line-height: 150%; padding: 0px 0px 0px 0px; color:#000000; font-family: Verdana, sans-serif;""><img src=""http://www.andrewharper.com/ImageStore/Images/enews/2011/module-divider-up.png"" width=""600"" height=""70"" alt="""" class=""block"" /></td>
  </tr>
  <tr>
    <td align=""center"" style=""font-size: 7pt; line-height: 150%; padding: 0px 0px 15px 0px; color:#000000; font-family: Verdana, sans-serif;""><a href=""http://www.andrewharper.com""><img src=""http://www.andrewharper.com/ImageStore/Images/icons/harper_icon.gif"" alt=""Andrew Harper"" width=""35"" height=""34"" border=""0"" style=""border:medium none"" /></a>&nbsp; <a href=""http://www.facebook.com/pages/Andrew-Harper/70674486854?sid=7bb23ae8292668ee9c3ba769e85d4c4c&amp;ref=search"" target=""_blank""><img src=""http://www.andrewharper.com/ImageStore/Images/icons/icon_facebook.gif"" alt=""Andrew Harper Facebook"" width=""35"" height=""34"" border=""0"" style=""border:medium none"" /></a>&nbsp; <a href=""http://twitter.com/HarperTravel"" target=""_blank""><img src=""http://www.andrewharper.com/ImageStore/Images/icons/icon_twitter.gif"" alt=""Andrew Harper Twitter"" width=""35"" height=""34"" border=""0"" style=""border:medium none"" /></a>&nbsp; <a href=""http://www.thingsyoushouldknowblog.com/?feed=rss2"" target=""_blank""><img src=""http://www.andrewharper.com/ImageStore/Images/icons/icon_rss_blog.gif"" alt=""view the blog"" width=""35"" height=""34"" border=""0"" style=""border:none"" /></a>&nbsp;</td>
  </tr>
</table>
<table cellspacing=""0"" border=""0"" align=""center"" style=""padding-botom:0px"" cellpadding=""0"" width=""630"">
  <tr>
    <td align=""center"" style=""font-size: 7pt; line-height: 150%; padding: 0px 0px 28px 0px; color:#000000; font-family: Verdana, sans-serif;"">&nbsp;<br />
      &copy; Andrew Harper LLC. | (800) 375-4685 or (630) 734-4610 | 1601 Rio Grande, Suite 410, Austin, TX 78701 <br/>
      View our <a href=""http://www.andrewharper.com/privacy-policy"" target=""_blank"" style=""color: #36c;"">Privacy Statement</a> | <a href=""http://www.andrewharper.com/contact-us"" target=""_blank"" style=""color: #36c;"">Contact Us</a> | <a href=""http://www.andrewharper.com/terms-conditions"" target=""_blank"" style=""color: #36c;"">Terms &amp; Conditions</a></td>
  </tr>
</table>
</body>
</html>
";
            #endregion

            return body.Replace("[friendname]", this.friendname)
                .Replace("[friendmemberid]", sfg_number);
        }