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); } }
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); } }
//public Referral(int memberid_in, string friendname_in, string friendemail_in, // string keycode_in, string pubcode_in, bool ccmember_in, string messagefrommember_in) public Referral(int cusid_in, string membername_in, string memberemail_in, string keycode_in, string pubcode_in, string friendname_in, string friendemailaddress_in, bool ccmember_in, int triallengthinmonths_in, int offerexpiresmonths) { try { this.membername = membername_in; this.datecreated = DateTime.Now; this.memberid = cusid_in; this.ccmember = ccmember_in; this.friendname = friendname_in; this.friendemail = friendemailaddress_in; this.keycode = keycode_in; this.pubcode = pubcode_in; this.dateexpires = DateTime.Now.AddMonths(offerexpiresmonths);//This is the date the offer expires not the date the subscription expires this.subscriptionlength = triallengthinmonths_in; } catch (Exception ex) { LogEntry = new tbl_AppEventLog(string.Empty, "BusinessLogic", "ObjectInitException", "Error loading Referral object", string.Format("donorid_in is '{0}'", cusid_in), ex.Message, string.Empty, "Constructor: Referral(string cusid, string membername, string memberemail, string keycode, string pubcode, string friendname, string friendemailaddress, bool ccmember, string personalmessage, int triallengthinmonths) "); LogEntry.Save(); throw new ObjectInitException(ex.Message); } }
public void LogAppEvent(string user, string app_name, string event_name, string message1, string message2, string message3, string severity, string section) { try { SupportClasses.EventLogger logger = new SupportClasses.EventLogger(); tbl_AppEventLog log_entry = new tbl_AppEventLog(user, app_name, event_name, message1, message2, message3, severity, section); log_entry.Save(); } catch(Exception ex) { throw ex; } }
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); } }
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); } }
//string optin, string fax, string altcity,string giftoptin, string giftfax, string giftaltcity private object[] CreateSubscription(string subscriptionlength, string amountpaid, string verifoneroutingid, string publicationcode, string keycode, string renewingmemberid, string salutation, string firstname, string middleinitial, string lastname, string suffix, string professionaltitle, string email, string businessname, string address1, string address2, string address3, string city, string state, string postalcode, string country, string phone, string giftflag, string renewinggiftmemberid, string giftsalutation, string giftfirstname, string giftmiddleinitial, string giftlastname, string giftsuffix, string giftprofessionaltitle, string giftemail, string giftbusinessname, string giftaddress1, string giftaddress2, string giftaddress3, string giftcity, string giftstate, string giftpostalcode, string giftcountry, string giftphone, string iscomp) { int response_code = 0; string member_id = string.Empty; #region convert string input to correct types bool is_comp = false; if (!bool.TryParse(iscomp, out is_comp)) { is_comp = false; } int i_subscriptionlength = 0; float f_amountpaid = 0.0f; bool b_optin = false; bool b_giftflag = false; bool b_giftoptin = false; if (!int.TryParse(subscriptionlength, out i_subscriptionlength)) { response_code = 401; } if (!float.TryParse(amountpaid, out f_amountpaid)) { response_code = 402; } /*if (!bool.TryParse(optin, out b_optin)) { response_code = 403; }*/ if (!string.IsNullOrEmpty(giftflag)) { if (!bool.TryParse(giftflag, out b_giftflag)) { response_code = 404; } /*if (!bool.TryParse(giftoptin, out b_giftoptin)) { response_code = 405; }*/ } #endregion if (response_code == 0) { #region set member data Member memberData = new Member(); memberData.MemberId = renewingmemberid; memberData.Salutation = salutation; memberData.FirstName = firstname; memberData.MiddleInitial = middleinitial; memberData.LastName = lastname; memberData.Suffix = suffix; memberData.ProfessionalTitle = professionaltitle; memberData.OptIn = b_optin; memberData.Email = email; memberData.Address = new Address(); memberData.Address.BusinessName = businessname; memberData.Address.Address1 = address1; memberData.Address.Address2 = address2; memberData.Address.Address3 = address3; memberData.Address.City = city; memberData.Address.State = state; memberData.Address.PostalCode = postalcode; memberData.Address.Country = country; memberData.Address.Phone = phone; //memberData.Address.Fax = fax; //memberData.Address.AltCity = altcity; Member giftData = new Member(); if (b_giftflag) { giftData.MemberId = renewinggiftmemberid; giftData.Salutation = salutation; giftData.FirstName = firstname; giftData.MiddleInitial = middleinitial; giftData.LastName = lastname; giftData.Suffix = suffix; giftData.ProfessionalTitle = professionaltitle; giftData.OptIn = b_giftoptin; giftData.Email = email; giftData.Address = new Address(); giftData.Address.BusinessName = businessname; giftData.Address.Address1 = address1; giftData.Address.Address2 = address2; giftData.Address.Address3 = address3; giftData.Address.City = city; giftData.Address.State = state; giftData.Address.PostalCode = postalcode; giftData.Address.Country = country; giftData.Address.Phone = phone; //giftData.Address.Fax = fax; //giftData.Address.AltCity = altcity; } #endregion #region set cc data CreditCard creditCardData = new CreditCard(); creditCardData.Price = f_amountpaid; creditCardData.AmountPaid = f_amountpaid; creditCardData.VerifoneRoutingId = verifoneroutingid; if(is_comp) { creditCardData.PaymentType = "F"; } #endregion SubscriptionServiceRequest request = new SubscriptionServiceRequest(memberData, giftData, creditCardData, publicationcode, keycode, b_giftflag, i_subscriptionlength); BaseResponse sub_response = SubOrderInsert.CreateSubscription(request); if (sub_response == null || sub_response.TypedResponse == null || sub_response.TypedResponse.Success == false) { string msgs = string.Empty; foreach (Message s in sub_response.Messages) { msgs += "[" + s.ToString() + "]"; } tbl_AppEventLog logmsg = new tbl_AppEventLog(); logmsg.aelAppName = "HarperSERVICE"; logmsg.aelDateCreated = DateTime.Now; logmsg.aelEvent = "406"; logmsg.aelMessage1 = "sub_response messages:" + msgs; logmsg.aelMessage2 = "typed response:" + sub_response.TypedResponse.ToString(); logmsg.aelMessage3 = "success:" + sub_response.TypedResponse.Success; logmsg.Save(); response_code = 406; } else { member_id = ((SubscriptionServiceResponse)sub_response.TypedResponse).MemberId; } } return new object[]{response_code, member_id}; }
//string optin,string fax,string altcity, private object[] ChargeCard(string memberid, string salutation, string firstname, string middleinitial, string lastname, string suffix, string professionaltitle, string email, string businessname, string address1, string address2, string address3, string city, string state, string postalcode, string country, string phone, string ccnumber, string expmonth, string expyear, string amount, string ccname, string ccaddr, string cccity, string ccstate, string cczip, string cccountry, string pubcode, string username, string password, string refreshcustomer) { int response_code = 0; string routing_id = string.Empty; string auth_code = string.Empty; #region convert string input to correct types bool b_optin = false; short s_expmonth = 0; short s_expyear = 0; float f_amount = 0.0f; bool b_refreshcustomer = false; /*if (!bool.TryParse(optin, out b_optin)) { response_code = 301; }*/ if (!short.TryParse(expmonth, out s_expmonth)) { response_code = 302; } if (!short.TryParse(expyear, out s_expyear)) { response_code = 303; } if (!float.TryParse(amount, out f_amount)) { response_code = 304; } if (!bool.TryParse(refreshcustomer, out b_refreshcustomer)) { response_code = 305; } #endregion if(response_code == 0) { #region validate input Member memberData = new Member(); memberData.MemberId = memberid; memberData.Salutation = salutation; memberData.FirstName = firstname; memberData.MiddleInitial = middleinitial; memberData.LastName = lastname; memberData.Suffix = suffix; memberData.ProfessionalTitle = professionaltitle; //memberData.OptIn = b_optin; memberData.Email = email; memberData.Address = new Address(); memberData.Address.BusinessName = businessname; memberData.Address.Address1 = address1; memberData.Address.Address2 = address2; memberData.Address.Address3 = address3; memberData.Address.City = city; memberData.Address.State = state; memberData.Address.PostalCode = postalcode; memberData.Address.Country = country; memberData.Address.Phone = phone; //memberData.Address.Fax = fax; //memberData.Address.AltCity = altcity; CreditCard ccData = new CreditCard(); ccData.CCNumber = ccnumber; ccData.CCExpMonth = s_expmonth; ccData.CCExpYear = s_expyear; ccData.AmountPaid = f_amount; ccData.CCName = ccname; ccData.CCAddress = ccaddr; ccData.CCCity = cccity; ccData.CCState = ccstate; ccData.CCPostalCode = cczip; ccData.CCCountry = cccountry; #endregion CreditCardServiceRequest request = new CreditCardServiceRequest(ccData, memberData, pubcode, username, password, b_refreshcustomer); BaseResponse cc_response = CreditCardProcessing.GetResponse(request); if (cc_response == null || cc_response.TypedResponse == null || cc_response.TypedResponse.Success == false) { string msgs = string.Empty; foreach (Message s in cc_response.Messages) { msgs += "[" + s.ToString() + "]"; } tbl_AppEventLog logmsg = new tbl_AppEventLog(); logmsg.aelAppName = "HarperSERVICE"; logmsg.aelDateCreated = DateTime.Now; logmsg.aelEvent = "306"; logmsg.aelMessage1 = "cc_response messages:" + msgs; logmsg.aelMessage2 = "typed response:" + cc_response.TypedResponse.ToString(); logmsg.aelMessage3 = "success:" + cc_response.TypedResponse.Success; logmsg.Save(); response_code = 306; } else { routing_id = ((CreditCardServiceResponse)cc_response.TypedResponse).VerifoneRoutingId; auth_code = ((CreditCardServiceResponse)cc_response.TypedResponse).AuthorizationCode; } } return new object[]{response_code, routing_id, auth_code}; }