예제 #1
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        ZNodeEncryption enc = new ZNodeEncryption();

        //Rotate Key
        enc.RotateKey();

        ZNodeLogging.LogActivity(9000);

        lblMsg.Text = "Key has been successfully rotated.";
        btnCancel.Visible = false;
        btnGenerate.Visible = false;
    }
예제 #2
0
    /// <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;
        }
    }
예제 #3
0
    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;
        }
    }
예제 #4
0
    /// <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);

        }
    }
예제 #5
0
    /// <summary>
    /// Submit button click event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        IPCommerce ipc = new IPCommerce();
        IPCommerceService ipcserv = new IPCommerceService();
        ZNodeEncryption encrypt = new ZNodeEncryption();

        ipc = ipcserv.GetByPortalID(ZNodeConfigManager.SiteConfig.PortalID);

        bool recordExists = false;

        if (ipc == null)
        {
            recordExists = false;
            ipc = new IPCommerce();

            //delete config files
            string uc = Server.MapPath("~/data/default/config/ipcommerce_users.config");
            string zc = Server.MapPath("~/data/default/config/ipcommerce_znode.config");

            File.Delete(uc);
            File.Delete(zc);
        }
        else
        {
            recordExists = true;
        }

        ipc.PortalID = ZNodeConfigManager.SiteConfig.PortalID;
        ipc.IPPFSocketId = encrypt.EncryptData(SocketID.Text);
        ipc.MerchantLogin = encrypt.EncryptData(UserID.Text);
        ipc.MerchantPassword = encrypt.EncryptData(Password.Text);
        ipc.MerchantCity = txtBillingCity.Text;
        ipc.MerchantCountryCode = lstBillingCountryCode.SelectedItem.Text;
        ipc.MerchantCustServicePhone = PhoneNumber.Text;
        ipc.MerchantName = MerchantName.Text;
        ipc.MerchantPostalCode = txtBillingPostalCode.Text;
        ipc.MerchantSocketNum = SocketNumber.Text;
        ipc.MerchantStateProv = txtBillingState.Text;
        ipc.MerchantStoreId = StoreID.Text;
        ipc.MerchantStreet1 = txtBillingStreet1.Text;
        ipc.MerchantStreet2 = txtBillingStreet2.Text;
        ipc.Custom1 = SIC.Text.Trim(); // SIC Code
        ipc.Custom5 = SerialNumber.Text.Trim(); //Serial number
        ipc.Custom2 = chkCVVData.Checked.ToString();
        ipc.Custom3 = chkAVSData.Checked.ToString();

        //validate these settings with IP Commerce
        ZNode.Libraries.Payment.GatewayIPCommerce gwipc = new ZNode.Libraries.Payment.GatewayIPCommerce(ipc);

        //save to database
        if (gwipc.PaymentSolutionStatus == SecurePayments.Framework.PaymentSolutionStatus.ReadyToTransact)
        {
            Hashtable elementMapping = new Hashtable();
            // Add elements to the hash table. There are no
            // duplicate keys, which contains xpath to retrieve value from provisioned data
            elementMapping.Add("/ppbcp:MerchId", "");
            elementMapping.Add("/ppbcp:SIC", "");
            elementMapping.Add("/ppbcp:SocketNum", "");
            elementMapping.Add("/ppbcp:StoreId", "");

            //retrieve data
            gwipc.GetMerchantInfo("CREDIT", elementMapping);

            ipc.MerchantSocketNum = elementMapping["/ppbcp:SocketNum"].ToString();
            ipc.MerchantStoreId = elementMapping["/ppbcp:StoreId"].ToString();
            ipc.Custom4 = elementMapping["/ppbcp:MerchId"].ToString(); // Merchant ID

            if (recordExists)
            {
                ipcserv.Save(ipc);
            }
            else
            {
                ipcserv.Insert(ipc);
            }

            Response.Redirect("~/admin/secure/settings/default.aspx?mode=ipcommerce");
        }
        else
        {
            lblErrorMsg.Text = "Unable to configure IP Commerce Settings. Please verify the settings and try again. " + gwipc.ResponseText;
        }
    }
예제 #6
0
    /// <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);
    }
