Exemple #1
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            masterSettings.EnableAliOHAliPay = this.radEnableWapAliPay.SelectedValue;
            SettingsManager.Save(masterSettings);
            string          text        = string.Format("<xml><Partner>{0}</Partner><Key>{1}</Key><Seller_account_name>{2}</Seller_account_name></xml>", this.txtPartner.Text, this.txtKey.Text, this.txtAccount.Text);
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");

            if (paymentMode == null)
            {
                PaymentModeInfo info2 = new PaymentModeInfo {
                    Name            = "支付宝手机网页支付",
                    Gateway         = "hishop.plugins.payment.ws_wappay.wswappayrequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    Charge          = 0M,
                    IsPercent       = false,
                    ApplicationType = PayApplicationType.payOnWAP,
                    Settings        = HiCryptographer.Encrypt(text)
                };
                SalesHelper.CreatePaymentMode(info2);
            }
            else
            {
                PaymentModeInfo info4 = paymentMode;
                info4.Settings        = HiCryptographer.Encrypt(text);
                info4.ApplicationType = PayApplicationType.payOnWAP;
                SalesHelper.UpdatePaymentMode(info4);
            }
            this.ShowMsg("修改成功", true);
        }
Exemple #2
0
        private void btnChangeEmailSettings_Click(object sender, EventArgs e)
        {
            string       text           = default(string);
            ConfigData   configData     = this.LoadConfig(out text);
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (string.IsNullOrEmpty(text) || configData == null)
            {
                masterSettings.EmailSender   = string.Empty;
                masterSettings.EmailSettings = string.Empty;
            }
            else
            {
                if (!configData.IsValid)
                {
                    string text2 = "";
                    foreach (string errorMsg in configData.ErrorMsgs)
                    {
                        text2 += Formatter.FormatErrorMessage(errorMsg);
                    }
                    this.ShowMsg(text2, false);
                    return;
                }
                masterSettings.EmailSender   = text;
                masterSettings.EmailSettings = HiCryptographer.Encrypt(configData.SettingsXml);
            }
            SettingsManager.Save(masterSettings);
            this.Page.Response.Redirect(Globals.GetAdminAbsolutePath("tools/SendMessageTemplets.aspx"));
        }
Exemple #3
0
 private void btnChangeEmailSettings_Click(object sender, EventArgs e)
 {
     string str;
     ConfigData data = this.LoadConfig(out str);
     SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
     if (string.IsNullOrEmpty(str) || (data == null))
     {
         masterSettings.EmailSender = string.Empty;
         masterSettings.EmailSettings = string.Empty;
     }
     else
     {
         if (!data.IsValid)
         {
             string msg = "";
             foreach (string str3 in data.ErrorMsgs)
             {
                 msg = msg + Formatter.FormatErrorMessage(str3);
             }
             this.ShowMsg(msg, false);
             return;
         }
         masterSettings.EmailSender = str;
         masterSettings.EmailSettings = HiCryptographer.Encrypt(data.SettingsXml);
     }
     SettingsManager.Save(masterSettings);
     this.ShowMsg("配置成功", true);
 }
Exemple #4
0
        public string CreateVerifyCode(int length)
        {
            string text   = string.Empty;
            Random random = new Random();

            while (text.Length < length)
            {
                char ch;
                int  num = random.Next();
                if ((num % 3) == 0)
                {
                    ch = (char)(0x61 + ((ushort)(num % 0x1a)));
                }
                else if ((num % 4) == 0)
                {
                    ch = (char)(0x41 + ((ushort)(num % 0x1a)));
                }
                else
                {
                    ch = (char)(0x30 + ((ushort)(num % 10)));
                }
                if (((((ch != '0') && (ch != 'o')) && ((ch != '1') && (ch != '7'))) && (((ch != 'l') && (ch != '9')) && (ch != 'g'))) && (ch != 'I'))
                {
                    text = text + ch.ToString();
                }
            }
            this.RemoveVerifyCookie();
            HttpCookie cookie = new HttpCookie(this.verifyCodeKey)
            {
                Value = HiCryptographer.Encrypt(text)
            };

            HttpContext.Current.Response.Cookies.Add(cookie);
            return(text);
        }
