Ejemplo n.º 1
0
 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();
     }
 }
 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();
     }
 }
Ejemplo n.º 3
0
        public ResponseObject SubscribeNewUser(
            string salutation, 
            string firstname, 
            string middleinitial, 
            string lastname, 
            string suffix,
            string professionaltitle,
            string email,
            //string optin, //not sure if we will need this since we are accepting an array of newsletters now
            string businessname, 
            string address1, 
            string address2, 
            string address3, 
            string city, 
            string state, 
            string postalcode, 
            string country, 
            string phone, 
            string ccnum, 
            string ccexpmonth, 
            string ccexpyear, 
            string amountpaid, 
            string ccname, 
            string ccaddress, 
            string cccity, 
            string ccstate, 
            string ccpostalcode, 
            string pubcode, 
            string username, 
            string pwd, 
            string keycode, 
            string subscriptionlength, 
            string source, 
            string customertype, 
            string expiredate, 
            string startdate,
            string newsletters,
            string mobilephone, 
            string secondemail, 
            string methodofpayment, 
            string cccountry, 
            string ccaddress2,
            string screenname,
            string iscomp)
        {
            bool is_comp = false;
            if (!bool.TryParse(iscomp, out is_comp))
            {
                is_comp = false;
            }

            #region store all request data
            HarperLINQ.tbl_DrupalCartRequest cart = new tbl_DrupalCartRequest();
            cart.salutation = salutation;
            cart.firstname = firstname;
            cart.middleinitial = middleinitial;
            cart.lastname = lastname;
            cart.suffix = suffix;
            cart.protitle = professionaltitle;
            cart.email = email;
            //cart.optin = optin;
            cart.business = businessname;
            cart.add1 = address1;
            cart.add2 = address2;
            cart.add3 = address3;
            cart.city = city;
            cart.state = state;
            cart.zip = postalcode;
            cart.country = country;
            cart.phone = phone;
            //cart.fax = fax;
            //cart.altcity = altcity;
            if (!is_comp)
            {
                cart.ccnum = Cryptography.Encrypt256(ccnum);
                cart.ccmonth = ccexpmonth;
                cart.ccyear = ccexpyear;
                cart.amtpaid = amountpaid;
                cart.ccname = ccname;
                cart.ccadd = ccaddress;
                cart.cccity = cccity;
                cart.ccstate = ccstate;
                cart.cczip = ccpostalcode;
                cart.methodofpayment = methodofpayment;
                cart.cccountry = cccountry;
                cart.ccaddress2 = ccaddress2;
            }
            cart.pubcode = pubcode;
            cart.keycode = keycode;
            cart.username = username;
            cart.pwd = pwd;
            cart.sublen = subscriptionlength;
            cart.source = source;
            cart.customertype = customertype;
            cart.expiredate = expiredate;
            cart.startdate = startdate;
            cart.newsletters = newsletters;
            cart.mobilephone = mobilephone;
            cart.secondemail = secondemail;
            cart.screenname = screenname;
            cart.Save();
            #endregion

            ResponseObject response = new ResponseObject();
            response.ResponseCode = 0;

            try
            {
                #region check user name availability
                switch (tbl_Customer.CheckUserName(username))
                {
                    case 0:
                        response.ResponseCode = 0;
                        break;
                    case 1:
                        response.ResponseCode = (int)CustomerResponseCode.DUPLICATE_USER_NAME;
                        break;
                    case 2:
                        response.ResponseCode = (int)CustomerResponseCode.DUPLICATE_EMAIL_ADDRESS;
                        break;
                    case 3:
                        response.ResponseCode = (int)CustomerResponseCode.DUPLICATE_USER_NAME;
                        break;
                }
                #endregion
                
                if (response.ResponseCode == 0)
                {
                    object[] cc_response = null;
                    if(!is_comp)
                    {
                        #region charge credit card
                        cc_response = ChargeCard(null, salutation, firstname, middleinitial, lastname, suffix, professionaltitle, email, businessname, address1, address2, address3, city, state, postalcode, country, phone, ccnum, ccexpmonth, ccexpyear, amountpaid, ccname, ccaddress, cccity, ccstate, ccpostalcode, cccountry, pubcode, username, pwd, "false");
                        response.ResponseCode = (int)cc_response[0];
                        #endregion
                    }


                    if (response.ResponseCode == 0)
                    {
                        #region create subscription at SFG
                        string routingid = string.Empty;
                        string authcode = string.Empty;
                        if (!is_comp)
                        {
                            routingid = (string)cc_response[1];
                            authcode = (string)cc_response[2];
                        }
                        // optin, fax, altcity, 
                        object[] sub_response = CreateSubscription(subscriptionlength, amountpaid, routingid, 
                            pubcode, keycode, null, salutation, firstname, 
                            middleinitial, lastname, suffix, professionaltitle, 
                            email,businessname, address1, address2, address3, 
                            city, state, postalcode, country, phone, 
                            "false", null, null, null, null, null, null, null, null,null, 
                            null, null, null, null, null, null, null, null, iscomp);
                        response.ResponseCode = (int)sub_response[0];
                        #endregion

                        if (response.ResponseCode == 0)
                        {
                            #region create account at AH
                            string newmemberid = (string)sub_response[1];
                            object[] create_response = 
                                tbl_Customer.CreateCustomer(address1, address2, address3, city, 
                                state, country, postalcode, source, pwd, 
                                customertype, salutation, firstname, middleinitial, 
                                lastname, suffix, email, username, newmemberid, 
                                pubcode, expiredate, startdate, screenname, mobilephone, 
                                secondemail, keycode);
                            response.ResponseCode = (int)create_response[0];
                            response.Customer = (tbl_Customer)create_response[1];
                            response.Address = (tbl_AddressCustomer)create_response[2];
                            response.NetMembership = (tbl_NetMembership)create_response[3];
                            #endregion

                            #region send new user email - no longer sent by this service
                            /*
                            try
                            {
                                Prefix sfgp = HarperLINQ.Prefix.GetPrefixBySFGCode(salutation);
                                Suffix sfgs = HarperLINQ.Suffix.GetSuffixBySFGCode(suffix);
                                string Prefix = sfgp == null ? "" : sfgp.displayname;
                                string Suffix = sfgs == null ? "" : sfgs.displayname;
                                SendNewMemberEmail(Prefix, firstname, lastname, Suffix, newmemberid, email);
                                foreach (string cc in ConfigurationManager.AppSettings["subscribeccaddresses"].Split(','))
                                {
                                    SendNewMemberEmail(Prefix, firstname, lastname, Suffix, newmemberid, cc);
                                }
                            }
                            catch { }
                             */
                            #endregion
                        }
                    }
                }
            }
            catch (Exception e)
            {
                response.ResponseCode = 200;
                response.Customer.cusEncryptedPassword = e.Message;
                string message = string.Format("", new object[] { string.Empty });
                RecordError("CreateCustomer", message, e);
                cart.errors += message;
            }
            return response;

        }                  
Ejemplo n.º 4
0
 partial void Deletetbl_DrupalCartRequest(tbl_DrupalCartRequest instance);
Ejemplo n.º 5
0
 partial void Updatetbl_DrupalCartRequest(tbl_DrupalCartRequest instance);
Ejemplo n.º 6
0
 partial void Inserttbl_DrupalCartRequest(tbl_DrupalCartRequest instance);