示例#1
0
        /// <summary>
        /// Get All Customer Alerts for Admin
        /// </summary>
        private void GetCustomerAlerts()
        {
            try
            {
                using (var conn = DB.dbConn())
                {
                    conn.Open();
                    using (var cmd = new SqlCommand("aspdnsf_CustomerAlertStatusSelectByCustomerIDAlertDate", conn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@CustomerID", ThisCustomer.CustomerID);
                        cmd.Parameters.AddWithValue("@CustomerLevelID", ThisCustomer.CustomerLevelID);
                        cmd.Parameters.AddWithValue("@AlertDate", DateTime.Now);

                        IDataReader idr = cmd.ExecuteReader();
                        rptCustomerAlerts.DataSource = idr;
                        rptCustomerAlerts.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                                  ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                                  MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
            }
        }
示例#2
0
        /// <summary>
        /// Repeater ItemCommand Event
        /// </summary>
        protected void rptCustomerAlerts_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            try
            {
                int          customerAlertStatusID = Convert.ToInt32(e.CommandArgument);
                const string readSP   = "aspdnsf_CustomerAlertStatusRead";
                const string deleteSP = "aspdnsf_CustomerAlertStatusDelete";

                if (e.CommandName == "Delete")
                {
                    UpdateCustomerAlert(customerAlertStatusID, deleteSP);
                }
                else if (e.CommandName == "Read")
                {
                    UpdateCustomerAlert(customerAlertStatusID, readSP);
                }
                GetCustomerAlerts();
            }
            catch (Exception ex)
            {
                SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                                  ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                                  MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
            }
        }
        private void GetUnreadCustomerAlertCount()
        {
            try
            {
                using (var conn = DB.dbConn())
                {
                    conn.Open();
                    using (var cmd = new SqlCommand("aspdnsf_CustomerAlertUnreadAlertCount", conn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@CustomerID", ThisCustomer.CustomerID);
                        cmd.Parameters.AddWithValue("@CustomerLevelID", ThisCustomer.CustomerLevelID);
                        cmd.Parameters.AddWithValue("@AlertDate", DateTime.Now);
                        Int32 AlertCount = (Int32)cmd.ExecuteScalar();

                        if (AlertCount > 0)
                        {
                            lnkAlertDesktop.Attributes.Add("class", "new-alerts");
                            lblAlertCount.InnerHtml = "ALERTS" + " - " + AlertCount.ToString() + " - ";
                        }
                        else
                        {
                            lnkAlertDesktop.Attributes.Add("class", "alerts-link");
                            lblAlertCount.InnerHtml = "ALERTS";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                                  ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                                  MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
            }
        }
示例#4
0
        private string loadAssemblyInformation()
        {
            StringBuilder ret = new StringBuilder();
            Assembly      asm;

            ret.AppendLine("<table class=\"table\" style=\"table-layout:fixed;-ms-word-wrap:break-word;word-wrap:break-word;\">");
            ret.AppendLine("<tr style=\"text-align:left;\">");
            ret.AppendLine("<th>Name</th>");
            ret.AppendLine("<th>Assembly Version</th>");
            ret.AppendLine("<th>File Version</th>");
            ret.AppendLine("<th>Informational Version</th>");
            ret.AppendLine("</tr>");
            string[] fileEntries = Directory.GetFiles(CommonLogic.SafeMapPath(@"~\bin\"), "*.dll");
            foreach (String dllname in fileEntries)
            {
                try
                {
                    asm = Assembly.LoadFrom(dllname);
                    printAssemblyInformation(asm, ret);
                }
                catch (Exception e)
                {
                    SysLog.LogMessage(dllname + " failed to load.", e.ToString(), MessageTypeEnum.Informational, MessageSeverityEnum.Message);
                }
            }
            ret.AppendLine("</table>");
            return(ret.ToString());
        }
示例#5
0
 /// <summary>
 /// Repeater ItemCommand Event
 /// </summary>
 protected void rptAddresses_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     try
     {
         int addressID = 0;
         if (Int32.TryParse(e.CommandArgument.ToString(), out addressID))
         {
             if (e.CommandName == "Delete")
             {
                 DeleteAddress(addressID);
             }
             else if (e.CommandName == "Edit")
             {
                 EditAddress(addressID);
             }
             else if (e.CommandName == "Select")
             {
                 SelectPrimaryAddress(addressID);
             }
         }
     }
     catch (Exception ex)
     {
         SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                           ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                           MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
     }
 }
示例#6
0
 protected void LoadDownloadItems()
 {
     try
     {
         using (var conn = DB.dbConn())
         {
             conn.Open();
             using (var cmd = new SqlCommand("aspdnsf_GetCustomerDownloads", conn))
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.AddWithValue("@CUSTOMERID", ThisCustomer.CustomerID);
                 IDataReader reader = cmd.ExecuteReader();
                 rptDownloadableItems.DataSource = reader;
                 rptDownloadableItems.DataBind();
                 conn.Close();
                 reader.Close();
             }
         }
     }
     catch (Exception ex)
     {
         SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                           ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                           MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
     }
     noDownloadProductsFound.Visible   = (rptDownloadableItems.Items.Count == 0);
     trnoDownloadProductsFound.Visible = (rptDownloadableItems.Items.Count == 0);
 }
示例#7
0
        /// <summary>
        /// Get Customer Address
        /// </summary>
        /// <param name="AddressID">AddressID</param>
        private void GetCustomerAddress(string AddressID)
        {
            if (!string.IsNullOrEmpty(AddressID))
            {
                try
                {
                    int addressID = int.Parse(AddressID);
                    hfAddressID.Value = addressID.ToString();
                    btnUpdate.Visible = true;
                    Address anyAddress = new Address();
                    anyAddress.LoadFromDB(addressID);

                    if (anyAddress != null)
                    {
                        LoadFormData(anyAddress);
                    }
                }
                catch (Exception ex)
                {
                    SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                                      ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                                      MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
                }
            }
            else
            {
                btnSave.Visible = true;
            }
        }
示例#8
0
文件: USAePay.cs 项目: giagiigi/WE
        public override string RecurringBillingCancelSubscription(string RecurringSubscriptionID, int OriginalRecurringOrderNumber, IDictionary <string, string> TransactionContext)
        {
            String result = String.Empty;

            //set service configuration
            GatewayUSAePay.USAePaySOAP.ueSoapServerPortType client = GetServiceClient(UseSandBox);

            var token = GetSecurityToken();

            try
            {
                if (client.disableCustomer(token, RecurringSubscriptionID))
                {
                    return(AppLogic.ro_OK);
                }
            }
            catch (Exception e)
            {
                SysLog.LogMessage(String.Format(CultureInfo.CurrentCulture, "USAePay Request Failed - Cancel Subscription for order {0}, USAePay Customer Number {1}", OriginalRecurringOrderNumber.ToString(CultureInfo.InvariantCulture), RecurringSubscriptionID),
                                  e.Message,
                                  MessageTypeEnum.GeneralException,
                                  MessageSeverityEnum.Error);
            }
            result = "USAePay Cancel Subscription Failed";
            return(result);
        }
示例#9
0
        /// <summary>
        /// Load All Customer Addresses
        /// </summary>
        private void LoadAddresses(int addressType)
        {
            try
            {
                Addresses allAddresses = new Addresses();
                allAddresses.LoadCustomer(ThisCustomer.CustomerID);

                if (addressType == (int)AddressTypes.Billing)
                {
                    ((Label)this.Master.FindControl("lblPageHeading")).Text = "MY Billing ADDRESSES";
                }
                else if (addressType == (int)AddressTypes.Shipping)
                {
                    ((Label)this.Master.FindControl("lblPageHeading")).Text = "MY Shipping ADDRESSES";
                }
                else
                {
                    return;
                }



                rptAddresses.DataSource = allAddresses;
                rptAddresses.DataBind();
            }
            catch (Exception ex)
            {
                SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                                  ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                                  MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
            }
        }
示例#10
0
 /// <summary>
 /// Load Form Fields from Address Class
 /// </summary>
 /// <param name="anyAddress">anyAddress</param>
 private void LoadFormData(Address anyAddress)
 {
     try
     {
         txtNickName.Text    = anyAddress.NickName;
         txtFirstName.Text   = anyAddress.FirstName;
         txtLastName.Text    = anyAddress.LastName;
         txtPhoneNumber.Text = anyAddress.Phone;
         txtCompany.Text     = anyAddress.Company;
         txtAddress1.Text    = anyAddress.Address1;
         txtAddress2.Text    = anyAddress.Address2;
         txtSuite.Text       = anyAddress.Suite.StartsWith("Suite ") ? anyAddress.Suite.Remove(0, 6) : anyAddress.Suite;
         txtCity.Text        = anyAddress.City;
         if (!string.IsNullOrEmpty(anyAddress.Country))
         {
             ddlCountry.Items.FindByValue(anyAddress.Country).Selected = true;
         }
         GetStateDropDownData();
         if (!string.IsNullOrEmpty(anyAddress.State))
         {
             ddlState.Items.FindByValue(anyAddress.State).Selected = true;
         }
         txtZip.Text = anyAddress.Zip;
     }
     catch (Exception ex)
     {
         SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                           ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                           MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
     }
 }
示例#11
0
 private void GetFilteredCustomerFund(List <CustomerFund> lstCustomerFund)
 {
     try
     {
         foreach (CustomerFund item in lstCustomerFund.ToList())
         {
             if (item != null)
             {
                 if (item.AmountAvailable <= 0)
                 {
                     lstCustomerFund.Remove(item);
                 }
             }
         }
         if (lstCustomerFund.Count > 0)
         {
             rptAllCustomerFunds.DataSource = lstCustomerFund;
             rptAllCustomerFunds.DataBind();
             ExpandFunds.Visible = true;
         }
         else
         {
             ExpandFunds.Visible  = false;
             lnkHideFunds.Visible = false;
         }
     }
     catch (Exception ex)
     {
         SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                           ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                           MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
     }
 }
示例#12
0
        /// <summary>
        /// Load Address Class from Form Fields
        /// </summary>
        /// <returns>Address</returns>
        private Address LoadClassData()
        {
            Address anyAddress = new Address();

            try
            {
                if (!string.IsNullOrEmpty(hfAddressID.Value))
                {
                    anyAddress.LoadFromDB(Convert.ToInt32(hfAddressID.Value));
                }
                anyAddress.CustomerID = ThisCustomer.CustomerID;
                anyAddress.NickName   = txtNickName.Text.Trim();
                anyAddress.FirstName  = txtFirstName.Text.Trim();
                anyAddress.LastName   = txtLastName.Text.Trim();
                anyAddress.Phone      = txtPhoneNumber.Text.Trim();
                anyAddress.Company    = txtCompany.Text.Trim();
                anyAddress.Address1   = txtAddress1.Text.Trim();
                anyAddress.Address2   = txtAddress2.Text.Trim();
                anyAddress.Suite      = (!string.IsNullOrEmpty(txtSuite.Text.Trim()) && char.IsNumber(txtSuite.Text.Trim().FirstOrDefault())) ? "Suite " + txtSuite.Text.Trim() : txtSuite.Text.Trim();
                anyAddress.City       = txtCity.Text.Trim();
                anyAddress.Country    = ddlCountry.SelectedItem.Value.Trim();
                anyAddress.State      = ddlState.SelectedItem.Value.Trim();
                anyAddress.Zip        = txtZip.Text.Trim();

                anyAddress.ResidenceType = (int)ResidenceTypes.Unknown;
            }
            catch (Exception ex)
            {
                SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                                  ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                                  MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
            }
            return(anyAddress);
        }
        private static string GetTrackingURL(string trackingNumber, string shippingMethod)
        {
            if (string.IsNullOrEmpty(shippingMethod))
            {
                return(string.Empty);
            }

            string trackingURL = string.Empty;

            if (AppLogic.AppConfig("RTShipping.ActiveCarrier") != null)
            {
                var carrierList = AppLogic.AppConfig("RTShipping.ActiveCarrier").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);


                foreach (var listItem in carrierList)
                {
                    if (shippingMethod.ToUpper().Contains(listItem.ToUpper()))
                    {
                        if (!string.IsNullOrEmpty(trackingNumber))
                        {
                            trackingURL = string.Format(AppLogic.AppConfig("ShippingTrackingURL." + listItem), trackingNumber);
                        }
                    }
                }
            }

            if (string.IsNullOrEmpty(trackingURL))
            {
                SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                                  "Tracking URL is invalid.", MessageTypeEnum.GeneralException, MessageSeverityEnum.Message);
            }
            return(trackingURL);
        }
        private static string GetShippingMethod(string CarrierCode)
        {
            string shippingMethod = string.Empty;

            using (var conn = DB.dbConn())
            {
                conn.Open();
                var query = "select Name from ShippingMethod where ShippingMethodCode = '" + CarrierCode.Trim() + "'";
                using (var cmd = new SqlCommand(query, conn))
                {
                    cmd.CommandType = CommandType.Text;
                    IDataReader reader = cmd.ExecuteReader();
                    if (reader.Read())
                    {
                        shippingMethod = reader["Name"].ToString();
                    }
                }
            }

            if (string.IsNullOrEmpty(shippingMethod))
            {
                SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                                  "Shipping Method Name is not found.", MessageTypeEnum.GeneralException, MessageSeverityEnum.Message);
            }
            return(shippingMethod);
        }
示例#15
0
        /// <summary>
        /// Save Form Data
        /// </summary>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Address anyAddress = LoadClassData();
                anyAddress.InsertDB();

                int addressID = anyAddress.AddressID;

                if (ThisCustomer.PrimaryBillingAddressID == 0)
                {
                    DB.ExecuteSQL("Update Customer set BillingAddressID=" + addressID + " where CustomerID=" + ThisCustomer.CustomerID.ToString());
                }
                if (ThisCustomer.PrimaryShippingAddressID == 0)
                {
                    DB.ExecuteSQL("Update Customer set ShippingAddressID=" + addressID + " where CustomerID=" + ThisCustomer.CustomerID.ToString());
                    ThisCustomer.SetPrimaryShippingAddressForShoppingCart(ThisCustomer.PrimaryShippingAddressID, addressID);
                }
                Response.Redirect(hfPreviousURL.Value, false);
                Context.ApplicationInstance.CompleteRequest();
            }
            catch (Exception ex)
            {
                SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                                  ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                                  MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
            }
        }
示例#16
0
 /// <summary>
 /// Gets the order items detail.
 /// </summary>
 private void GetOrderItemsDetail()
 {
     try
     {
         using (var conn = DB.dbConn())
         {
             conn.Open();
             using (var cmd = new SqlCommand("aspdnsf_GetOrderItemsDetail", conn))
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.AddWithValue("@ORDERNUMBER", OrderNumber);
                 reader = cmd.ExecuteReader();
                 rptOrderItemsDetail.DataSource = reader;
                 rptOrderItemsDetail.DataBind();
                 conn.Close();
             }
         }
     }
     catch (Exception ex)
     {
         SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                           ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                           MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
     }
 }
        protected bool DeleteAllTraceOfThisQuantityDiscount(int qtyDiscountId)
        {
            try
            {
                //update entity tables
                DB.ExecuteSQL("update dbo.category set QuantityDiscountID=0 where QuantityDiscountID=" + qtyDiscountId);
                DB.ExecuteSQL("update dbo.section set QuantityDiscountID=0 where QuantityDiscountID=" + qtyDiscountId);
                DB.ExecuteSQL("update dbo.genre set QuantityDiscountID=0 where QuantityDiscountID=" + qtyDiscountId);
                DB.ExecuteSQL("update dbo.manufacturer set QuantityDiscountID=0 where QuantityDiscountID=" + qtyDiscountId);
                DB.ExecuteSQL("update dbo.library set QuantityDiscountID=0 where QuantityDiscountID=" + qtyDiscountId);
                DB.ExecuteSQL("update dbo.distributor set QuantityDiscountID=0 where QuantityDiscountID=" + qtyDiscountId);
                DB.ExecuteSQL("update dbo.vector set QuantityDiscountID=0 where QuantityDiscountID=" + qtyDiscountId);

                //update product table
                DB.ExecuteSQL("update dbo.product set QuantityDiscountID=0 where QuantityDiscountID=" + qtyDiscountId);

                //delete from quantitydiscount tables
                DB.ExecuteSQL("delete from QuantityDiscountTable where QuantityDiscountID=" + qtyDiscountId);
                DB.ExecuteSQL("delete from QuantityDiscount where QuantityDiscountID=" + qtyDiscountId);

                return(true);
            }
            catch (Exception ex)
            {
                SysLog.LogMessage("Delete of QuantityDiscount Failed", ex.Message, MessageTypeEnum.DatabaseException, MessageSeverityEnum.Alert);
                return(false);
            }
        }
