Example #1
0
File: Isv.cs Project: zwkjgs/XKD
        private string SaveConfig(string connectionstr)
        {
            string result;

            try
            {
                Configuration configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(System.Web.HttpContext.Current.Request.ApplicationPath);
                using (System.Security.Cryptography.RijndaelManaged cryptographer = this.GetCryptographer())
                {
                    configuration.AppSettings.Settings["IV"].Value  = System.Convert.ToBase64String(cryptographer.IV);
                    configuration.AppSettings.Settings["Key"].Value = System.Convert.ToBase64String(cryptographer.Key);
                }
                System.Web.Configuration.MachineKeySection machineKeySection = (System.Web.Configuration.MachineKeySection)configuration.GetSection("system.web/machineKey");
                machineKeySection.ValidationKey = Isv.CreateKey(20);
                machineKeySection.DecryptionKey = Isv.CreateKey(24);
                machineKeySection.Validation    = System.Web.Configuration.MachineKeyValidation.SHA1;
                machineKeySection.Decryption    = "3DES";
                configuration.ConnectionStrings.ConnectionStrings["HidistroSqlServer"].ConnectionString = connectionstr;
                configuration.ConnectionStrings.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
                configuration.Save();
                configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(System.Web.HttpContext.Current.Request.ApplicationPath);
                configuration.AppSettings.Settings.Remove("Installer");
                configuration.Save();
                result = "";
            }
            catch (System.Exception ex)
            {
                result = ex.Message;
            }
            return(result);
        }
Example #2
0
File: Isv.cs Project: zwkjgs/XKD
        private string SaveSiteSettings()
        {
            string result;

            try
            {
                string       filename     = System.Web.HttpContext.Current.Request.MapPath("~/config/SiteSettings.config");
                XmlDocument  xmlDocument  = new XmlDocument();
                SiteSettings siteSettings = new SiteSettings(System.Web.HttpContext.Current.Request.Url.Host);
                xmlDocument.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + System.Environment.NewLine + "<Settings></Settings>");
                siteSettings.VTheme                      = "t1";
                siteSettings.SiteName                    = "微信分销大师";
                siteSettings.CheckCode                   = Isv.CreateKey(20);
                siteSettings.DistributorLogoPic          = "/utility/pics/headLogo.jpg";
                siteSettings.DistributorsMenu            = true;
                siteSettings.EnableShopMenu              = true;
                siteSettings.ShopDefault                 = true;
                siteSettings.MemberDefault               = true;
                siteSettings.GoodsType                   = true;
                siteSettings.GoodsCheck                  = true;
                siteSettings.ActivityMenu                = true;
                siteSettings.ActivityMenu                = true;
                siteSettings.BrandMenu                   = true;
                siteSettings.GoodsListMenu               = true;
                siteSettings.OrderShowDays               = 7;
                siteSettings.CloseOrderDays              = 3;
                siteSettings.FinishOrderDays             = 7;
                siteSettings.MaxReturnedDays             = 15;
                siteSettings.TaxRate                     = 0m;
                siteSettings.PointsRate                  = 1m;
                siteSettings.IsValidationService         = true;
                siteSettings.SMSSender                   = "";
                siteSettings.SMSSettings                 = "";
                siteSettings.ShopMenuStyle               = "1";
                siteSettings.EnablePodRequest            = false;
                siteSettings.EnableCommission            = true;
                siteSettings.EnableAlipayRequest         = false;
                siteSettings.EnableWeiXinRequest         = false;
                siteSettings.EnableOffLineRequest        = true;
                siteSettings.EnableWapShengPay           = false;
                siteSettings.OffLinePayContent           = "<p>请填写在线支付帮助内容</p>";
                siteSettings.DistributorDescription      = "<p><img src=\"/utility/pics/fxs.png\" title=\"fenxiao.png\" alt=\"fenxiao.png\"/></p>";
                siteSettings.DistributorBackgroundPic    = "/Storage/data/DistributorBackgroundPic/default.jpg|";
                siteSettings.SaleService                 = "<p>请填写售后服务内容</p>";
                siteSettings.MentionNowMoney             = "1";
                siteSettings.PointsRate                  = 1m;
                siteSettings.PointsRate                  = 1m;
                siteSettings.Disabled                    = false;
                siteSettings.ShareAct_Enable             = true;
                siteSettings.SignPoint                   = 10;
                siteSettings.SignWherePoint              = 10;
                siteSettings.SignWhere                   = 10;
                siteSettings.ActiveDay                   = 1;
                siteSettings.sign_EverDayScore           = 50;
                siteSettings.sign_StraightDay            = 2;
                siteSettings.sign_RewardScore            = 20;
                siteSettings.sign_score_Enable           = true;
                siteSettings.shopping_reward_Enable      = true;
                siteSettings.shopping_score_Enable       = true;
                siteSettings.shopping_Score              = 100;
                siteSettings.shopping_reward_Score       = 1;
                siteSettings.shopping_reward_OrderValue  = 100.0;
                siteSettings.share_score_Enable          = true;
                siteSettings.share_Score                 = 100;
                siteSettings.PointToCashRate             = 100;
                siteSettings.PonitToCash_Enable          = true;
                siteSettings.PonitToCash_MaxAmount       = 1000m;
                siteSettings.DrawPayType                 = "1|0|2|3";
                siteSettings.BatchAliPay                 = true;
                siteSettings.BatchWeixinPay              = true;
                siteSettings.BatchWeixinPayCheckRealName = 0;
                siteSettings.EnableSaleService           = false;
                siteSettings.ServiceMeiQia               = "";
                siteSettings.App_Secret                  = "836e49139e90c64f21251a6dec9c2cca";
                siteSettings.WriteToXml(xmlDocument);
                xmlDocument.Save(filename);
                result = "";
            }
            catch (System.Exception ex)
            {
                result = ex.Message;
            }
            return(result);
        }