protected void btnSubmit_Click(object sender, EventArgs e) { ZNode.Libraries.Shipping.FedEx fdx = new ZNode.Libraries.Shipping.FedEx(); ZNodeEncryption decrypt = new ZNodeEncryption(); if (ZNodeConfigManager.SiteConfig.FedExProductionKey.Length == 0 || ZNodeConfigManager.SiteConfig.FedExSecurityCode.Length == 0) { lblErrorMsg.Text = "Please obtain user account first using RegisterCSPUSer."; return; } fdx.ClientProductId = ZNodeConfigManager.SiteConfig.FedExClientProductId; fdx.ClientProductVersion = ZNodeConfigManager.SiteConfig.FedExClientProductVersion; fdx.CSPAccessKey = ZNodeConfigManager.SiteConfig.FedExCSPKey; fdx.CSPPassword = ZNodeConfigManager.SiteConfig.FedExCSPPassword; fdx.FedExAccountNumber = decrypt.DecryptData(ZNodeConfigManager.SiteConfig.FedExAccountNumber); fdx.CurrencyCode = ZNode.Libraries.ECommerce.Catalog.ZNodeCurrencyManager.CurrencyCode(); fdx.FedExAccessKey = decrypt.DecryptData(ZNodeConfigManager.SiteConfig.FedExProductionKey); fdx.FedExSecurityCode = decrypt.DecryptData(ZNodeConfigManager.SiteConfig.FedExSecurityCode); ZNode.Libraries.Shipping.FedExSubscribeService.Address BillingAddress = new ZNode.Libraries.Shipping.FedExSubscribeService.Address(); BillingAddress.StreetLines = new string[] { txtBillingStreet1.Text.Trim(), txtBillingStreet2.Text.Trim() }; BillingAddress.PostalCode = txtBillingPostalCode.Text.Trim(); BillingAddress.City = txtBillingCity.Text.Trim(); BillingAddress.StateOrProvinceCode = txtBillingState.Text.Trim(); BillingAddress.CountryCode = lstBillingCountryCode.SelectedValue; string meterNumber = fdx.SubscribeUser(FirstName.Text.Trim() + " " + LastName.Text.Trim(), PhoneNumber.Text.Trim(), "", "", EmailID.Text, BillingAddress); if (fdx.ErrorCode == "0")//Check for success { PortalService portalService = new PortalService(); Portal _portal = portalService.GetByPortalID(ZNodeConfigManager.SiteConfig.PortalID); _portal.FedExMeterNumber = decrypt.EncryptData(meterNumber); portalService.Update(_portal); Response.Redirect("~/admin/secure/settings/default.aspx?mode=fedex"); } else { lblErrorMsg.Text = fdx.ErrorDescription; } }
/// <summary> /// Bind fields /// </summary> protected void BindData() { BindCountries(); ZNodeEncryption encrypt = new ZNodeEncryption(); IPCommerceService ips = new IPCommerceService(); IPCommerce ipc = ips.GetByPortalID(ZNodeConfigManager.SiteConfig.PortalID); if (ipc != null) { try { UserID.Text = encrypt.DecryptData(ipc.MerchantLogin); Password.Text = encrypt.DecryptData(ipc.MerchantPassword); SocketID.Text = encrypt.DecryptData(ipc.IPPFSocketId); } catch { //ignore } txtBillingCity.Text = ipc.MerchantCity; lstBillingCountryCode.SelectedItem.Text = ipc.MerchantCountryCode; PhoneNumber.Text = ipc.MerchantCustServicePhone; MerchantName.Text = ipc.MerchantName; txtBillingPostalCode.Text = ipc.MerchantPostalCode; SocketNumber.Text = ipc.MerchantSocketNum; txtBillingState.Text = ipc.MerchantStateProv; StoreID.Text = ipc.MerchantStoreId; SIC.Text = ipc.Custom1;//SIC Code MerchantID.Text = ipc.Custom4;// Merchant ID SerialNumber.Text = ipc.Custom5; // Serial number txtBillingStreet1.Text = ipc.MerchantStreet1; txtBillingStreet2.Text = ipc.MerchantStreet2; if (ipc.Custom2 != null) //CV Data chkCVVData.Checked = bool.Parse(ipc.Custom2); if (ipc.Custom3 != null) // AVS Data chkAVSData.Checked = bool.Parse(ipc.Custom3); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { ZNode.Libraries.Shipping.FedEx fdx = new ZNode.Libraries.Shipping.FedEx(); ZNodeEncryption decrypt = new ZNodeEncryption (); fdx.ClientProductId = ZNodeConfigManager.SiteConfig.FedExClientProductId; fdx.ClientProductVersion = ZNodeConfigManager.SiteConfig.FedExClientProductVersion; fdx.CSPAccessKey = ZNodeConfigManager.SiteConfig.FedExCSPKey; fdx.CSPPassword = ZNodeConfigManager.SiteConfig.FedExCSPPassword; fdx.CurrencyCode = ZNode.Libraries.ECommerce.Catalog.ZNodeCurrencyManager.CurrencyCode(); fdx.FedExAccountNumber = decrypt.DecryptData(ZNodeConfigManager.SiteConfig.FedExAccountNumber); ZNode.Libraries.Shipping.FedExRegisterCspUserService.Address BillingAddress = new ZNode.Libraries.Shipping.FedExRegisterCspUserService.Address(); BillingAddress.StreetLines = new string[]{txtBillingStreet1.Text.Trim(),txtBillingStreet2.Text.Trim()}; BillingAddress.City = txtBillingCity.Text.Trim(); BillingAddress.StateOrProvinceCode = txtBillingState.Text.Trim(); BillingAddress.PostalCode = txtBillingPostalCode.Text.Trim(); BillingAddress.CountryCode = lstBillingCountryCode.SelectedValue; ZNode.Libraries.Shipping.FedExRegisterCspUserService.WebAuthenticationCredential userCredential = fdx.RegisterCPCUser(FirstName.Text.Trim(), LastName.Text.Trim(), PhoneNumber.Text.Trim(), "", "", EmailId.Text.Trim(), BillingAddress); if (fdx.ErrorCode == "0") { //User Credential string userKey = userCredential.Key; string password = userCredential.Password; PortalService portalService = new PortalService(); Portal _portal = portalService.GetByPortalID(ZNodeConfigManager.SiteConfig.PortalID); _portal.FedExProductionKey = decrypt.EncryptData(userKey); _portal.FedExSecurityCode = decrypt.EncryptData(password); portalService.Update(_portal); //remove the siteconfig from session ZNodeConfigManager.SiteConfig = null; Response.Redirect("~/admin/secure/settings/default.aspx?mode=fedex"); } else { lblErrorMsg.Text = fdx.ErrorDescription; } }
/// <summary> /// Submit Button Click Event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { string strFileName = ""; MailMessage EmailContent = new MailMessage(ZNodeConfigManager.SiteConfig.AdminEmail, lblEmailid.Text); EmailContent.Subject = txtEmailSubj.Text; EmailContent.Body = ctrlHtmlText.Html.ToString(); EmailContent.IsBodyHtml = true; #region Attachment Steps // Get the file name strFileName = Path.GetFileName(FileBrowse.PostedFile.FileName); if (!strFileName.Equals("")) { // Save the file on the server FileBrowse.PostedFile.SaveAs(Server.MapPath(strFileName)); //Email Attachment Attachment attach = new Attachment(Server.MapPath(strFileName)); //Attach the created email attachment EmailContent.Attachments.Add(attach); } #endregion ZNodeEncryption encrypt = new ZNodeEncryption(); string SMTPServer = string.Empty; string SMTPUsername = string.Empty; string SMTPPassword = string.Empty; if (ZNodeConfigManager.SiteConfig.SMTPServer != null) { SMTPServer = ZNodeConfigManager.SiteConfig.SMTPServer; } if (ZNodeConfigManager.SiteConfig.SMTPUserName != null) { SMTPUsername = encrypt.DecryptData(ZNodeConfigManager.SiteConfig.SMTPUserName); } if (ZNodeConfigManager.SiteConfig.SMTPPassword != null) { SMTPPassword = encrypt.DecryptData(ZNodeConfigManager.SiteConfig.SMTPPassword); } //create mail client and send email System.Net.Mail.SmtpClient emailClient = new System.Net.Mail.SmtpClient(); emailClient.Host = SMTPServer; emailClient.Credentials = new NetworkCredential(SMTPUsername, SMTPPassword); //Send MailContent emailClient.Send(EmailContent); EmailContent.Attachments.Dispose(); /* Delete the attachements if any */ if (strFileName != null && strFileName != "") { File.Delete(Server.MapPath(strFileName)); } Response.Redirect(RedirectLink); }
/// <summary> /// Bind data to form fields /// </summary> private void BindData() { StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin(); Portal portal = storeAdmin.GetByPortalId(ZNodeConfigManager.SiteConfig.PortalID); txtDomainName.Text = portal.DomainName; txtCompanyName.Text = portal.CompanyName; txtStoreName.Text = portal.StoreName; chkEnableSSL.Checked = portal.UseSSL; txtAdminEmail.Text = portal.AdminEmail; txtSalesEmail.Text = portal.SalesEmail; txtCustomerServiceEmail.Text = portal.CustomerServiceEmail; txtSalesPhoneNumber.Text = portal.SalesPhoneNumber; txtCustomerServicePhoneNumber.Text = portal.CustomerServicePhoneNumber; txtMaxCatalogDisplayColumns.Text = portal.MaxCatalogDisplayColumns.ToString(); txtMaxCatalogDisplayItems.Text = portal.MaxCatalogDisplayItems.ToString(); txtMaxSmallThumbnailsDisplay.Text = portal.MaxCatalogCategoryDisplayThumbnails.ToString(); chkInclusiveTax.Checked = portal.InclusiveTax; txtMaxCatalogItemLargeWidth.Text = portal.MaxCatalogItemLargeWidth.ToString(); txtMaxCatalogItemMediumWidth.Text = portal.MaxCatalogItemMediumWidth.ToString(); txtMaxCatalogItemSmallWidth.Text = portal.MaxCatalogItemSmallWidth.ToString(); txtMaxCatalogCrossSellWidth.Text = portal.MaxCatalogItemCrossSellWidth.ToString(); txtMaxCatalogItemSwatchesWidth.Text = portal.MaxCatalogItemSwatchWidth.ToString(); txtMaxCatalogItemThumbnailWidth.Text = portal.MaxCatalogItemThumbnailWidth.ToString(); txtShopByPriceMax.Text = portal.ShopByPriceMax.ToString(); txtShopByPriceMin.Text = portal.ShopByPriceMin.ToString(); txtShopByPriceIncrement.Text = portal.ShopByPriceIncrement.ToString(); ListReviewStatus.SelectedValue = portal.DefaultReviewStatus; //Currency Type settings if (portal.CurrencyTypeID.HasValue) { ddlCurrencyTypes.SelectedValue = portal.CurrencyTypeID.Value.ToString(); } //Show Example ShowPriceFormat(); if(portal.SiteWideBottomJavascript!=null) { txtSiteWideBottomJavaScript.Text = portal.SiteWideBottomJavascript.ToString(); } if (portal.SiteWideTopJavascript != null) { txtSiteWideTopJavaScript.Text = portal.SiteWideTopJavascript.ToString(); } if (portal.SiteWideAnalyticsJavascript != null) { txtSiteWideAnalyticsJavascript.Text = portal.SiteWideAnalyticsJavascript.ToString(); } if (portal.OrderReceiptAffiliateJavascript != null) { txtOrderReceiptJavaScript.Text = portal.OrderReceiptAffiliateJavascript.ToString(); } try { ZNodeEncryption encrypt = new ZNodeEncryption(); if (portal.SMTPServer != null) { txtSMTPServer.Text = portal.SMTPServer; } if (portal.SMTPUserName != null) { txtSMTPUserName.Text = encrypt.DecryptData(portal.SMTPUserName); } if (portal.SMTPPassword != null) { txtSMTPPassword.Text = encrypt.DecryptData(portal.SMTPPassword); } //Set UPS Account details if (portal.UPSUserName != null) { txtUPSUserName.Text = encrypt.DecryptData(portal.UPSUserName); } if (portal.UPSPassword != null) { txtUPSPassword.Text = encrypt.DecryptData(portal.UPSPassword); } if (portal.UPSKey != null) { txtUPSKey.Text = encrypt.DecryptData(portal.UPSKey); } //Bind FedEx Account details if (portal.FedExAccountNumber != null) txtAccountNum.Text = encrypt.DecryptData(portal.FedExAccountNumber); if (portal.FedExMeterNumber != null) txtMeterNum.Text = encrypt.DecryptData(portal.FedExMeterNumber); if (portal.FedExProductionKey != null) txtProductionAccessKey.Text = encrypt.DecryptData(portal.FedExProductionKey); if (portal.FedExSecurityCode != null) txtSecurityCode.Text = encrypt.DecryptData(portal.FedExSecurityCode); if (portal.FedExUseDiscountRate.HasValue) chkFedExDiscountRate.Checked = portal.FedExUseDiscountRate.Value; if (portal.FedExAddInsurance.HasValue) chkAddInsurance.Checked = portal.FedExAddInsurance.Value; } catch { //ignore decryption errors } txtShippingAddress1.Text = portal.ShippingOriginAddress1; txtShippingAddress2.Text = portal.ShippingOriginAddress2; txtShippingCity.Text = portal.ShippingOriginCity; txtShippingPhone.Text = portal.ShippingOriginPhone; txtShippingZipCode.Text = portal.ShippingOriginZipCode; txtShippingStateCode.Text = portal.ShippingOriginStateCode; txtShippingCountryCode.Text = portal.ShippingOriginCountryCode; //Units - tab ddlWeightUnits.SelectedValue = portal.WeightUnit; ddlPackageTypeCodes.SelectedValue = portal.FedExPackagingType; ddldropOffTypes.SelectedValue = portal.FedExDropoffType; ddlDimensions.SelectedValue = portal.DimensionUnit; //set logo image imgLogo.ImageUrl = portal.LogoPath; //display tab ddlOrderStateList.SelectedValue = portal.DefaultOrderStateID.GetValueOrDefault(10).ToString(); }
/// <summary> /// Bind data to the fields /// </summary> protected void BindData() { StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin(); txtDisplayOrder.Text = "1"; //GET LIST DATA //Get payment types lstPaymentType.DataSource = settingsAdmin.GetPaymentTypes(); lstPaymentType.DataTextField = "Name"; lstPaymentType.DataValueField = "PaymentTypeID"; lstPaymentType.DataBind(); lstPaymentType.SelectedIndex = 0; //get gateways lstGateway.DataSource = settingsAdmin.GetGateways(); lstGateway.DataTextField = "GatewayName"; lstGateway.DataValueField = "GatewayTypeID"; lstGateway.DataBind(); lstGateway.SelectedIndex = 0; //get profiles lstProfile.DataSource = settingsAdmin.GetProfiles(); lstProfile.DataTextField = "Name"; lstProfile.DataValueField = "ProfileID"; lstProfile.DataBind(); lstProfile.Items.Insert(0, new ListItem("All Profiles", "-1")); lstProfile.SelectedValue = "-1"; try { if (ItemId > 0) { //get payment setting PaymentSetting paymentSetting = settingsAdmin.GetPaymentSettingByID(ItemId); txtDisplayOrder.Text = paymentSetting.DisplayOrder.ToString(); if (paymentSetting.ProfileID.HasValue) lstProfile.SelectedValue = paymentSetting.ProfileID.Value.ToString(); lstPaymentType.SelectedValue = paymentSetting.PaymentTypeID.ToString(); chkActiveInd.Checked = paymentSetting.ActiveInd; if (paymentSetting.PaymentTypeID == 0) { pnlCreditCard.Visible = true; ZNodeEncryption encrypt = new ZNodeEncryption(); txtGatewayUserName.Text = encrypt.DecryptData(paymentSetting.GatewayUsername); //if authorize.net if (paymentSetting.GatewayTypeID == 1) { txtTransactionKey.Text = encrypt.DecryptData(paymentSetting.TransactionKey); lblTransactionKey.Text = "Transaction key (Authorize.Net only)"; pnlAuthorizeNet.Visible = true; pnlPassword.Visible = false; chkTestMode.Checked = paymentSetting.TestMode; chkPreAuthorize.Checked = paymentSetting.PreAuthorize; pnlGatewayOptions.Visible = true; } //if verisign payflow pro else if (paymentSetting.GatewayTypeID == 2) { txtVendor.Text = paymentSetting.Vendor; // Vendor txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); txtPartner.Text = paymentSetting.Partner; pnlPassword.Visible = true; pnlVerisignGateway.Visible = true; chkTestMode.Checked = paymentSetting.TestMode; pnlGatewayOptions.Visible = true; } //if Nova Gateway else if (paymentSetting.GatewayTypeID == 5) { txtTransactionKey.Text = encrypt.DecryptData(paymentSetting.TransactionKey); lblTransactionKey.Text = "Pin Number (Nova gateway Only)"; pnlAuthorizeNet.Visible = true; pnlPassword.Visible = true; txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); chkTestMode.Checked = paymentSetting.TestMode; } //if NSoftware Gateway else if (paymentSetting.GatewayTypeID == 6) { txtTransactionKey.Text = paymentSetting.TransactionKey; txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); lblTransactionKey.Text = "Transaction key"; pnlAuthorizeNet.Visible = true; pnlPassword.Visible = true; chkTestMode.Checked = paymentSetting.TestMode; } else if (paymentSetting.GatewayTypeID == 9) { pnlLogin.Visible = false; pnlPassword.Visible = false; chkTestMode.Checked = paymentSetting.TestMode; } //if World Pay Gateway else if (paymentSetting.GatewayTypeID == 10) { txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); txtTransactionKey.Text = encrypt.DecryptData(paymentSetting.TransactionKey); lblGatewayUserName.Text = "Merchant Code"; lblGatewaypassword.Text = "Authorization Password"; lblTransactionKey.Text = "World Pay Installation Id"; pnlAuthorizeNet.Visible = true; pnlPassword.Visible = true; chkTestMode.Checked = paymentSetting.TestMode; } else { pnlAuthorizeNet.Visible = false; pnlPassword.Visible = true; txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); txtTransactionKey.Text = ""; chkTestMode.Checked = paymentSetting.TestMode; } lstGateway.SelectedValue = paymentSetting.GatewayTypeID.ToString(); chkEnableAmex.Checked = (bool)paymentSetting.EnableAmex; chkEnableDiscover.Checked = (bool)paymentSetting.EnableDiscover; chkEnableMasterCard.Checked = (bool)paymentSetting.EnableMasterCard; chkEnableVisa.Checked = (bool)paymentSetting.EnableVisa; //ChkEnableOfflinemode.Checked = (bool)paymentSetting.OfflineMode; //ChkEnableCreditCard.Checked = (bool)paymentSetting.SaveCreditCartInfo; } else if (paymentSetting.PaymentTypeID == 2) { pnlCreditCard.Visible = true; ZNodeEncryption encrypt = new ZNodeEncryption(); txtGatewayUserName.Text = encrypt.DecryptData(paymentSetting.GatewayUsername); txtTransactionKey.Text = paymentSetting.TransactionKey; txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); lblTransactionKey.Text = "API Signature (Paypal only)"; pnlAuthorizeNet.Visible = true; pnlPassword.Visible = true; pnlGatewayList.Visible = false; pnlCreditCardOptions.Visible = false; chkTestMode.Checked = paymentSetting.TestMode; } else if (paymentSetting.PaymentTypeID == 3) //If Google Checkout is Selected { ZNodeEncryption encrypt = new ZNodeEncryption(); txtGatewayUserName.Text = encrypt.DecryptData(paymentSetting.GatewayUsername); txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); chkTestMode.Checked = paymentSetting.TestMode; pnlCreditCardOptions.Visible = false; //Hide CreditCard Options pnlGatewayList.Visible = false; // Hide Gateway dropdownlist pnlCreditCard.Visible = true; //Enable settings pnlAuthorizeNet.Visible = false; //Disable TransactionKey field pnlPassword.Visible = true; // Enable PassWord field } else { pnlCreditCard.Visible = false; } } else { // enable credit card option by default pnlCreditCard.Visible = true; lstGateway.SelectedValue = "1"; BindPanels(); } } catch { //ignore } }