Exemple #5
0
        public static bool IsHavePermission(RolePermissionInfo model)
        {
            string text = HiCache.Get(string.Format("DataCache-RolePermissions-{0}", model.RoleId)) as string;
            List <RolePermissionInfo> list = new List <RolePermissionInfo>();

            if (!string.IsNullOrEmpty(text))
            {
                string value = HiCryptographer.Decrypt(text);
                list = JsonConvert.DeserializeObject <List <RolePermissionInfo> >(value);
            }
            if (list == null || list.Count == 0)
            {
                list = new RolePermissionDao().GetPermissionsByRoleId(model.RoleId);
                string obj = HiCryptographer.Encrypt(JsonConvert.SerializeObject(list));
                HiCache.Insert(string.Format("DataCache-RolePermissions-{0}", model.RoleId), obj, 360, CacheItemPriority.Normal);
            }
            bool result;

            if (list == null || list.Count == 0)
            {
                result = false;
            }
            else
            {
                RolePermissionInfo rolePermissionInfo = list.FirstOrDefault((RolePermissionInfo p) => p.PermissionId == model.PermissionId);
                result = (rolePermissionInfo != null);
            }
            return(result);
        }
Exemple #6
0
        private void btnSaveSMSSettings_Click(object sender, System.EventArgs e)
        {
            string       text;
            ConfigData   configData     = this.LoadConfig(out text);
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            if (string.IsNullOrEmpty(text) || configData == null)
            {
                masterSettings.SMSSender   = string.Empty;
                masterSettings.SMSSettings = string.Empty;
            }
            else
            {
                if (!configData.IsValid)
                {
                    string text2 = "";
                    foreach (string current in configData.ErrorMsgs)
                    {
                        text2 += Formatter.FormatErrorMessage(current);
                    }
                    this.ShowMsg(text2, false);
                    return;
                }
                masterSettings.SMSSender   = text;
                masterSettings.SMSSettings = HiCryptographer.Encrypt(configData.SettingsXml);
            }
            SettingsManager.Save(masterSettings);
            this.ShowMsg("设置成功", true);
        }
Exemple #7
0
        private void btnSaveSMSSettings_Click(object sender, System.EventArgs e)
        {
            string     text;
            ConfigData configData = this.LoadConfig(out text);

            Hidistro.Membership.Context.SiteSettings masterSettings = Hidistro.Membership.Context.SettingsManager.GetMasterSettings(false);
            if (!string.IsNullOrEmpty(text) && configData != null)
            {
                if (!configData.IsValid)
                {
                    string text2 = "";
                    foreach (string current in configData.ErrorMsgs)
                    {
                        text2 += Formatter.FormatErrorMessage(current);
                    }
                    this.ShowMsg(text2, false);
                    return;
                }
                masterSettings.SMSSender   = text;
                masterSettings.SMSSettings = HiCryptographer.Encrypt(configData.SettingsXml);
            }
            else
            {
                masterSettings.SMSSender   = string.Empty;
                masterSettings.SMSSettings = string.Empty;
            }
            Hidistro.Membership.Context.SettingsManager.Save(masterSettings);
            this.Page.Response.Redirect(Globals.GetAdminAbsolutePath("tools/SendMessageTemplets.aspx"));
        }
        private void btnChangeEmailSettings_Click(object sender, System.EventArgs e)
        {
            string     text;
            ConfigData configData = this.LoadConfig(out text);

            Hidistro.Membership.Context.SiteSettings siteSettings = Hidistro.Membership.Context.SettingsManager.GetSiteSettings(Hidistro.Membership.Context.HiContext.Current.User.UserId);
            if (!string.IsNullOrEmpty(text) && configData != null)
            {
                if (!configData.IsValid)
                {
                    string text2 = "";
                    foreach (string current in configData.ErrorMsgs)
                    {
                        text2 += Formatter.FormatErrorMessage(current);
                    }
                    this.ShowMsg(text2, false);
                    return;
                }
                siteSettings.EmailSender   = text;
                siteSettings.EmailSettings = HiCryptographer.Encrypt(configData.SettingsXml);
            }
            else
            {
                siteSettings.EmailSender   = string.Empty;
                siteSettings.EmailSettings = string.Empty;
            }
            Hidistro.Membership.Context.SettingsManager.Save(siteSettings);
            this.Page.Response.Redirect(Globals.ApplicationPath + "/Shopadmin/tools/MySendMessageTemplets.aspx");
        }