示例#18
0
        public string SagePayPiApiCall(string dataObject, string url, string callMethod)
        {
            var data                = new ASCIIEncoding().GetBytes(dataObject);
            var integrationKey      = AppConfigProvider.GetAppConfigValue("SagePayPi.IntegrationKey");
            var integrationPassword = AppConfigProvider.GetAppConfigValue("SagePayPi.IntegrationPassword");
            var encoded             = Convert.ToBase64String(Encoding
                                                             .GetEncoding("ISO-8859-1")
                                                             .GetBytes($"{integrationKey}:{integrationPassword}"));

            // Prepare API request
            var request = (HttpWebRequest)WebRequest.Create(url);

            request.Headers.Add("Authorization", string.Concat("Basic ", encoded));
            request.Method      = callMethod;
            request.ContentType = "application/json";

            // If this is a Post Method, send the content body data and its length
            if (callMethod.EqualsIgnoreCase("post"))
            {
                // Add body length
                request.ContentLength = data.Length;
                // Send body data
                using (var newStream = request.GetRequestStream())
                {
                    newStream.Write(data, 0, data.Length);
                }
            }

            // Get the response
            try
            {
                var rawResponseString = string.Empty;
                using (var response = request.GetResponse())
                {
                    using (var sr = new StreamReader(response.GetResponseStream()))
                    {
                        rawResponseString = sr.ReadToEnd();
                    }
                }
                return(rawResponseString);
            }
            catch (WebException webEx)
            {
                var errorResponse = "{\"status\": \"Error\",  \"statusDetail\": \"An error occured\"}";
                if (webEx.Status == WebExceptionStatus.ProtocolError)
                {
                    using (var sr = new StreamReader(webEx.Response.GetResponseStream()))
                    {
                        errorResponse = sr.ReadToEnd();
                    }
                }
                return(errorResponse);
            }
            catch (Exception ex)
            {
                SysLog.LogMessage(StringResourceProvider.GetString("sagepaypi.connectionerror"), ex.Message, MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
                return("{\"status\": \"Error\",  \"statusDetail\": \"An unknown error occured\"}");
            }
        }
示例#19
0
文件: USAePay.cs 项目: giagiigi/WE
        public override string RecurringBillingAddressUpdate(string RecurringSubscriptionID, int OriginalRecurringOrderNumber, Address UseBillingAddress)
        {
            String result  = String.Empty;
            String custNum = RecurringSubscriptionID ?? String.Empty;            //clarifying that SubcriptionID is USAePay Customer Number

            if (UseBillingAddress == null)
            {
                return("USAePay Billing Information Update Failed - Address is empty.");
            }
            bool updatePaymentMethod = !String.IsNullOrEmpty(UseBillingAddress.CardNumber) &&
                                       !String.IsNullOrEmpty(UseBillingAddress.CardExpirationMonth) &&
                                       !String.IsNullOrEmpty(UseBillingAddress.CardExpirationYear) &&
                                       UseBillingAddress.PaymentMethodLastUsed == AppLogic.ro_PMCreditCard;

            //set service configuration
            GatewayUSAePay.USAePaySOAP.ueSoapServerPortType client = GetServiceClient(UseSandBox);
            var token = GetSecurityToken();

            var customer       = new GatewayUSAePay.USAePaySOAP.CustomerObject();
            var addressBilling = GetUSAePayBillingAddress(UseBillingAddress);

            try
            {
                //get current customer info from USAePay, including existing PaymentMethod
                customer = client.getCustomer(token, custNum);

                //USAePay supports multiple payment methods but we should only have one.
                if (customer.PaymentMethods.Length > 1)
                {
                    return("USAePay Payment Method Update Error - Please contact customer support to update subscription");
                }

                if (updatePaymentMethod)
                {
                    customer.PaymentMethods = GetUSAePayCCPaymentMethod(UseBillingAddress);
                }

                customer.BillingAddress = addressBilling;                 //assign billing address
                if (client.updateCustomer(token, custNum, customer))
                {
                    result = AppLogic.ro_OK;
                }
                else
                {
                    result = "USAePay Billing Information Update Failed";
                }

                return(result);
            }
            catch (Exception e)
            {
                SysLog.LogMessage(String.Format(CultureInfo.CurrentCulture, "USAePay Request Failed - Update Billing for order {0}, USAePay custNum {1}", OriginalRecurringOrderNumber.ToString(CultureInfo.InvariantCulture), RecurringSubscriptionID),
                                  e.Message,
                                  MessageTypeEnum.GeneralException,
                                  MessageSeverityEnum.Error);
                return("USAePay Billing Information Update Failed");
            }
        }
示例#20
0
        public override string RecurringBillingCancelSubscription(String RecurringSubscriptionID, int OriginalRecurringOrderNumber, IDictionary <string, string> TransactionContext)
        {
            string profileID = string.Empty;
            string result    = string.Empty;

            profileID = PayPalController.GetPPECProfileID(OriginalRecurringOrderNumber);

            if (profileID != string.Empty)
            {
                ManageRecurringPaymentsProfileStatusRequestDetailsType recurringRequestDetails = new ManageRecurringPaymentsProfileStatusRequestDetailsType();
                recurringRequestDetails.Action    = StatusChangeActionType.Cancel;
                recurringRequestDetails.ProfileID = profileID;

                ManageRecurringPaymentsProfileStatusRequestType recurringRequest = new ManageRecurringPaymentsProfileStatusRequestType();
                recurringRequest.ManageRecurringPaymentsProfileStatusRequestDetails = recurringRequestDetails;
                recurringRequest.Version = API_VER;

                ManageRecurringPaymentsProfileStatusReq profileStatusRequest = new ManageRecurringPaymentsProfileStatusReq();
                profileStatusRequest.ManageRecurringPaymentsProfileStatusRequest = recurringRequest;

                ManageRecurringPaymentsProfileStatusResponseType recurringResponse = new ManageRecurringPaymentsProfileStatusResponseType();
                recurringResponse = IPayPal.ManageRecurringPaymentsProfileStatus(profileStatusRequest);

                if (recurringResponse != null && recurringResponse.Ack.ToString().StartsWith("success", StringComparison.InvariantCultureIgnoreCase))
                {
                    result = AppLogic.ro_OK;
                }
                else
                {
                    if (recurringResponse.Errors != null)
                    {
                        bool first = true;
                        for (int ix = 0; ix < recurringResponse.Errors.Length; ix++)
                        {
                            if (!first)
                            {
                                result += ", ";
                            }
                            result += recurringResponse.Errors[ix].LongMessage;
                            first   = false;
                        }
                    }
                }
            }
            else
            {
                result = "No matching Profile ID found for that order number";

                SysLog.LogMessage("An attempt was made to cancel a PayPal recurring order with no matching Profile ID",
                                  "Original order ID was: " + OriginalRecurringOrderNumber.ToString(),
                                  MessageTypeEnum.Informational,
                                  MessageSeverityEnum.Alert);
            }

            return(result);
        }
示例#21
0
 public override string ObtainBraintreeToken()
 {
     try
     {
         return(CreateBraintreeGateway().ClientToken.generate());
     }
     catch (Exception exception)
     {
         SysLog.LogMessage(AppLogic.GetString("braintree.connectionerror"), exception.Message, MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
         return(string.Empty);
     }
 }
示例#22
0
文件: Braintree.cs 项目: giagiigi/WE
 public override string ObtainBraintreeToken()
 {
     try
     {
         return(CreateBraintreeGateway().ClientToken.generate());
     }
     catch (Exception exception)
     {
         SysLog.LogMessage("Connection to Braintree service failed.", exception.Message, MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
         return(string.Empty);
     }
 }
示例#23
0
        bool VerifyAuthenticity(SignifydConfiguration signifydConfiguration)
        {
            // Check the hash of this message to make sure it came from Signifyd

            // If this is the Test topic, check if it was hashed with their test code
            // This happens if someone clicks 'Test' in the web console for our webhook
            if (Request.Headers[RequestHeaderSignifydTopic] == TopicTest)
            {
                using (var hash = new HMACSHA256(Encoding.UTF8.GetBytes(SignifydTestHashKey)))
                {
                    Request.InputStream.Position = 0;
                    var localEncodedJsonBodyHash = Convert.ToBase64String(hash.ComputeHash(Request.InputStream));

                    if (localEncodedJsonBodyHash == Request.Headers[RequestHeaderSignifydHash])                     // This Test topic was hashed using their Test hash key
                    {
                        if (AppConfigProvider.GetAppConfigValue <bool>("Signifyd.Log.Enabled"))
                        {
                            SysLog.LogMessage(
                                message: "Signifyd test post received.",
                                details: "Signifyd test post received.",
                                messageType: MessageTypeEnum.Informational,
                                messageSeverity: MessageSeverityEnum.Message);
                        }

                        return(false);
                    }
                }
            }

            // This message should be hashed with our API key; let's verify the message authenticity
            using (var hash = new HMACSHA256(Encoding.UTF8.GetBytes(signifydConfiguration.AccessToken)))
            {
                Request.InputStream.Position = 0;
                var localEncodedJsonBodyHash = Convert.ToBase64String(hash.ComputeHash(Request.InputStream));

                if (localEncodedJsonBodyHash != Request.Headers[RequestHeaderSignifydHash])
                {
                    if (AppConfigProvider.GetAppConfigValue <bool>("Signifyd.Log.Enabled"))
                    {
                        SysLog.LogException(
                            ex: new Exception($"Signifyd hash does not match locally calculated hash; could not validate authenticity."),
                            messageType: MessageTypeEnum.GeneralException,
                            messageSeverity: MessageSeverityEnum.Error);
                    }

                    return(false);
                }
            }

            return(true);
        }
示例#24
0
        protected void gMain_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = gMain.Rows[e.RowIndex];

            if (row != null)
            {
                string iden        = row.Cells[0].Text.ToString();
                string name        = CommonLogic.Left(((TextBox)row.FindControl("txtName")).Text, 10).Replace(" ", "-");
                string description = CommonLogic.Left(((TextBox)row.FindControl("txtDescription")).Text, 100);
                string cID         = ((DropDownList)row.FindControl("ddCurrency")).SelectedValue;
                string order       = ((TextBox)row.FindControl("txtOrder")).Text;

                // see if this LocaleSetting already exists:
                int N = DB.GetSqlN("select count(name) as N from LocaleSetting   with (NOLOCK)  where LocaleSettingID<>" + iden + " and Name=" + DB.SQuote(name));
                if (N != 0)
                {
                    ctrlAlertMessage.PushAlertMessage("admin.localesettings.ExistingLocale".StringResource(), AlertMessage.AlertType.Danger);
                    return;
                }

                StringBuilder sql = new StringBuilder(2500);

                // ok to update:
                sql.Append("update LocaleSetting set ");
                sql.Append("Name=" + DB.SQuote(Localization.CheckLocaleSettingForProperCase(name)) + ",");
                sql.Append("Description=" + DB.SQuote(description) + ",");
                sql.Append("DefaultCurrencyID=" + cID + ",");
                sql.Append("DisplayOrder=" + order);
                sql.Append(" where LocaleSettingID=" + iden);

                ctrlAlertMessage.PushAlertMessage("admin.common.ItemUpdated".StringResource(), AlertMessage.AlertType.Success);

                try
                {
                    DB.ExecuteSQL(sql.ToString());

                    deleteXX();

                    gMain.EditIndex        = -1;
                    ViewState["SQLString"] = selectSQL;
                    buildGridData();
                }
                catch (Exception ex)
                {
                    ctrlAlertMessage.PushAlertMessage("Couldn't save changes. Please make sure all fields are filled in. Check system log for details.", AlertMessage.AlertType.Danger);
                    SysLog.LogMessage("Locale Setting Error", String.Format("admin.creditcards.CouldntUpdateDatabase".StringResource(), sql.ToString(), ex.ToString()), MessageTypeEnum.DatabaseException, MessageSeverityEnum.Error);
                }
            }
        }
        private void LoadMenu(String ctrlToLoad, String localeSetting, bool isDefaultMenu)
        {
            String ctrlName = AppLogic.AdminLinkUrl("Controls/" + ctrlToLoad, true);

            Literal litError = new Literal();

            litError.Mode = LiteralMode.PassThrough;
            litError.Text = AppLogic.GetString("admin.menu.loaderror", localeSetting);

            // couldn't find the default menu...log
            try
            {
                if (!CommonLogic.FileExists(ctrlName) && isDefaultMenu)
                {
                    pnlMenu.Controls.Add(litError);

                    // no menu file found...log
                    SysLog.LogMessage("File Not Found", "Unable to load menu control {0}.".FormatWith(ctrlToLoad), MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
                }
                else if (CommonLogic.FileExists(ctrlName))
                {
                    try
                    {
                        pnlMenu.Controls.Add(LoadControl(ctrlName));
                    }
                    catch
                    {
                        // no menu file found...log
                        SysLog.LogMessage("File Not Found", "Unable to load menu control {0}.".FormatWith(ctrlToLoad), MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
                    }
                }
                else
                {
                    // couldn't load a custom menu so display an error message to the user and log rather than showing
                    // an entire menu to an admin user that maybe shouldn't see it

                    pnlMenu.Controls.Add(litError);

                    // no menu file found...log
                    SysLog.LogMessage("File Not Found", "Unable to load menu control {0}.".FormatWith(ctrlToLoad), MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
                }
            }
            catch (Exception ex)
            {
                SysLog.LogException(ex, MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
                pnlMenu.Controls.Add(litError);
            }
        }
示例#26
0
        /// <summary>
        /// Sets the billing and shipping addresses.
        /// </summary>
        /// <param name="Ba">The ba.</param>
        /// <param name="Sa">The sa.</param>
        /// <param name="OrderNumber">The order number.</param>
        private void SetBillingAndShippingAddresses(ref orderService.brandstore.ws.BillingAddress Ba, ref orderService.brandstore.ws.ShippingAddress Sa, int OrderNumber)
        {
            try
            {
                using (var conn = DB.dbConn())
                {
                    conn.Open();
                    using (var cmd = new SqlCommand("aspdnsf_GetOrderDetail", conn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@ORDERNUMBER", OrderNumber);
                        reader2 = cmd.ExecuteReader();
                        if (reader2.Read())
                        {
                            //Set Billing address
                            Ba.Name1      = reader2["BillingFirstName"].ToString() + ' ' + reader2["BillingLastName"].ToString();
                            Ba.Name2      = "";
                            Ba.Email      = String.IsNullOrEmpty(reader2["Email"].ToString()) ? String.Empty : reader2["Email"].ToString();
                            Ba.Address1   = String.IsNullOrEmpty(reader2["BillingAddress1"].ToString()) ? String.Empty : reader2["BillingAddress1"].ToString();
                            Ba.Address2   = String.IsNullOrEmpty(reader2["BillingAddress2"].ToString()) ? String.Empty : reader2["BillingAddress2"].ToString() + " " + (String.IsNullOrEmpty(reader2["BillingSuite"].ToString()) ? String.Empty : reader2["BillingSuite"].ToString());
                            Ba.City       = String.IsNullOrEmpty(reader2["BillingCity"].ToString()) ? String.Empty : reader2["BillingCity"].ToString();
                            Ba.Locale     = String.IsNullOrEmpty(reader2["BillingStateName"].ToString()) ? String.Empty : reader2["BillingStateName"].ToString();
                            Ba.Country    = String.IsNullOrEmpty(reader2["BillingCountryCode"].ToString()) ? String.Empty : reader2["BillingCountryCode"].ToString();
                            Ba.PostalCode = String.IsNullOrEmpty(reader2["BillingZip"].ToString()) ? String.Empty : reader2["BillingZip"].ToString();

                            //Set Shipping Address

                            Sa.Name1      = reader2["ShippingFirstName"].ToString() + ' ' + reader2["ShippingLastName"].ToString();
                            Sa.Name2      = "";
                            Sa.Email      = String.IsNullOrEmpty(reader2["Email"].ToString()) ? String.Empty : reader2["Email"].ToString();
                            Sa.Address1   = String.IsNullOrEmpty(reader2["ShippingAddress1"].ToString()) ? String.Empty : reader2["ShippingAddress1"].ToString();
                            Sa.Address2   = String.IsNullOrEmpty(reader2["ShippingAddress2"].ToString()) ? String.Empty : reader2["ShippingAddress2"].ToString() + " " + (String.IsNullOrEmpty(reader2["ShippingSuite"].ToString()) ? String.Empty : reader2["BillingSuite"].ToString());
                            Sa.City       = String.IsNullOrEmpty(reader2["ShippingCity"].ToString()) ? String.Empty : reader2["ShippingCity"].ToString();
                            Sa.Locale     = String.IsNullOrEmpty(reader2["ShippingStateName"].ToString()) ? String.Empty : reader2["ShippingStateName"].ToString();
                            Sa.Country    = String.IsNullOrEmpty(reader2["ShippingCountryCode"].ToString()) ? String.Empty : reader2["ShippingCountryCode"].ToString();
                            Sa.PostalCode = String.IsNullOrEmpty(reader2["ShippingZip"].ToString()) ? String.Empty : reader2["ShippingZip"].ToString();
                        }
                        conn.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                                  ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                                  MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
            }
        }
示例#27
0
 /// <summary>
 /// Update Form Data
 /// </summary>
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         Address anyAddress = LoadClassData();
         anyAddress.UpdateDB();
         Response.Redirect(hfPreviousURL.Value, false);
         Context.ApplicationInstance.CompleteRequest();
     }
     catch (Exception ex)
     {
         SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                           ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                           MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
     }
 }
示例#28
0
        /// <summary>
        /// Loads the gateway processor
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static GatewayProcessor GetProcessor(string name, bool logInvalidGateway = true)
        {
            // lowercase it for caching later
            name = name.ToLowerInvariant();

            #region Paypal Recurring

            if (name.Equals(AppLogic.ro_PMPayPalEmbeddedCheckout.ToLower()))
            {
                name = Gateway.ro_GWPAYFLOWPRO.ToLower();
            }

            #endregion

            try
            {
                // Iterate through all the available types in this assembly
                // checking for Types that inherit from GatewayProcessor
                var processors    = GetGatewayProcessorTypes();                      // Get all the types that inherit from the GatewayProcessor
                var processorType = processors
                                    .Where(type => type.Name.EqualsIgnoreCase(name)) // get only the one that has a name that starts with the name and perform case-insensitive matching
                                    .FirstOrDefault();

                if (processorType == null)
                {
                    return(null);
                }

                var processor = Activator.CreateInstance(processorType) as GatewayProcessor;
                if (processor == null && logInvalidGateway)
                {
                    SysLog.LogMessage("Gateway Processor not found {0}".FormatWith(name), string.Empty, MessageTypeEnum.Informational, MessageSeverityEnum.Alert);
                }

                return(processor);
            }
            catch (Exception exception)
            {
                SysLog.LogException(
                    ex: new Exception("Error loading gateway processor: {0}".FormatWith(name), exception),
                    messageType: MessageTypeEnum.GeneralException,
                    messageSeverity: MessageSeverityEnum.Error);

                return(null);
            }
        }
        private static bool ValidateJSON(ref List <TrackingInformation> lstTrackingInformation, string notes)
        {
            bool flag = false;

            try
            {
                lstTrackingInformation = JsonConvert.DeserializeObject <List <TrackingInformation> >(notes);
                flag = true;
            }
            catch (Exception ex)
            {
                SysLog.LogMessage(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString() + " :: " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                                  ex.Message + ((ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message)) ? " :: " + ex.InnerException.Message : ""),
                                  MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);
            }
            return(flag);
        }
示例#30
0
        void CreateNewPPECRecurrence(string payerId, string profileId, string subscriptionId)
        {
            var originalOrderNumber = GetPPECOriginalOrderNumber(profileId, subscriptionId);

            if (originalOrderNumber != 0)
            {
                var manager = new RecurringOrderMgr();
                manager.ProcessPPECRecurringOrder(originalOrderNumber);
            }
            else
            {
                SysLog.LogMessage("A recurring payment notification came from PayPal Express that did not match an existing recurring order.",
                                  string.Format("PayerID = {0}, ProfileID = {1}", payerId, profileId),
                                  MessageTypeEnum.Informational,
                                  MessageSeverityEnum.Alert);
            }
        }