コード例 #1
0
        public ResponseObject LoginOnly(string enc_username, string enc_password, bool log_attempt)
        {
            ResponseObject response = new ResponseObject();
            try
            {
                response = DoLogin(enc_username, enc_password);

                if (log_attempt)
                {
                    RecordLoginAttempt(enc_username, enc_password, response, (CustomerResponseCode)response.ResponseCode);
                }
            }
            catch(Exception e)
            {
                response.ResponseCode = 100;
                string message = string.Format("ENC_USERNAME:{0} ENC_PASSWORD:{1} LOG_ATTEMPT:{2}", new object[] { enc_username, enc_password, log_attempt });
                RecordError("Login", message, e);
            }
            return response;
        }
コード例 #2
0
 private void RecordLoginAttempt(string enc_username, string enc_password, ResponseObject response, CustomerResponseCode response_code)
 {
     string u = response.ResponseCode == (int)CustomerResponseCode.CANNOT_DECRYPT_INPUT ? string.Empty : Cryptography.Decrypt256FromHEX(enc_username);
     using (AHT_MainDataContext context = new AHT_MainDataContext(ConfigurationManager.ConnectionStrings["AHT_MainConnectionString"].ConnectionString))
     {
         tbl_AppEventLog ael = new tbl_AppEventLog();
         ael.aelUserName = u;
         ael.aelSection = "Login";
         ael.aelAppName = "CustomerWebService";
         ael.aelSeverity = response.ResponseCode > 0 ? "ERROR" : "INFO";
         ael.aelEvent = response.ResponseCode == (int)CustomerResponseCode.SUCCESS ? "LOGIN_SUCCEEDED" : "LOGIN_FAILED";
         ael.aelMessage1 = string.Format("U:{0} P:{1}", new object[] { enc_username, enc_password });
         ael.aelMessage2 = string.Format(response_code.ToString());
         ael.aelDateCreated = DateTime.Now;
         context.tbl_AppEventLogs.InsertOnSubmit(ael);
         context.SubmitChanges();
     }
 }
コード例 #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;

        }                  
コード例 #4
0
 private ResponseObject DoLogin(string enc_username, string enc_password)
 {
     ResponseObject response = new ResponseObject();
     object[] login_response = tbl_Customer.Login(enc_username, enc_password);
     response.ResponseCode = (int)login_response[0];
     response.Customer = (tbl_Customer)login_response[1];
     response.Address = (tbl_AddressCustomer)login_response[2];
     response.NetMembership = (tbl_NetMembership)login_response[3];
     return response;
 }
コード例 #5
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);
        }