Exemple #9
0
        private void btnSaveSMSSettings_Click(object sender, EventArgs e)
        {
            string       str;
            ConfigData   data           = this.LoadConfig(out str);
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            if (string.IsNullOrEmpty(str) || (data == null))
            {
                masterSettings.SMSSender   = string.Empty;
                masterSettings.SMSSettings = string.Empty;
            }
            else
            {
                if (!data.IsValid)
                {
                    string msg = "";
                    foreach (string str3 in data.ErrorMsgs)
                    {
                        msg = msg + Formatter.FormatErrorMessage(str3);
                    }
                    this.ShowMsg(msg, false);
                    return;
                }
                masterSettings.SMSSender   = str;
                masterSettings.SMSSettings = HiCryptographer.Encrypt(data.SettingsXml);
            }
            SettingsManager.Save(masterSettings);
            this.Page.Response.Redirect(Globals.GetAdminAbsolutePath("tools/SendMessageTemplets.aspx"));
        }
Exemple #10
0
        public static bool IsHavePermission(RolePermissionInfo model)
        {
            bool   flag;
            string str = HiCache.Get(string.Format("DataCache-RolePermissions-{0}", model.RoleId)) as string;
            List <RolePermissionInfo> rolePermissionInfos = new List <RolePermissionInfo>();

            if (!string.IsNullOrEmpty(str))
            {
                rolePermissionInfos = JsonConvert.DeserializeObject <List <RolePermissionInfo> >(HiCryptographer.Decrypt(str));
            }
            if ((rolePermissionInfos == null ? true : rolePermissionInfos.Count == 0))
            {
                rolePermissionInfos = (new RolePermissionDao()).GetPermissionsByRoleId(model.RoleId);
                string str1 = HiCryptographer.Encrypt(JsonConvert.SerializeObject(rolePermissionInfos));
                HiCache.Insert(string.Format("DataCache-RolePermissions-{0}", model.RoleId), str1, 360, CacheItemPriority.Normal);
            }
            if ((rolePermissionInfos == null ? false : rolePermissionInfos.Count != 0))
            {
                RolePermissionInfo rolePermissionInfo = rolePermissionInfos.FirstOrDefault <RolePermissionInfo>((RolePermissionInfo p) => p.PermissionId == model.PermissionId);
                flag = rolePermissionInfo != null;
            }
            else
            {
                flag = false;
            }
            return(flag);
        }
Exemple #11
0
        protected void btnOK_Click(object sender, System.EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            masterSettings.EnableAppShengPay = this.radEnableAppShengPay.SelectedValue;
            SettingsManager.Save(masterSettings);
            string          text        = string.Format("<xml><SenderId>{0}</SenderId><SellerKey>{1}</SellerKey><Seller_account_name></Seller_account_name></xml>", this.txtPartner.Text, this.txtKey.Text);
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("Ecdev.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest");

            if (paymentMode == null)
            {
                PaymentModeInfo paymentMode2 = new PaymentModeInfo
                {
                    Name            = "盛付通手机网页支付",
                    Gateway         = "Ecdev.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    Charge          = 0m,
                    IsPercent       = false,
                    ApplicationType = PayApplicationType.payOnWAP,
                    Settings        = HiCryptographer.Encrypt(text)
                };
                SalesHelper.CreatePaymentMode(paymentMode2);
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentMode;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.ApplicationType = PayApplicationType.payOnWAP;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }
            this.ShowMsg("修改成功", true);
        }
Exemple #12
0
        private void btnChangeEmailSettings_Click(object sender, EventArgs e)
        {
            string       str;
            ConfigData   data         = this.LoadConfig(out str);
            SiteSettings siteSettings = SettingsManager.GetSiteSettings(HiContext.Current.User.UserId);

            if (string.IsNullOrEmpty(str) || (data == null))
            {
                siteSettings.EmailSender   = string.Empty;
                siteSettings.EmailSettings = string.Empty;
            }
            else
            {
                if (!data.IsValid)
                {
                    string msg = "";
                    foreach (string str3 in data.ErrorMsgs)
                    {
                        msg = msg + Formatter.FormatErrorMessage(str3);
                    }
                    this.ShowMsg(msg, false);
                    return;
                }
                siteSettings.EmailSender   = str;
                siteSettings.EmailSettings = HiCryptographer.Encrypt(data.SettingsXml);
            }
            SettingsManager.Save(siteSettings);
            this.Page.Response.Redirect(Globals.ApplicationPath + "/Shopadmin/tools/MySendMessageTemplets.aspx");
        }