예제 #7
0
    /// <summary>
    /// Submit button click event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin();
        Portal portal = storeAdmin.GetByPortalId(ZNodeConfigManager.SiteConfig.PortalID);

        portal.AdminEmail = txtAdminEmail.Text;
        portal.CompanyName = txtCompanyName.Text;
        portal.CustomerServiceEmail = txtCustomerServiceEmail.Text;
        portal.CustomerServicePhoneNumber = txtCustomerServicePhoneNumber.Text;
        portal.DomainName = txtDomainName.Text;
        portal.MaxCatalogDisplayColumns = byte.Parse(txtMaxCatalogDisplayColumns.Text);
        portal.MaxCatalogDisplayItems = int.Parse(txtMaxCatalogDisplayItems.Text);
        portal.InclusiveTax = chkInclusiveTax.Checked;

        portal.MaxCatalogItemThumbnailWidth = int.Parse(txtMaxCatalogItemThumbnailWidth.Text);
        portal.MaxCatalogCategoryDisplayThumbnails = int.Parse(txtMaxSmallThumbnailsDisplay.Text);

        portal.SiteWideBottomJavascript = txtSiteWideBottomJavaScript.Text;
        portal.SiteWideTopJavascript = txtSiteWideTopJavaScript.Text;
        portal.SiteWideAnalyticsJavascript = txtSiteWideAnalyticsJavascript.Text;
        portal.OrderReceiptAffiliateJavascript = txtOrderReceiptJavaScript.Text;

        portal.MaxCatalogItemLargeWidth = int.Parse(txtMaxCatalogItemLargeWidth.Text);
        portal.MaxCatalogItemMediumWidth = int.Parse(txtMaxCatalogItemMediumWidth.Text);
        portal.MaxCatalogItemSmallWidth = int.Parse(txtMaxCatalogItemSmallWidth.Text);
        portal.MaxCatalogItemCrossSellWidth = int.Parse(txtMaxCatalogCrossSellWidth.Text);
        portal.MaxCatalogItemThumbnailWidth = int.Parse(txtMaxCatalogItemThumbnailWidth.Text);
        portal.MaxCatalogItemSwatchWidth = int.Parse(txtMaxCatalogItemSwatchesWidth.Text);

        portal.ShopByPriceMin = int.Parse(txtShopByPriceMin.Text);
        portal.ShopByPriceMax = int.Parse(txtShopByPriceMax.Text);
        portal.ShopByPriceIncrement = int.Parse(txtShopByPriceIncrement.Text);

        portal.SalesEmail = txtSalesEmail.Text;
        portal.SalesPhoneNumber = txtSalesPhoneNumber.Text;
        portal.StoreName = txtStoreName.Text;
        portal.UseSSL = chkEnableSSL.Checked;
        portal.DefaultReviewStatus = ListReviewStatus.SelectedValue;

        //Currency Settings
        portal.CurrencyTypeID = int.Parse(ddlCurrencyTypes.SelectedValue);

        ZNodeEncryption encrypt = new ZNodeEncryption();

        //SMTP Server Settings
        portal.SMTPServer = txtSMTPServer.Text;
        portal.SMTPUserName = encrypt.EncryptData(txtSMTPUserName.Text);
        portal.SMTPPassword = encrypt.EncryptData(txtSMTPPassword.Text);

        //UPS Shipping Settings
        portal.UPSUserName = encrypt.EncryptData(txtUPSUserName.Text.Trim());
        portal.UPSPassword = encrypt.EncryptData(txtUPSPassword.Text.Trim());
        portal.UPSKey = encrypt.EncryptData(txtUPSKey.Text.Trim());

        //FedEx Shipping Settings
        portal.FedExAccountNumber = encrypt.EncryptData(txtAccountNum.Text.Trim());
        portal.FedExMeterNumber = encrypt.EncryptData(txtMeterNum.Text.Trim());
        portal.FedExProductionKey = encrypt.EncryptData(txtProductionAccessKey.Text.Trim());
        portal.FedExSecurityCode = encrypt.EncryptData(txtSecurityCode.Text.Trim());

        //Units
        portal.WeightUnit = ddlWeightUnits.SelectedItem.Text;
        portal.DimensionUnit = ddlDimensions.SelectedItem.Text;

        //default order status setting
        portal.DefaultOrderStateID = int.Parse(ddlOrderStateList.SelectedValue);

        //Shipping Settings
        portal.ShippingOriginAddress1 = txtShippingAddress1.Text.Trim();
        portal.ShippingOriginAddress2 = txtShippingAddress2.Text.Trim();
        portal.ShippingOriginCity = txtShippingCity.Text.Trim();
        portal.ShippingOriginPhone = txtShippingPhone.Text.Trim();

        portal.ShippingOriginZipCode = txtShippingZipCode.Text.Trim();
        portal.ShippingOriginStateCode = txtShippingStateCode.Text.Trim();
        portal.ShippingOriginCountryCode = txtShippingCountryCode.Text.Trim();

        portal.FedExDropoffType = ddldropOffTypes.SelectedItem.Value;
        portal.FedExPackagingType = ddlPackageTypeCodes.SelectedItem.Value;
        portal.FedExUseDiscountRate = chkFedExDiscountRate.Checked;
        portal.FedExAddInsurance = chkAddInsurance.Checked;

        // set logo path
        System.IO.FileInfo _FileInfo = null;

        if (radNewImage.Checked == true)
        {
            //Check for Product Image
            _FileInfo = new System.IO.FileInfo(UploadImage.PostedFile.FileName);

            if (_FileInfo != null)
            {
                if ((_FileInfo.Extension == ".jpeg") || (_FileInfo.Extension.Equals(".jpg")) || (_FileInfo.Extension.Equals(".png")) || (_FileInfo.Extension.Equals(".gif")))
                {
                    portal.LogoPath = ZNodeConfigManager.EnvironmentConfig.ContentPath + _FileInfo.Name;
                    UploadImage.SaveAs(Server.MapPath(ZNodeConfigManager.EnvironmentConfig.ContentPath + _FileInfo.Name));
                }
                else
                {
                    lblImageError.Text = "Select a valid jpg, gif or png image.";
                    return;
                }
            }
        }

        bool ret = storeAdmin.Update(portal);

        //Set currency
        CurrencyType currencyType  = storeAdmin.GetByCurrencyTypeID(int.Parse(ddlCurrencyTypes.SelectedValue));
        if(currencyType !=null)
        {
            currencyType.CurrencySuffix = txtCurrencySuffix.Text.Trim();
            storeAdmin.UpdateCurrencyType(currencyType);
        }

        //remove the siteconfig from session
        ZNodeConfigManager.SiteConfig = null;

        if (!ret)
        {
            lblMsg.Text = "An error ocurred while updating the store settings. Please try again.";

            //Log Activity
            ZNode.Libraries.Framework.Business.ZNodeLogging.LogActivity(9002, HttpContext.Current.User.Identity.Name);

        }
        else
        {
            HttpContext.Current.Application["CurrencyTypeCache"] = currencyType;
            Response.Redirect("~/admin/secure/default.aspx");

            //Log Activity
            ZNode.Libraries.Framework.Business.ZNodeLogging.LogActivity(9001, HttpContext.Current.User.Identity.Name);

        }
    }