Exemple #13
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (this.radEnableWapBankUnionPay.SelectedValue)
            {
                if (string.IsNullOrEmpty(this.txtPartner.Text))
                {
                    this.ShowMsg("商户号不能为空", false);
                    return;
                }
                if (string.IsNullOrEmpty(this.txtKey.Text))
                {
                    this.ShowMsg("证书密码不能为空", false);
                    return;
                }
            }
            masterSettings.EnableAPPBankUnionPay = this.radEnableWapBankUnionPay.SelectedValue;
            SettingsManager.Save(masterSettings);
            string arg = this.txtCerFileName.Text;

            if (this.fileBankUnionCert.HasFile)
            {
                if (!Globals.ValidateCertFile(this.fileBankUnionCert.PostedFile.FileName))
                {
                    this.ShowMsg("非法的证书文件", false);
                    return;
                }
                this.fileBankUnionCert.PostedFile.SaveAs(base.Server.MapPath("~/config/") + this.fileBankUnionCert.PostedFile.FileName);
                arg = this.fileBankUnionCert.PostedFile.FileName;
            }
            string          text        = $"<xml><Vmid>{this.txtPartner.Text.Trim()}</Vmid><SignCertFileName>{arg}</SignCertFileName><Key>{this.txtKey.Text.Trim()}</Key></xml>";
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest");

            if (paymentMode == null)
            {
                PaymentModeInfo paymentMode2 = new PaymentModeInfo
                {
                    Name            = "银联全渠道支付",
                    Gateway         = "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    ApplicationType = PayApplicationType.payOnPC,
                    Settings        = HiCryptographer.Encrypt(text)
                };
                SalesHelper.CreatePaymentMode(paymentMode2);
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentMode;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.ApplicationType = PayApplicationType.payOnPC;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }
            this.ShowMsg("修改成功", true, "");
        }
Exemple #14
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            HttpCookie httpCookie = new HttpCookie("ChangPassword");

            httpCookie.HttpOnly = true;
            httpCookie.Value    = HiCryptographer.Encrypt(this.txtCellPhone.Value.Trim());
            httpCookie.Expires  = DateTime.Now.AddMinutes(20.0);
            HttpContext.Current.Response.Cookies.Add(httpCookie);
            this.Page.Response.Redirect("ChangePassword.aspx", true);
        }
Exemple #15
0
        public void WriteUserCookie(string UserName, int days)
        {
            HttpCookie cookie = new HttpCookie("Vshop-Member")
            {
                Value = HiCryptographer.Encrypt(Globals.UrlEncode(UserName))
            };

            if (days > 0)
            {
                cookie.Expires = DateTime.Now.AddDays((double)days);
            }
            HttpContext.Current.Response.Cookies.Add(cookie);
        }
Exemple #16
0
        protected void btnOK_Click(object sender, System.EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            masterSettings.EnableAliOHAliPay = this.radEnableWapAliPay.SelectedValue;
            SettingsManager.Save(masterSettings);
            string text = string.Format("<xml><Partner>{0}</Partner><Key>{1}</Key><Seller_account_name>{2}</Seller_account_name></xml>", this.txtPartner.Text, this.txtKey.Text, this.txtAccount.Text);
            //bool flag = !string.IsNullOrWhiteSpace(this.txtPartner.Text) && !string.IsNullOrWhiteSpace(this.txtKey.Text) && !string.IsNullOrWhiteSpace(this.txtAccount.Text);
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");

            if (paymentMode == null)
            {
                PaymentModeInfo info2 = new PaymentModeInfo
                {
                    Name        = "支付宝手机支付",
                    Gateway     = "hishop.plugins.payment.ws_wappay.wswappayrequest",
                    Description = string.Empty,
                    IsUseInpour = true,
                    Charge      = 0m,
                    IsPercent   = false,
                    Settings    = HiCryptographer.Encrypt(text)
                };
                if (SalesHelper.CreatePaymentMode(info2) == PaymentModeActionStatus.Success)
                {
                    //SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    //masterSettings.EnableAlipayRequest = flag;
                    //SettingsManager.Save(masterSettings);
                    this.ShowMsg("设置成功", true);
                }
                else
                {
                    this.ShowMsg("设置失败", false);
                }
            }
            else
            {
                paymentMode.Settings = HiCryptographer.Encrypt(text);


                if (SalesHelper.UpdatePaymentMode(paymentMode) == PaymentModeActionStatus.Success)
                {
                    this.ShowMsg("设置成功", true);
                }
                else
                {
                    this.ShowMsg("设置失败", false);
                }
            }
        }
Exemple #17
0
        public static bool UpdatePaymentModeSync(PaymentModeInfo paymentMode, out string msg)
        {
            if (paymentMode == null)
            {
                msg = "修改失败";
                return(false);
            }
            string      empty       = string.Empty;
            string      xml         = HiCryptographer.Decrypt(paymentMode.Settings);
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.XmlResolver = null;
            xmlDocument.LoadXml(xml);
            int    num     = 0;
            string gateway = paymentMode.Gateway;

            if (!(gateway == "hishop.plugins.payment.alipaywx.alipaywxrequest"))
            {
                if (gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                {
                    empty = string.Format("<xml><Partner>{0}</Partner><Key>{1}</Key><SellerEmail>{2}</SellerEmail></xml>", xmlDocument.GetElementsByTagName("Partner")[0].InnerText, xmlDocument.GetElementsByTagName("Key")[0].InnerText, xmlDocument.GetElementsByTagName("Seller_account_name")[0].InnerText);
                    Globals.EntityCoding(paymentMode, true);
                    num += (new PaymentModeDao().Update(paymentMode, null) ? 1 : 0);
                    PaymentModeInfo paymentMode2 = SalesHelper.GetPaymentMode("hishop.plugins.payment.alipaywx.alipaywxrequest");
                    if (paymentMode2 != null)
                    {
                        paymentMode2.Settings        = HiCryptographer.Encrypt(empty);
                        paymentMode2.ApplicationType = PayApplicationType.payOnVX;
                        num += (new PaymentModeDao().Update(paymentMode2, null) ? 1 : 0);
                    }
                }
            }
            else
            {
                empty = string.Format("<xml><Partner>{0}</Partner><Key>{1}</Key><Seller_account_name>{2}</Seller_account_name></xml>", xmlDocument.GetElementsByTagName("Partner")[0].InnerText, xmlDocument.GetElementsByTagName("Key")[0].InnerText, xmlDocument.GetElementsByTagName("SellerEmail")[0].InnerText);
                Globals.EntityCoding(paymentMode, true);
                num += (new PaymentModeDao().Update(paymentMode, null) ? 1 : 0);
                PaymentModeInfo paymentMode3 = SalesHelper.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");
                if (paymentMode3 != null)
                {
                    paymentMode3.Settings        = HiCryptographer.Encrypt(empty);
                    paymentMode3.ApplicationType = PayApplicationType.payOnWAP;
                    num += (new PaymentModeDao().Update(paymentMode3, null) ? 1 : 0);
                }
            }
            msg = ((num > 0) ? ((num == 1) ? "修改成功,同步失败" : "修改成功") : "修改失败");
            return(num > 0);
        }
Exemple #18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ConfigData data;

            if (this.ValidateValues(out data))
            {
                OpenIdSettingsInfo info2 = new OpenIdSettingsInfo();
                info2.Name        = this.txtName.Text.Trim();
                info2.Description = this.fcContent.Text;
                info2.OpenIdType  = this.openIdType;
                info2.Settings    = HiCryptographer.Encrypt(data.SettingsXml);
                OpenIdSettingsInfo settings = info2;
                SubSiteOpenIdHelper.SaveSettings(settings);
                base.Response.Redirect("openidservices.aspx");
            }
        }
        public static bool IsHavePermission(RolePermissionInfo model)
        {
            string str = HiCache.Get(string.Format("DataCache-RolePermissions-{0}", model.RoleId)) as string;
            List <RolePermissionInfo> permissionsByRoleId = new List <RolePermissionInfo>();

            if (!string.IsNullOrEmpty(str))
            {
                permissionsByRoleId = JsonConvert.DeserializeObject <List <RolePermissionInfo> >(HiCryptographer.Decrypt(str));
            }
            if ((permissionsByRoleId == null) || (permissionsByRoleId.Count == 0))
            {
                permissionsByRoleId = new RolePermissionDao().GetPermissionsByRoleId(model.RoleId);
                string str3 = HiCryptographer.Encrypt(JsonConvert.SerializeObject(permissionsByRoleId));
                HiCache.Insert(string.Format("DataCache-RolePermissions-{0}", model.RoleId), str3, 360, CacheItemPriority.Normal);
            }
            return(((permissionsByRoleId != null) && (permissionsByRoleId.Count != 0)) && (permissionsByRoleId.FirstOrDefault <RolePermissionInfo>(p => (p.PermissionId == model.PermissionId)) != null));
        }
Exemple #20
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ConfigData configData = default(ConfigData);

            if (this.ValidateValues(out configData))
            {
                OpenIdSettingInfo settings = new OpenIdSettingInfo
                {
                    Name        = this.txtName.Text.Trim(),
                    Description = this.fcContent.Text,
                    OpenIdType  = this.openIdType,
                    Settings    = HiCryptographer.Encrypt(configData.SettingsXml)
                };
                OpenIdHelper.SaveSettings(settings);
                base.Response.Redirect("openidservices.aspx");
            }
        }