예제 #8
0
    /// <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();
    }
예제 #9
0
    /// <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
        }
    }
예제 #10
0
    /// <summary>
    /// Submit button click event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin();
        PaymentSetting paymentSetting = new PaymentSetting();

        //If edit mode then retrieve data first
        if (ItemId > 0)
        {
            paymentSetting = settingsAdmin.GetPaymentSettingByID(ItemId);

            if (paymentSetting.ProfileID.HasValue)
            {
                if ((paymentSetting.ProfileID != int.Parse(lstProfile.SelectedValue)) || (paymentSetting.PaymentTypeID != int.Parse(lstPaymentType.SelectedValue)))
                {
                    //check if this setting already exists for this profile
                    bool settingExists = PaymentSettingExists();

                    if (settingExists)
                    {
                        lblMsg.Text = "This Payment Option already exists for this Profile. Please select a different Payment Option.";
                        return;
                    }
                }
            }
            else
            {
                if (lstProfile.SelectedValue != "-1")
                {
                    //check if this setting already exists for this profile
                    bool settingExists = PaymentSettingExists();

                    if (settingExists)
                    {
                        lblMsg.Text = "This Payment Option already exists for this Profile. Please select a different Payment Option.";
                        return;
                    }
                }
            }
        }

        //set values based on user input
        paymentSetting.ActiveInd = chkActiveInd.Checked;
        paymentSetting.PaymentTypeID = int.Parse(lstPaymentType.SelectedValue);
        if (lstProfile.SelectedValue == "-1")
        {
            paymentSetting.ProfileID = null;//If All profiles is selected
        }
        else
        {
            paymentSetting.ProfileID = int.Parse(lstProfile.SelectedValue);
        }
        paymentSetting.DisplayOrder = Convert.ToInt32(txtDisplayOrder.Text);
        //paymentSetting.OfflineMode = false;

        //if credit card
        if (paymentSetting.PaymentTypeID == 0)
        {
            paymentSetting.GatewayTypeID = int.Parse(lstGateway.SelectedValue);

            paymentSetting.EnableAmex = chkEnableAmex.Checked;
            paymentSetting.EnableDiscover = chkEnableDiscover.Checked;
            paymentSetting.EnableMasterCard = chkEnableMasterCard.Checked;
            paymentSetting.EnableVisa = chkEnableVisa.Checked;
            paymentSetting.TestMode = chkTestMode.Checked;
            paymentSetting.PreAuthorize = chkPreAuthorize.Checked;
            paymentSetting.GatewayPassword = string.Empty;
            paymentSetting.TransactionKey = string.Empty;

            ZNodeEncryption encrypt = new ZNodeEncryption();

            paymentSetting.GatewayUsername = encrypt.EncryptData(txtGatewayUserName.Text);

            //if authorize.net
            if (paymentSetting.GatewayTypeID == 1)
            {
                paymentSetting.TransactionKey = encrypt.EncryptData(txtTransactionKey.Text);
            }
            //If Verisign PayFlow pro gateway is selected
            else if (paymentSetting.GatewayTypeID == 2)
            {
                paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
                paymentSetting.Partner = txtPartner.Text.Trim();
                paymentSetting.Vendor = txtVendor.Text.Trim();
            }
            //If Nova gateway is selected
            else if (paymentSetting.GatewayTypeID == 5)
            {
                paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
                paymentSetting.TransactionKey = encrypt.EncryptData(txtTransactionKey.Text);
            }
            //If Paypal direct payment gateway is selected
            else if (paymentSetting.GatewayTypeID == 6)
            {
                paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
                paymentSetting.TransactionKey = txtTransactionKey.Text;
            }
            // If World Pay gateway is selected
            else if (paymentSetting.GatewayTypeID == 10)
            {
                // Authorization password
                paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
                // Installation Id
                paymentSetting.TransactionKey = encrypt.EncryptData(txtTransactionKey.Text);
            }
            else
            {
                paymentSetting.TransactionKey = "";
                paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
            }
        }
        // if Paypal
        else if (paymentSetting.PaymentTypeID == 2)
        {
            paymentSetting.GatewayTypeID = null;
            ZNodeEncryption encrypt = new ZNodeEncryption();

            paymentSetting.GatewayUsername = encrypt.EncryptData(txtGatewayUserName.Text);
            paymentSetting.TransactionKey = txtTransactionKey.Text;
            paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
            paymentSetting.TestMode = chkTestMode.Checked;

        }
            //if Google Checkout
        else if (paymentSetting.PaymentTypeID == 3)
        {
            paymentSetting.GatewayTypeID = null; //Set null value to Google
            ZNodeEncryption encrypt = new ZNodeEncryption();

            paymentSetting.GatewayUsername = encrypt.EncryptData(txtGatewayUserName.Text);
            paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text);
            paymentSetting.TestMode = chkTestMode.Checked;
        }
        else // Purchase Order
        {
            paymentSetting.GatewayTypeID = null;
        }

        bool retval = false;

        //Update Payment setting into database
        if (ItemId > 0)
        {
            retval = settingsAdmin.UpdatePaymentSetting(paymentSetting);
        }
        else
        {
            bool settingExists = settingsAdmin.PaymentSettingExists(int.Parse(lstProfile.SelectedValue), int.Parse(lstPaymentType.SelectedValue));

            if (settingExists)
            {
                lblMsg.Text = "This Payment Option already exists for this Profile. Please select a different Payment Option.";
                return;
            }

            retval = settingsAdmin.AddPaymentSetting(paymentSetting);
        }

        if (retval)
        {
            //redirect to main page
            Response.Redirect("~/admin/secure/settings/payment/");
        }
        else
        {
            //display error message
            lblMsg.Text = "An error occurred while updating. Please try again.";
        }
    }