Exemple #21
0
        public static SiteSettings EncrySettings(SiteSettings settings)
        {
            PropertyInfo[] properties = settings.GetType().GetProperties();
            Type           type       = settings.GetType();

            PropertyInfo[] array = properties;
            foreach (PropertyInfo propertyInfo in array)
            {
                MethodInfo getMethod = propertyInfo.GetGetMethod();
                if (getMethod != (MethodInfo)null && getMethod.IsPublic && propertyInfo.CanWrite)
                {
                    object[] customAttributes = propertyInfo.GetCustomAttributes(false);
                    if (customAttributes != null && customAttributes.Length != 0)
                    {
                        for (int j = 0; j < customAttributes.Length; j++)
                        {
                            if (customAttributes[j].GetType() == typeof(GlobalCodeAttribute))
                            {
                                GlobalCodeAttribute globalCodeAttribute = (GlobalCodeAttribute)customAttributes[j];
                                if (globalCodeAttribute != null && propertyInfo.PropertyType == typeof(string))
                                {
                                    if (globalCodeAttribute.IsEncryption)
                                    {
                                        propertyInfo.SetValue(settings, HiCryptographer.Encrypt(getMethod.Invoke(settings, new object[0]).ToNullString()), null);
                                    }
                                    else if (globalCodeAttribute.IsHtmlCode)
                                    {
                                        propertyInfo.SetValue(settings, Globals.HtmlEncode(getMethod.Invoke(settings, new object[0]).ToNullString()), null);
                                    }
                                    else if (globalCodeAttribute.IsUrlEncode)
                                    {
                                        propertyInfo.SetValue(settings, Globals.UrlEncode(getMethod.Invoke(settings, new object[0]).ToNullString()), null);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        propertyInfo.SetValue(settings, getMethod.Invoke(settings, new object[0]), null);
                    }
                }
            }
            return(settings);
        }
Exemple #22
0
        private void btnCreate_Click(object sender, System.EventArgs e)
        {
            string     gateway;
            ConfigData configData;
            decimal    charge;

            if (!this.ValidateValues(out gateway, out configData, out charge))
            {
                return;
            }
            PaymentModeInfo paymentMode = new PaymentModeInfo
            {
                Name               = this.txtName.Text,
                Description        = this.fcContent.Text.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""),
                Gateway            = gateway,
                IsUseInpour        = this.radiIsUseInpour.SelectedValue,
                IsUseInDistributor = this.radiIsUseInDistributor.SelectedValue,
                Charge             = charge,
                IsPercent          = this.chkIsPercent.Checked,
                Settings           = HiCryptographer.Encrypt(configData.SettingsXml)
            };
            PaymentModeActionStatus paymentModeActionStatus = SalesHelper.CreatePaymentMode(paymentMode);

            if (paymentModeActionStatus == PaymentModeActionStatus.Success)
            {
                base.Response.Redirect(Globals.GetAdminAbsolutePath("sales/PaymentTypes.aspx"));
                return;
            }
            if (paymentModeActionStatus == PaymentModeActionStatus.DuplicateGateway)
            {
                this.ShowMsg("已经添加了一个相同类型的支付接口", false);
                return;
            }
            if (paymentModeActionStatus == PaymentModeActionStatus.DuplicateName)
            {
                this.ShowMsg("已经存在一个相同的支付方式名称", false);
                return;
            }
            if (paymentModeActionStatus == PaymentModeActionStatus.OutofNumber)
            {
                this.ShowMsg("支付方式的数目已经超出系统设置的数目", false);
                return;
            }
            this.ShowMsg("未知错误", false);
        }
Exemple #23
0
        private void btnUpdate_Click(object sender, System.EventArgs e)
        {
            string     str;
            ConfigData data;
            decimal    num;

            if (this.ValidateValues(out str, out data, out num))
            {
                PaymentModeInfo paymentMode = new PaymentModeInfo
                {
                    ModeId             = this.modeId,
                    Name               = this.txtName.Text.Trim(),
                    Description        = this.fcContent.Text.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""),
                    Gateway            = str,
                    IsUseInpour        = this.radiIsUseInpour.SelectedValue,
                    IsUseInDistributor = this.radiIsUseInDistributor.SelectedValue,
                    Charge             = num,
                    IsPercent          = this.chkIsPercent.Checked,
                    Settings           = HiCryptographer.Encrypt(data.SettingsXml)
                };
                PaymentModeActionStatus paymentModeActionStatus = SalesHelper.UpdatePaymentMode(paymentMode);
                switch (paymentModeActionStatus)
                {
                case PaymentModeActionStatus.Success:
                    base.Response.Redirect(Globals.GetAdminAbsolutePath("sales/PaymentTypes.aspx"));
                    break;

                case PaymentModeActionStatus.DuplicateName:
                    this.ShowMsg("已经存在一个相同的支付方式名称", false);
                    break;

                case PaymentModeActionStatus.OutofNumber:
                    this.ShowMsg("支付方式的数目已经超出系统设置的数目", false);
                    break;

                default:
                    if (paymentModeActionStatus == PaymentModeActionStatus.UnknowError)
                    {
                        this.ShowMsg("未知错误", false);
                    }
                    break;
                }
            }
        }
Exemple #24
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (this.radEnableAppShengPay.SelectedValue)
            {
                if (string.IsNullOrEmpty(this.txtPartner.Text))
                {
                    this.ShowMsg("商户号不能为空", false);
                    return;
                }
                if (string.IsNullOrEmpty(this.txtKey.Text))
                {
                    this.ShowMsg("商户密钥不能为空", false);
                    return;
                }
            }
            masterSettings.EnableAppShengPay = this.radEnableAppShengPay.SelectedValue;
            SettingsManager.Save(masterSettings);
            string          text        = $"<xml><SenderId>{this.txtPartner.Text}</SenderId><SellerKey>{this.txtKey.Text}</SellerKey><Seller_account_name></Seller_account_name></xml>";
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest");

            if (paymentMode == null)
            {
                PaymentModeInfo paymentMode2 = new PaymentModeInfo
                {
                    Name            = "盛付通手机网页支付",
                    Gateway         = "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    ApplicationType = PayApplicationType.payOnWAP,
                    Settings        = HiCryptographer.Encrypt(text)
                };
                SalesHelper.CreatePaymentMode(paymentMode2);
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentMode;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.ApplicationType = PayApplicationType.payOnWAP;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }
            this.ShowMsg("修改成功", true);
        }
        private void btnUpdate_Click(object sender, System.EventArgs e)
        {
            string     gateway;
            ConfigData configData;
            decimal    charge;

            if (!this.ValidateValues(out gateway, out configData, out charge))
            {
                return;
            }
            PaymentModeInfo paymentMode = new PaymentModeInfo
            {
                ModeId      = this.modeId,
                Name        = this.txtName.Text,
                Description = this.fcContent.Text.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""),
                Gateway     = gateway,
                IsUseInpour = this.radiIsUseInpour.SelectedValue,
                Charge      = charge,
                IsPercent   = this.chkIsPercent.Checked,
                Settings    = HiCryptographer.Encrypt(configData.SettingsXml)
            };
            PaymentModeActionStatus paymentModeActionStatus = SubsiteSalesHelper.UpdatePaymentMode(paymentMode);

            if (paymentModeActionStatus == PaymentModeActionStatus.Success)
            {
                this.ShowMsg("成功修改了当前支付方式", true);
                return;
            }
            if (paymentModeActionStatus == PaymentModeActionStatus.DuplicateName)
            {
                this.ShowMsg("已经存在一个相同的支付方式名称", false);
                return;
            }
            if (paymentModeActionStatus == PaymentModeActionStatus.OutofNumber)
            {
                this.ShowMsg("支付方式的数目已经超出系统设置的数目", false);
                return;
            }
            if (paymentModeActionStatus == PaymentModeActionStatus.UnknowError)
            {
                this.ShowMsg("未知错误", false);
            }
        }
Exemple #26
0
        public static void SetCurrentUser(int userId, int days, bool updateLoginStatus = true, bool isPCLogin = false)
        {
            HttpCookie httpCookie = new HttpCookie("Shop-Member");

            if (isPCLogin)
            {
                httpCookie = new HttpCookie("PC-Member");
            }
            httpCookie.Value = HiCryptographer.Encrypt(Globals.UrlEncode(userId.ToString()));
            int num = (days == 0) ? 30 : (days * 24 * 60);

            httpCookie.Expires = DateTime.Now.AddMinutes((double)num);
            HttpContext.Current.Response.Cookies.Add(httpCookie);
            if (updateLoginStatus)
            {
                Users.SetLoginStatus(userId, true);
            }
            Users.SetUserLogoutStatus(false);
        }
Exemple #27
0
 public string CreatePhoneCode(int length, string phone, VerifyCodeType CodeType = VerifyCodeType.Digital)
 {
     try
     {
         string text = this.GeneralCode(length, CodeType);
         HiCache.Insert($"DataCache-PhoneCode-{phone}", HiCryptographer.Encrypt(text), 1200);
         HttpCookie httpCookie = new HttpCookie(phone + "_PhoneVerifyCookie");
         httpCookie.HttpOnly = true;
         httpCookie.Value    = HiCryptographer.Encrypt(text);
         httpCookie.Expires  = DateTime.Now.AddMinutes(20.0);
         HttpContext.Current.Response.Cookies.Add(httpCookie);
         HiCache.Remove("smsnum" + phone);
         return(text);
     }
     catch (Exception ex)
     {
         Globals.WriteExceptionLog(ex, null, "CreateVerifyCode");
         return(string.Empty);
     }
 }
Exemple #28
0
        private void saveData()
        {
            if (string.IsNullOrEmpty(this.txt_mid.Text))
            {
                this.ShowMsg("请输入商户号!", false);
            }
            this.siteSettings.ShenPay_mid = this.txt_mid.Text;
            if (string.IsNullOrEmpty(this.txt_key.Text))
            {
                this.ShowMsg("请输入商家密钥(Key)!", false);
            }
            this.siteSettings.ShenPay_key = this.txt_key.Text;
            SettingsManager.Save(this.siteSettings);
            string          text        = string.Format("<xml><SenderId>{0}</SenderId><SellerKey>{1}</SellerKey><Seller_account_name></Seller_account_name></xml>", this.txt_mid.Text, this.txt_key.Text);
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest");

            if (paymentMode == null)
            {
                PaymentModeInfo paymentMode2 = new PaymentModeInfo
                {
                    Name            = "盛付通手机网页支付",
                    Gateway         = "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    Charge          = 0m,
                    IsPercent       = false,
                    ApplicationType = PayApplicationType.payOnWAP,
                    Settings        = HiCryptographer.Encrypt(text)
                };
                SalesHelper.CreatePaymentMode(paymentMode2);
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentMode;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.ApplicationType = PayApplicationType.payOnWAP;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }
            this.ShowMsg("保存成功!", true);
        }
Exemple #29
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            string     str;
            ConfigData data;
            decimal    num;

            if (this.ValidateValues(out str, out data, out num))
            {
                PaymentModeInfo info2 = new PaymentModeInfo();
                info2.Name               = this.txtName.Text;
                info2.Description        = this.fcContent.Text.Replace("\r\n", "").Replace("\r", "").Replace("\n", "");
                info2.Gateway            = str;
                info2.IsUseInpour        = this.radiIsUseInpour.SelectedValue;
                info2.IsUseInDistributor = this.radiIsUseInDistributor.SelectedValue;
                info2.Charge             = num;
                info2.IsPercent          = this.chkIsPercent.Checked;
                info2.Settings           = HiCryptographer.Encrypt(data.SettingsXml);
                PaymentModeInfo paymentMode = info2;
                switch (SalesHelper.CreatePaymentMode(paymentMode))
                {
                case PaymentModeActionStatus.Success:
                    base.Response.Redirect(Globals.GetAdminAbsolutePath("sales/PaymentTypes.aspx"));
                    return;

                case PaymentModeActionStatus.DuplicateGateway:
                    this.ShowMsg("已经添加了一个相同类型的支付接口", false);
                    return;

                case PaymentModeActionStatus.DuplicateName:
                    this.ShowMsg("已经存在一个相同的支付方式名称", false);
                    return;

                case PaymentModeActionStatus.OutofNumber:
                    this.ShowMsg("支付方式的数目已经超出系统设置的数目", false);
                    return;
                }
                this.ShowMsg("未知错误", false);
            }
        }
Exemple #30
0
 public string CreateVerifyCode(int length, VerifyCodeType CodeType = VerifyCodeType.Digital, string openId = "")
 {
     try
     {
         string text = this.GeneralCode(length, CodeType).Trim();
         if (!string.IsNullOrEmpty(openId))
         {
             HiCache.Insert(openId, HiCryptographer.Encrypt(text), 1200);
         }
         HttpCookie httpCookie = new HttpCookie("VerifyCookie");
         httpCookie.HttpOnly = true;
         httpCookie.Value    = HiCryptographer.Encrypt(text);
         httpCookie.Expires  = DateTime.Now.AddMinutes(20.0);
         HttpContext.Current.Response.Cookies.Add(httpCookie);
         return(text);
     }
     catch (Exception ex)
     {
         Globals.WriteExceptionLog(ex, null, "CreateVerifyCode");
         return(string.Empty);
     }
 }