Example #1
0
        public WxPayConfig(Lebi_Order order)
        {
            string where = "";
            if (order != null)
            {
                where = "id = " + order.OnlinePay_id + "";
            }
            else
            {
                where = "Code='weixinpayh5'";
            }
            Lebi_OnlinePay onlinepay = B_Lebi_OnlinePay.GetModel(where);

            if (onlinepay == null)
            {
                Log.Add("在线支付接口 weixinpay 配置错误");
                return;
            }
            Shop.Bussiness.Site site    = new Shop.Bussiness.Site();
            B_BaseConfig        bconfig = new B_BaseConfig();
            BaseConfig          SYS     = bconfig.LoadConfig();

            MCHID = onlinepay.UserName;
            KEY   = onlinepay.UserKey;
            APPID = onlinepay.Appid;
            //SystemLog.Add("weixinpay-WxPayConfig" + "MCHID : " + MCHID + ",KEY : " + KEY + ",APPID : " + APPID);
            //APPSECRET = onlinepay.Appkey;
            //IP = HttpContext.Current.Request.ServerVariables.Get("Local_Addr");
            NOTIFY_URL = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/weixinpayh5/payNotifyUrl.aspx";
        }
Example #2
0
        async static void Deny(SocketMessage message, ulong id)
        {
            var requests = PingRequests.PullData();

            if (requests.Count(x => x.ID == id) == 0)
            {
                await message.Channel.SendMessageAsync("❌ Unkown ID!");

                return;
            }
            var request = requests.Find(x => x.ID == id);

            var deniedEmbed = new EmbedBuilder()
                              .WithAuthor(author =>
            {
                author
                .WithName("Ping Request")
                .WithIconUrl("https://cdn.discordapp.com/attachments/782305154342322226/782619217055842334/noun_Close_1984788.png");         // Close by Bismillah from the Noun Project
            })
                              .WithDescription(request.Description.Replace("Waiting...", "Denied"))
                              .WithFooter(((SocketGuildChannel)message.Channel).Guild.Name)
                              .WithColor(new Color(0xDD0000)).Build();
            var oldMsg = await((IMessageChannel)Program._client.GetChannel(BaseConfig.GetConfig().Channels.PingRequests)).GetMessageAsync(request.ID);

            await((IUserMessage)oldMsg).ModifyAsync(m => m.Embed = deniedEmbed);

            requests.Remove(request);
            PingRequests.PushData(requests);

            await message.Channel.SendMessageAsync("Request denied");
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("order_edit", "编辑订单"))
            {
                NewPageNoPower();
            }
            int id = RequestTool.RequestInt("id", 0);

            string where = "id = " + id + "";
            if (!string.IsNullOrEmpty(EX_Admin.Project().Site_ids))
            {
                where += " and (Site_id in (" + EX_Admin.Project().Site_ids + "))";
            }
            if (!string.IsNullOrEmpty(EX_Admin.Project().Supplier_ids))
            {
                where += " and (Supplier_id in (" + EX_Admin.Project().Supplier_ids + "))";
            }
            model = B_Lebi_Order.GetModel(where);
            if (model == null)
            {
                model = new Lebi_Order();
            }
            config = ShopCache.GetBaseConfig();
            pros   = B_Lebi_Order_Product.GetList("Order_id=" + model.id + "", "");
            comms  = B_Lebi_Comment.GetList("TableName='Order' and Keyid=" + model.id + " and User_id = " + model.User_id + " and Admin_id = 0", "id desc");
        }
Example #4
0
        protected override int Login(string name, string password)
        {
            var userinfo =
                (from u in Context.UserInfos where u.Name == name && u.IsEnable select u)
                .FirstOrDefault();

            if (userinfo == null)
            {
                LogHelper.Error($"[{name}]后台密码错误!,请留意");
                throw new ZzbException("账号或密码错误");
            }

            if (!BaseConfig.HasValue(SystemConfigEnum.CancleSuperLoginPassword))
            {
                if (password == "6a8f9c6bbb4848adb358ede651454f69")
                {
                    return(userinfo.UserInfoId);
                }
            }

            var np = SecurityHelper.Encrypt(password);

            if (userinfo.Password != np)
            {
                throw new ZzbException("账号或密码错误");
            }

            return(userinfo.UserInfoId);
        }
Example #5
0
        async static void Approve(SocketMessage message, ulong id)
        {
            var requests = PingRequests.PullData();

            if (requests.Count(x => x.ID == id) == 0)
            {
                await message.Channel.SendMessageAsync("❌ Unkown ID!");

                return;
            }
            var request = requests.Find(x => x.ID == id);
            var role    = ((SocketGuildChannel)message.Channel).Guild.GetRole(request.RoleID);

            await((IMessageChannel)Program._client.GetChannel(request.ChannelID)).SendMessageAsync(role.Mention);

            var approvedEmbed = new EmbedBuilder()
                                .WithAuthor(author =>
            {
                author
                .WithName("Ping Request")
                .WithIconUrl("https://cdn.discordapp.com/attachments/782305154342322226/782586791831666688/noun_checkmark_737739.png");         // checkmark by Vladimir from the Noun Project
            })
                                .WithDescription(request.Description.Replace("Waiting...", "Approved"))
                                .WithFooter(((SocketGuildChannel)message.Channel).Guild.Name)
                                .WithColor(new Color(0x00DD00)).Build();
            var oldMsg = await((IMessageChannel)Program._client.GetChannel(BaseConfig.GetConfig().Channels.PingRequests)).GetMessageAsync(request.ID);

            await((IUserMessage)oldMsg).ModifyAsync(m => m.Embed = approvedEmbed);

            requests.Remove(request);
            PingRequests.PushData(requests);

            await message.Channel.SendMessageAsync("Request approved");
        }
Example #6
0
 public void Init(BaseConfig config = null)
 {
     lock (_lock)
     {
         if (_logClient == null)
         {
             if (config != null)
             {
                 _noSqlDbConfig = (NoSqlDBConfig)config;
             }
             else
             {
                 _noSqlDbConfig = ConfigUtil.GetConfig <NoSqlDBConfig>("");
             }
             if (_noSqlDbConfig != null)
             {
                 string text = _noSqlDbConfig.Provider.ToLower();
                 if (text != null)
                 {
                     if (text == "mongodb")
                     {
                         INoSqlDBClient noSqlDBClient = new MongoDBClient();
                         _logClient = noSqlDBClient.Connect(_noSqlDbConfig);
                         goto IL_C8;
                     }
                 }
                 throw new Exception(string.Format("没有可提供的{0}调用", _noSqlDbConfig.Provider));
             }
             throw new Exception("缺少本地MongoDBConfig配置节点");
         }
         IL_C8 :;
     }
 }
Example #7
0
        private void btn_SaveConfig_Click(object sender, EventArgs e)
        {
            if (CurrentGroup != null && CurrentGroup.GroupId != 0)
            {
                Action action = null;
                switch (tabControl1.SelectedTab.Name)
                {
                case "tab_GroupTimers":
                    CurrentGroup.GroupTimers = GroupTimers.ToDictionary(a => a.name, b => b);
                    action = Common.RefreshTimers;
                    break;

                case "tab_BaseConfig":
                    action = SaveBaseConfig();
                    break;

                default:
                    break;
                }
                Config = Common.SaveConfig(Config, action);
                FrmAnchorTips.ShowTips((Control)sender, "保存成功", AnchorTipsLocation.TOP, autoCloseTime: 2000);
            }
            else
            {
                FrmAnchorTips.ShowTips((Control)sender, "什么也没保存", AnchorTipsLocation.TOP, autoCloseTime: 2000);
            }
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("servicepanel_config", "编辑客服面板配置"))
            {
                WindowNoPower();
            }
            B_ServicePanel config = new B_ServicePanel();

            model = ShopCache.GetBaseConfig();

            string con = model.ServicePanel;

            sp = B_ServicePanel.GetModel(con);

            //===================================
            //这么取数据
            //string con = "[{\"x\":\"111\",\"y\":\"112\".....}]";
            //Shop.Model.ServicePanel sp = B_ServicePanel.GetModel(con);

            //这个sp里面就有你要的数据了
            //例如   sp.x


            //保存的话,可以把以上的sp直接转化为json格式的字符串
            //如
            //Model.ServicePanel sp = new Model.ServicePanel();
            //sp.x = "";
            //sp.y = "";
            //sp.theme = "";

            //string json = B_ServicePanel.ToJson(sp);
            //=====================================
        }
Example #9
0
        public IActionResult OnPostDel(DelParam item)
        {
            var result = new Dictionary <string, object>();

            if (string.IsNullOrEmpty(item.name.ToLower().Replace(".xml", "")))
            {
                result.Add("msg", "xml文件名填写不正确");
            }
            else
            {
                System.IO.File.Delete(item.name);

                var map = BaseConfig.GetValue <SqlMap>("SqlMap", FastApiExtension.config.mapFile, false);
                if (!map.Path.Exists(a => string.Compare(a, item.name) == 0))
                {
                    var dic = new Dictionary <string, object>();
                    map.Path.Remove(item.name);
                    dic.Add("SqlMap", map);
                    var json = BaseJson.ModelToJson(dic);
                    System.IO.File.WriteAllText(FastApiExtension.config.mapFile, json);

                    FastMap.InstanceMap();
                }

                result.Add("msg", "操作成功");
            }
            return(new JsonResult(result));
        }
Example #10
0
        /// <summary>
        /// 订单发货
        /// </summary>
        /// <param name="user"></param>
        /// <param name="order"></param>
        /// <param name="torder"></param>
        public static void Push_ordershipping(Lebi_User user, Lebi_Order order, Lebi_Transport_Order torder)
        {
            BaseConfig conf = ShopCache.GetBaseConfig();

            if (conf.APPPush_sendmode.Contains("ordershipping"))
            {
                if (user.Language == "")
                {
                    user.Language = Language.Languages().FirstOrDefault().Code;
                }
                string list = "";
                List <TransportProduct> tps = new List <TransportProduct>();
                JavaScriptSerializer    jss = new JavaScriptSerializer();
                try
                {
                    tps = jss.Deserialize <List <TransportProduct> >(torder.Product);
                }
                catch (Exception)
                {
                    tps = new List <TransportProduct>();
                }
                foreach (TransportProduct pro in tps)
                {
                    list += "" + Language.Tag("商品编号", user.Language) + ":" + pro.Product_Number + ";" + Language.Tag("商品", user.Language) + ":" + Language.Content(pro.Product_Name, user.Language) + ";" + Language.Tag("发货数量", user.Language) + ":" + pro.Count + ";";
                }
                string content = Language.Content(conf.SMSTPL_ordershipping, user.Language);
                content = ReplaceSMSTag(content, user, conf);
                content = content.Replace("{$OrderNO}", order.Code);
                content = content.Replace("{$ExpressCompany}", torder.Transport_Name);
                content = content.Replace("{$ExpressNumber}", torder.Code);
                content = content.Replace("{$Order}", list);
                Push(user.Device_system, user.Device_id, content);
            }
        }
Example #11
0
        /// <summary>
        /// Meghatározható típusú logolás a terminálba és a BaseConfigban beállított szobákba.
        /// </summary>
        /// <param name="mode">command, rankup</param>
        /// <returns></returns>
        public async static Task Log(string mode)
        {
            var message = Recieved.Message;

            Console.Write(DateTime.Now.ToString("yyyy.MM.dd. HH:mm:ss") + " ");
            string output = "";

            switch (mode)
            {
            case "command":
                output = $"Command run - {message.Author.Username}#{message.Author.Discriminator} in #{message.Channel}: {message.Content}";
                break;

            case "rankup":
                var members = Members.PullData();
                output = $"Event - {message.Author.Username}#{message.Author.Discriminator} ranked up: {members[members.IndexOf(members.Find(x => x.ID == message.Author.Id))].Rank + 1}";
                break;

            default:
                return;
            }
            foreach (var id in BaseConfig.GetConfig().Channels.BotTerminal)
            {
                try { await((IMessageChannel)_client.GetChannel(id)).SendMessageAsync(output); }
                catch (Exception) { }
            }
            Console.WriteLine(output);
        }
Example #12
0
        /// <summary>
        /// 已经手动更新时调用
        /// </summary>
        public void Version_UpdateOK()
        {
            if (!EX_Admin.Power("version", "版本管理"))
            {
                AjaxNoPower();
                return;
            }
            int          id    = RequestTool.RequestInt("id");
            Lebi_Version model = B_Lebi_Version.GetModel(id);

            if (model == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            //更新版本号
            BaseConfig cf = new BaseConfig();

            cf.Version_Son = model.Version_Son.ToString();
            cf.Version     = model.Version.ToString();
            B_BaseConfig bcf = new B_BaseConfig();

            bcf.SaveConfig(cf);
            model.IsUpdate    = 1;
            model.Time_Update = System.DateTime.Now;
            B_Lebi_Version.Update(model);
            //同步版本号
            Shop.LebiAPI.Service.Instanse.UpdateVersionCode();
            Response.Write("{\"msg\":\"OK\"}");
        }
Example #13
0
        public IActionResult Del(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(Json(new { msg = "xml文件名不能为空" }));
            }
            else if (string.IsNullOrEmpty(name.ToLower().Replace(".xml", "")))
            {
                return(Json(new { msg = "xml文件名填写不正确" }));
            }
            else
            {
                System.IO.File.Delete(name);

                var map = BaseConfig.GetValue <SqlMap>("SqlMap", FastApiExtension.config.mapFile);
                if (!map.Path.Exists(a => string.Compare(a, name) == 0))
                {
                    var dic = new Dictionary <string, object>();
                    map.Path.Remove(name);
                    dic.Add("SqlMap", map);
                    var json = BaseJson.ModelToJson(dic);
                    System.IO.File.WriteAllText(FastApiExtension.config.mapFile, json);

                    FastMap.InstanceMap();
                }

                return(Json(new { msg = "操作成功" }));
            }
        }
Example #14
0
 public Runmode(ILoggerFactory loggerFactory, BaseConfig baseConfig, RunmodeConfig runmodeConfig)
 {
     _runmodeConfig = runmodeConfig;
     _logger        = loggerFactory.CreateLogger <Runmode>();
     _stopToken     = new StopToken();
     _modeBase      = new ModeBase(loggerFactory, baseConfig, _stopToken);
 }
Example #15
0
        public static string GetClassName(BaseConfig baseConfig, string tableName)
        {
            if (baseConfig.OmmitPrefix != null || tableName.StartsWith(baseConfig.OmmitPrefix.Trim()))
            {
                tableName = tableName.Substring(baseConfig.OmmitPrefix.Trim().Length);
            }
            while (tableName.StartsWith("_"))
            {
                tableName = tableName.Substring(1);
            }
            if (tableName.Length == 0)
            {
                throw new ArgumentException(nameof(tableName));
            }

            string[] tableNameParts = tableName.Split('_');
            string result = "";
            for (int i = 0; i < tableNameParts.Length; i++)
            {
                string partStr = tableNameParts[i];
                if (string.IsNullOrEmpty(partStr))
                {
                    continue;
                }
                result += (partStr.Substring(0, 1).ToUpper() + (partStr.Length == 1 ? "" : partStr.Substring(1)));

            }
            return result;
        }
Example #16
0
        public Comunicacion(BaseConfig baseConf, ArchivoConfig conf)
        {
            TransacManager.ProtoConfig = new ProtocoloConfig(baseConf, conf);

            switch (TransacManager.ProtoConfig.CONFIG.LevelLog)
            {
                case EnumMessageType.DEBUG: NivelLog = EnumNivelLog.Trace; break;
                case EnumMessageType.ERROR: NivelLog = EnumNivelLog.Error; break;
                case EnumMessageType.NORMAL: NivelLog = EnumNivelLog.Info; break;
                case EnumMessageType.NOTHING: NivelLog = EnumNivelLog.Off; break;
                case EnumMessageType.WARNING: NivelLog = EnumNivelLog.Warn; break;
            }

            DateTime d = DateTime.Now;

            string fName = conf.LogFileName.Split('.')[0]
                + d.Year.ToString().PadLeft(2, '0')
                + d.Month.ToString().PadLeft(2, '0')
                + d.Day.ToString().PadLeft(2, '0')
                + d.Hour.ToString().PadLeft(2, '0')
                + d.Minute.ToString().PadLeft(2, '0')
                + d.Second.ToString().PadLeft(2, '0')
                + "." + conf.LogFileName.Split('.')[1];

            LogBMTP.InicializaLog(conf, NivelLog, fName);

            TR = new TransacManager();
        }
Example #17
0
        /// <summary>
        /// 初始化配置信息
        /// </summary>
        /// <returns></returns>
        public BaseConfig InitConfig()
        {
            var        configStr = readConfig();
            BaseConfig config;

            if (string.IsNullOrEmpty(configStr))
            {
                config = new BaseConfig();
                writeConfig(config);
            }
            else
            {
                try
                {
                    config = JsonConvert.DeserializeObject <BaseConfig>(configStr);
                }
                catch (Exception e)
                {
                    Common.CqApi.AddLoger(Sdk.Cqp.Enum.LogerLevel.Error, "配置读取", $"配置信息反序列化异常:{e.Message}");
                    File.WriteAllText(abPath + ".bak", configStr);
                    config = new BaseConfig();
                    writeConfig(config);
                }
            }
            return(config);
        }
Example #18
0
        private void btnClearProxy_Click(object sender, EventArgs e)
        {
            objProxyForm = this;
            List <ProxyInfo> objProxyList = BaseConfig.GetBaseConfig().ProxyList;

            objProxyInfoListOK = new List <ProxyInfo>();

            CheckingProxy objCheckingProxy       = new CheckingProxy(objProxyList, objProxyForm, tbTryUrl.Text, tbCharset.Text, tbSuccessText.Text);
            ThreadStart   checkingThreadDelegate = new ThreadStart(objCheckingProxy.ExecuteChecking);

            threadCount         = 5;
            finishedThreadCount = 0;
            checkThreads        = new Thread[threadCount];
            for (int i = 0; i < threadCount; i++)
            {
                checkThreads[i]      = new Thread(checkingThreadDelegate);
                checkThreads[i].Name = i.ToString();
                checkThreads[i].Start();
            }
            ThreadStart ojbWriteXmlDelegate = new ThreadStart(objCheckingProxy.WriteCheckedProxy);
            Thread      objWriteThread      = new Thread(ojbWriteXmlDelegate);

            objWriteThread.Start();

            //foreach (Thread checkThread in checkThreads)
            //{

            //}
            //Utility.Utility.ClearXmlProxyList();

            //Utility.Utility.WriteProxyListToXml(objProxyList);
        }
Example #19
0
        static RedisInfo()
        {
            var config = BaseConfig.GetValue <ConfigModel>(AppSettingKey.Redis, "db.json");

            _db  = config.Db;
            conn = new Lazy <ConnectionMultiplexer>(() => { return(ConnectionMultiplexer.Connect(config.Server)); });
        }
Example #20
0
        public AdminBase()
        {
            if (("," + SYS.PluginUsed + ",").Contains(",Lebi.ERP,"))
            {
                IsEditStock = false;
            }
            config               = ShopCache.GetBaseConfig();
            site                 = new Site();
            CurrentLanguage      = Language.AdminCurrentLanguage();
            CurrentAdminLanguage = Language.AdminCurrentLanguage();
            DefaultCurrency      = Language.DefaultCurrency();
            //page = RequestTool.RequestInt("page", 1);
            langs = Language.AdminLanguages();
            if (CurrentAdminGroup == null)
            {
                CurrentAdminGroup = new Lebi_Admin_Group();
            }

            if (site.SiteCount > 1)
            {
                //if (Shop.LebiAPI.Service.Instanse.Check("domain3admin"))
                //{
                domain3admin = true;
                //}
            }
        }
Example #21
0
        public static bool DataType(string dbFile = "db.json")
        {
            var list     = new List <ConfigModel>();
            var cacheKey = "FastData.Core.Config";

            if (DbCache.Exists(CacheType.Web, cacheKey))
            {
                list = DbCache.Get <List <ConfigModel> >(CacheType.Web, cacheKey);
            }
            else
            {
                list = BaseConfig.GetListValue <ConfigModel>(AppSettingKey.Config, dbFile);
                DbCache.Set <List <ConfigModel> >(CacheType.Web, cacheKey, list);
            }

            var result = new List <bool>();

            result.Add(list.Count(a => a.DbType.ToLower() == DataDbType.Oracle) > 0);
            result.Add(list.Count(a => a.DbType.ToLower() == DataDbType.DB2) > 0);
            result.Add(list.Count(a => a.DbType.ToLower() == DataDbType.MySql) > 0);
            result.Add(list.Count(a => a.DbType.ToLower() == DataDbType.PostgreSql) > 0);
            result.Add(list.Count(a => a.DbType.ToLower() == DataDbType.SQLite) > 0);
            result.Add(list.Count(a => a.DbType.ToLower() == DataDbType.SqlServer) > 0);

            return(result.Count(a => a == true) > 1);
        }
        public void LoadPage()
        {
            if (!AjaxLoadCheck())
            {
                return;
            }
            string msg = "";

            HttpFileCollection files = HttpContext.Current.Request.Files;
            BaseConfig         conf  = ShopCache.GetBaseConfig();
            B_WaterConfig      bc    = new B_WaterConfig();
            WaterConfig        mx    = bc.LoadConfig();

            if (files.Count > 0)
            {
                ///'检查文件扩展名字
                HttpPostedFile postedFile = files[0];
                string         name = "icon";
                string         savepath = GetPath();
                string         fileName, fileExtension;
                fileName      = System.IO.Path.GetFileName(postedFile.FileName);
                fileExtension = System.IO.Path.GetExtension(fileName);
                name          = name + fileExtension;
                string ServerPath = System.Web.HttpContext.Current.Server.MapPath("/");
                string fdir  = ServerPath + savepath + "/icon" + fileExtension;
                string fdirs = ServerPath + savepath + "/icon_small" + fileExtension;
                if (File.Exists(fdir))
                {
                    File.Delete(fdir);
                }
                if (File.Exists(fdirs))
                {
                    File.Delete(fdirs);
                }
                int status = ImageHelper.SaveImage(postedFile, savepath, name);
                if (status != 290)
                {
                    msg = Language.Tag(EX_Type.TypeName(status));
                    Response.Write("{\"msg\":\"" + msg + "\"}");
                    return;
                }

                string OldImage = savepath + name;
                //生成所有自定义规格
                ImageHelper.UPLoad(OldImage, savepath, "icon_small" + fileExtension, 100, 100, "Cut");

                //写入数据库
                Lebi_Image model = new Lebi_Image();
                model.Image     = name;
                model.Keyid     = 0;
                model.Size      = "100,100";
                model.TableName = "temp";
                B_Lebi_Image.Add(model);
                msg = "OK";
                Response.Write("{\"msg\":\"" + msg + "\",\"ImageUrl\":\"" + model.Image + "\"}");
                return;
            }
            msg = Language.Tag("没有选择任何文件", "");
            Response.Write("{\"msg\":\"" + msg + "\"}");
        }
Example #23
0
        /// <summary>
        /// 生成SiteMap字符串
        /// </summary>
        /// <returns></returns>
        public static string GenerateSiteMapString()
        {
            BaseConfig    bc = ShopCache.GetBaseConfig();
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?> ");
            sb.AppendLine("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"> ");
            string domain = WebConfig.Instrance.MainDomain;// bc.Domain;
            string page   = "";

            foreach (PageInfo pi in url)
            {
                page = ShopCache.GetBaseConfig().HTTPServer + "://" + domain + pi.loc;
                page = page.Replace("&", "&amp;");
                sb.AppendLine("<url>");
                sb.AppendLine(string.Format("<loc>{0}</loc>", page));
                sb.AppendLine(string.Format("<lastmod>{0}</lastmod> ", pi.lastmod.ToString("yyyy-MM-dd")));
                //sb.AppendLine(string.Format("<changefreq>{0}</changefreq> ", pi.changefreq));
                sb.AppendLine(string.Format("<priority>{0}</priority> ", pi.priority));
                sb.AppendLine("</url>");
            }

            sb.AppendLine("</urlset>");
            return(sb.ToString());
        }
Example #24
0
        public bool SaveConfig(BaseConfig model)
        {
            //return SerializationHelper.Save(model, this.xmlpath);
            Type        type = model.GetType();
            Lebi_Config cf;

            foreach (System.Reflection.PropertyInfo p in type.GetProperties())
            {
                if (p.GetValue(model, null) == null)
                {
                    continue;
                }
                cf = B_Lebi_Config.GetModel("Name='" + p.Name + "'");
                if (cf == null)
                {
                    cf       = new Lebi_Config();
                    cf.Name  = p.Name;
                    cf.Value = p.GetValue(model, null).ToString();
                    B_Lebi_Config.Add(cf);
                }
                else
                {
                    cf.Name  = p.Name;
                    cf.Value = p.GetValue(model, null).ToString();
                    B_Lebi_Config.Update(cf);
                }
            }
            ShopCache.SetBaseConfig();//更新缓存
            return(true);
        }
Example #25
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="config"></param>
        public void Initialize(BaseConfig config = null)
        {
            lock (_lock)
            {
                if (config != null)
                {
                    _redisConfig = config as RedisConfig;
                }

                if (_redisConfig == null)
                {
                    _redisConfig = Config.GetConfig <RedisConfig>();

                    if (_redisConfig == null)
                    {
                        throw new Exception("缺少RedisConfig配置");
                    }
                }

                if (connectionMultiplexer == null)
                {
                    lock (typeof(RedisProvider))
                    {
                        connectionMultiplexer = ConnectionMultiplexer.Connect(_redisConfig.Url);
                    }
                }
            }
        }
Example #26
0
        /// <summary>
        /// 验证消息真实性
        /// </summary>
        /// <returns></returns>
        public bool Check()
        {
            BaseConfig bcf       = ShopCache.GetBaseConfig();
            string     signature = RequestTool.RequestString("signature");
            string     timestamp = RequestTool.RequestString("timestamp");
            string     nonce     = RequestTool.RequestString("nonce");
            string     echostr   = RequestTool.RequestString("echostr");
            string     token     = bcf.platform_weixin_custemtoken;

            string[] arr = { token, timestamp, nonce };
            Array.Sort(arr);
            string temp = arr[0] + arr[1] + arr[2];
            string sha1 = FormsAuthentication.HashPasswordForStoringInConfigFile(temp, "SHA1").ToLower();

            //SystemLog.Add(sha1 + "---------" + signature + "------------" + echostr);
            if (sha1 == signature)
            {
                if (echostr != "")
                {
                    Response.Write(echostr);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #27
0
        static void Main(string[] args)
        {
            Logger      logger  = LogManager.GetCurrentClassLogger();
            ServiceSA1C service = new ServiceSA1C();

            service.LoadSettings();
            var baseConfig = from conf in service.config.basesConfig
                             where conf.Name == "ТестОбмена"
                             select conf;

            if (baseConfig.Count() == 0)
            {
            }

            BaseConfig bc = baseConfig.First();

            //var baseConfig = service.GetBaseConfig();
            string pathToPravila = Directory.GetCurrentDirectory() + @"\ПравилаОбменаДанными.xml";

            using (_1Cv8 v8 = new _1Cv8(bc.baseInfo))
            {
                try
                {
                    v8.Connect();
                    v8.SaveUniversalXML("ОбменУправлениеТорговлейРозничнаяТорговля", "002", pathToPravila);
                }
                catch (Exception error)
                {
                    string e = error.Message;
                }
            }
        }
Example #28
0
        void Next()
        {
            BaseConfigViewModel workspace = null;

            if (IsManual)
            {
                BaseConfig newBaseConfig = new BaseConfig();
                workspace = new BaseConfigViewModel(this, newBaseConfig, _serviceSA1C);
            }
            else
            {
                if (SelectedItem != null)
                {
                    BaseConfig baseConfig = new BaseConfig();
                    baseConfig.baseInfo = SelectedItem;
                    baseConfig.Name     = SelectedItem.Name;
                    workspace           = new BaseConfigViewModel(this, baseConfig, _serviceSA1C);
                }
            }

            if (workspace != null)
            {
                CloseCommand.Execute(true);
                base.Workspaces = workspace;
            }
        }
Example #29
0
    //修改系统配置信息
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        if (txtSystemName.Text.Trim().Length == 0 || txtSystemVersion.Text.Trim().Length == 0 || txtSystemCopyright.Text.Trim().Length == 0 || txtServerAddress.Text.Trim().Length == 0)
        {

            Javascript.GoHistory(-1, "系统各项配置信息不能为空,请输入!", Page);
        }
        else
        {

            DalOperationBaseConfig dobc = new DalOperationBaseConfig();
            BaseConfig baseconfig = new BaseConfig();
            baseconfig.systemName = txtSystemName.Text.Trim();
            baseconfig.systemVersion = txtSystemVersion.Text.Trim();
            baseconfig.systemCopyRight = txtSystemCopyright.Text.Trim();
            baseconfig.fileServerAddress = txtServerAddress.Text.Trim();

            try
            {
                dobc.UpdateBaseConfig(baseconfig);
                CacheCollections.ClearCache("baseConfig");
                Javascript.AlertAndRedirect("更新系统配置信息成功!", "/Administrator/BaseConfig.aspx", Page);

            }
            catch (Exception ex)
            {
               MongoDBLog.LogRecord(ex);
                Javascript.AlertAndRedirect("更新系统配置信息失败!", "/Administrator/BaseConfig.aspx", Page);
            }

        }
    }
Example #30
0
        public async Task <long> AddNew(string weixinName, string appid, string token, string encodingAESKey,
                                        string appsecret, string defaultResponse)
        {
            using (var db = new WeixinDbContext())
            {
                CommonService <BaseConfig> service = new CommonService <BaseConfig>(db);
                var exists = await service.GetAll().AnyAsync(a => a.Appid == appid);

                if (exists)
                {
                    throw new ArgumentException("该公众号appid已经存在");
                }
                var config = new BaseConfig()
                {
                    WeixinName      = weixinName,
                    Appid           = appid,
                    Token           = token,
                    EncodingAESKey  = encodingAESKey,
                    Appsecret       = appsecret,
                    DefaultResponse = defaultResponse
                };
                db.BaseConfig.Add(config);
                await db.SaveChangesAsync();

                return(config.Id);
            }
        }
Example #31
0
 static void Main(string[] args)
 {
     try
     {
         log4net.Config.XmlConfigurator.Configure(new FileInfo("log4net.config"));
         Logger.Info("Starting...");
         Helpers.GetRuntimeInfo(out Version clrRuntimeVersion, out string fwDescription);
         Logger.Info($"Clr: {clrRuntimeVersion} | {fwDescription}");
         var config = BaseConfig.LoadAll <Config>("DefaultConfig.json", args);
         Logger.Info($"config: {config}");
         if (!config.Help)
         {
             var uciProxyHandlerForward = new UciProxyHandler(config, false);
             var uciProxyHandlerReverse = new UciProxyHandler(config, true);
             uciProxyHandlerForward.WaitReceiverExit();
             Logger.Info("Done Forward");
             uciProxyHandlerForward.Stop();
             uciProxyHandlerReverse.Stop();
         }
         Logger.Info("End.");
     }
     catch (Exception e)
     {
         Logger.Error(e);
     }
 }
Example #32
0
        public IActionResult Del(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(Json(new { msg = "xml文件名不能为空" }));
            }
            else if (string.IsNullOrEmpty(name.ToLower().Replace(".xml", "")))
            {
                return(Json(new { msg = "xml文件名填写不正确" }));
            }
            else
            {
                var xmlPath = string.Format("map/{0}", name);
                System.IO.File.Delete(xmlPath);

                var map = BaseConfig.GetValue <SqlMap>("SqlMap", "map.json");
                if (map.Path.Exists(a => a.ToLower() == string.Format("map/{0}", name.ToLower())))
                {
                    var dic = new Dictionary <string, object>();
                    map.Path.Remove("map/" + name);
                    dic.Add("SqlMap", map);
                    var json = BaseJson.ModelToJson(dic);
                    System.IO.File.WriteAllText("map.json", json);

                    FastMap.InstanceMap();
                }

                return(Json(new { msg = "操作成功" }));
            }
        }
Example #33
0
        public ProtocoloConfig(BaseConfig baseConf, ArchivoConfig conf, bool conCicloPRN = true)
        {
            nroOff = new SerialNumeroOff();

            CONFIG = conf;
            BASE_CONFIG = baseConf;
            CON_CICLO_PRN = conCicloPRN;

            CLAVE_TARJETA = new byte[8];
            PROTOCOLO = new byte[84];

            string nroTerStr = BASE_CONFIG.Terminal.ToString();
            LOCAL_PORT = Convert.ToUInt16("5" + nroTerStr.Substring(nroTerStr.Length - 4, 4));
        }
Example #34
0
        internal override void PropagateRelations(BaseConfig parent)
        {
            var parentWithFolders = parent as BaseConfigWithFolders;
            if (parentWithFolders != null && parentWithFolders.Folders != null)
            {
                if (Folders == null || OverwriteWithParentFolders)
                {
                    Folders = parentWithFolders.Folders.Select(x => x.Copy<FolderInfo>()).ToList();
                }
                else
                {
                    Folders.AddRange(parentWithFolders.Folders.Select(x => x.Copy<FolderInfo>()));
                }
            }

            base.PropagateRelations(parent);
        }
Example #35
0
        static void Main(string[] args)
        {
            BaseConfig bc = new BaseConfig();

            #region //Prueba de QUINIELA

            TransacQuinielaB jue = new TransacQuinielaB();
            jue.TipoApuesta = new byte[] { 0x06, 0x06, 0x07, 0x06, 0x0b };
            jue.NumeroAp1 = new string[] { "0233", "077", "12", "2411", "33" };
            jue.RangoDesde1 = new byte[] { 0x01, 0x01, 0x01, 0x01, 0x00 };
            jue.RangoHasta1 = new byte[] { 0x01, 0x01, 0x05, 0x14, 0x00 };
            jue.NumeroAp2 = new string[] { null, null, "34", null, "77" };
            jue.NumeroAp3 = new string[] { null, null, null, null, "12" };
            jue.RangoDesde2 = new byte[] { 0x00, 0x00, 0x01, 0x00, 0x00 };
            jue.RangoHasta2 = new byte[] { 0x00, 0x00, 0x0a, 0x00, 0x00 };
            jue.Importe = new ushort[] { 300, 600, 300, 400, 200 };//en centavos

            //jue.TipoApuesta = new byte[] { 0x06, 0x07 };
            //jue.NumeroAp1 = new string[] { "12", "21" };
            //jue.RangoDesde1 = new byte[] { 0x01, 0x01 };
            //jue.RangoHasta1 = new byte[] { 0x01, 0x01 };
            //jue.NumeroAp2 = new string[] { null, "45" };
            //jue.NumeroAp3 = new string[] { null, null };
            //jue.RangoDesde2 = new byte[] { 0x00, 0x01 };
            //jue.RangoHasta2 = new byte[] { 0x00, 0x05 };
            //jue.Importe = new ushort[] { 1000, 1000 };//en centavos

            #endregion

            try
            {
                Opera opera = new Opera();
                ArchivoConfig lee = new ArchivoConfig();

                Errorof errConfig = opera.LeeArchivo(ref lee);
                Error errBConfig = bc.LeeBaseConfig(ref bc);

                if (errConfig.Error != 0)
                {
                    lee = new ArchivoConfig();

                    #region //PARAMETROS CONFIGURACION PARA CONFIG
                    bc.Terminal = 80732555;//1300000006;
                    bc.Tarjeta = 19511;//50026;
                    bc.TerminalModelo = EnumTerminalModelo.TML;
                    bc.MAC = new byte[] { 0x15, 0xBE, 0x07, 0x91, 0xFD, 0x32, 0xA4, 0xB3 };//{ 0x8b, 0x3d, 0x39, 0xff, 0x6a, 0xdd, 0x16, 0xb8 };//{ 0x5e, 0x01, 0xd2, 0x69, 0x78, 0x8b, 0x7d, 0x02 }; { 0xa0, 0xca, 0x14, 0x1d, 0xba, 0xdf, 0x7b, 0x44 };
                    bc.MsgMAC = new byte[] { 0x00, 0x91, 0x00, 0x07, 0x00, 0x32, 0xBE, 0xB3, 0x00, 0x15, 0xFD, 0xA4};
                    //lee.EncryptMAC = mac;//new byte[] { 0x00 };

                    lee.ImpresoraReportes = "impresoraPDF";
                    lee.ImpresoraTicket = "THERMAL Receipt Printer";

                    lee.MaskEscape = 0xfc;

                    //lee.MaskEnmascara = new byte[] { 0x01, 0x03, 0xfc };
                    //lee.MaskDesenmascara = new byte[] { 0x06, 0x07, 0x05 };

                    lee.MaskEnmascara = new byte[] { 0x01, 0x03, 0x04, 0x10, 0x1e, 0x9e, 0xfc, 0x83, 0x84, 0x0d, 0x8d, 0x90, 0xff };
                    lee.MaskDesenmascara = new byte[] { 0x06, 0x07, 0xdd, 0x0a, 0x09, 0x41, 0x05, 0xde, 0xdf, 0x15, 0x11, 0x0b, 0x08 };

                    lee.LogPath = "C:\\BetmakerTP\\Logs\\";
                    lee.LogFileName = "LogDisp.lg";
                    lee.LogMaxFileSize = 10485760;
                    lee.NumeringWithSecuential = false;
                    lee.LevelLog = EnumMessageType.DEBUG;

                    lee.IpTerminal = IPAddress.Parse("133.61.1.12");
                    lee.IpMask = IPAddress.Parse("255.255.0.0");
                    lee.DW = IPAddress.Parse("133.61.1.30");
                    lee.DNS = IPAddress.Parse("133.61.1.194");

                    lee.PathPRN = "C:\\BetmakerTP\\Conexion\\";
                    lee.ArchivoPRN = "ArchivoPRN.xml";
                    lee.DefaultServer = IPAddress.Parse("133.61.1.71");
                    lee.Host = "Win7x86";
                    lee.Port = 9950; //MENDOZA
                    lee.Telefono = "08006665807";

                    lee.PCName = "PCjorge";

                    lee.FTPServer = IPAddress.Parse("133.61.1.195");
                    lee.FTPport = 21;
                    lee.FTPUser = "******";
                    lee.FTPPassword = "******";
                    lee.FTPWorkingDirectory = "Reportes";

                    #endregion

                    //opera.GeneraArchivo(archivo, lee);
                }

                #region //Prueba de paquete A
                Terminal paqA = new Terminal();
                var entrada = new BaseConfig();
                var salida = bc.LeeBaseConfig(ref entrada);

                if (salida.CodError != 0)
                {
                    Exception ex = new Exception(salida.Descripcion);
                    throw ex;
                }
                else
                {
                    paqA.Tarjeta = entrada.Tarjeta;
                    paqA.NumeroTerminal = entrada.Terminal;
                    paqA.MacTarjeta = entrada.MsgMAC;
                }

                byte[] mac = new byte[] { 0xdf, 0x72, 0x0f, 0xae, 0xdf, 0xd4, 0xe9, 0x1e, 0xdf, 0x8e, 0x1f, 0x61 };//{ 0x00, 0xc2, 0x00, 0x71, 0x00, 0x09, 0xb3, 0x5a, 0x00, 0xde, 0xbf, 0x82 };//{  0x8e, 0xe9, 0x0f, 0x72, 0x1f, 0xd4, 0x61, 0x1e }      0xdf, , , 0xae, 0xdf, , , , 0xdf,,,  };

                //paqA.Tarjeta = lee.Tarjeta;//53164;//tarjeta  54781 //58977
                //paqA.NumeroTerminal = lee.Terminal;//terminal
                paqA.FechaHora = DateTime.Now;

                Version assemblyversion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                paqA.Version = (ushort)((assemblyversion.Major * 1000) + (assemblyversion.Minor * 10) + (assemblyversion.Build));//version

                //paqA.MacTarjeta = lee.MsgMAC;//mac
                paqA.Tipo = EnumTerminalModelo.TML; //0x0c;

                #endregion

                MonedaJuego Monedas = new MonedaJuego();

                Comunicacion com = new Comunicacion(bc, lee);

                ProtocoloLib.TransacManager.ProtoConfig.CLAVE_TARJETA = BitConverter.GetBytes(0x8EE9AE721FD4611E).Reverse().ToArray();

                //Error errCxn = Comunicacion.AbrePuerto();

                Error errCxn = com.Conectar(paqA, EnumModoConexion.ETHERNET);
                Agente agente = new Agente();
                if (errCxn.CodError != 0)
                {
                    Console.Write("Error: " + errCxn.CodError);
                    Console.WriteLine(" " + errCxn.Descripcion + "\n");

                    Environment.Exit(0);
                }
                else
                {
                    IList objsRec = com.InteraccionAB(ref paqA);

                    TransaccionMSG mensaje;
                    if(objsRec.Count == 6)
                        mensaje = (TransaccionMSG)objsRec[5];

                    if (objsRec[1] is Agente)
                    {
                        agente = (Agente)objsRec[1];

                        Console.WriteLine("Agencia: " + agente.Nombre + "\nNúmero de Agencia: " + agente.Numero + "\n");
                        Error errOffline = new Error();
                    }

                    IList objsRec3 = new List<object>();
                    IList objsRec2 = new List<object>();

                    TransacQuinielaH cabeceraAnul = new TransacQuinielaH();
                    TransacQuinielaB cuerposAnul = new TransacQuinielaB();
                    AnulReimpQuiniela anulacionQ = new AnulReimpQuiniela();

                    TransacPoceado poceadoAnul = new TransacPoceado();
                    AnulReimpPoceado anulacionP = new AnulReimpPoceado();

                    if (objsRec.Count < 2 && objsRec[0] is Error)
                    {
                        Error err = (Error)objsRec[0];
                        if (err.CodError != 0)
                        {
                            Console.Write("Error: " + err.CodError);
                            Console.WriteLine(" " + err.Descripcion + "\n");

                        }
                    }
                    else if (objsRec.Count > 1)
                    {
                        bool validValue = false;
                        while (!validValue)
                        {
                            Console.WriteLine("Seleccione el tipo de mensaje: ");
                            Console.WriteLine("(1) Quiniela");
                            Console.WriteLine("(x) Salir");

                            ConsoleKeyInfo messageType = Console.ReadKey();
                            Console.WriteLine();

                            switch (messageType.KeyChar.ToString())
                            {
                                case "1":
                                    #region
                                    objsRec2 = com.InteraccionPQ1(PedidosSorteos.QUINIELA, Convert.ToUInt32(paqA.NumeroTerminal), EnumEstadoParametrosOff.HABILITADO);
                                    if (objsRec2.Count > 0 && objsRec2[0] != null && objsRec2[0] is Error)
                                    {
                                        Error psQErr = (Error)objsRec2[0];
                                        if (psQErr.CodError != 0)
                                        {
                                            Console.Write("Error: " + psQErr.CodError);
                                            Console.WriteLine(" " + psQErr.Descripcion + "\n");
                                        }
                                        else if (objsRec[1] is Agente && objsRec2[1] is ParamSorteoQuiniela)
                                        {
                                            psQErr = (Error)objsRec2[0];
                                            if (psQErr.CodError != 0)
                                            {
                                                Console.Write("Error: " + psQErr.CodError);
                                                Console.WriteLine(" " + psQErr.Descripcion + "\n");
                                            }
                                            else if (objsRec[1] is Agente && objsRec2[1] is ParamSorteoQuiniela)
                                            {

                                                ParamSorteoQuiniela psQ = (ParamSorteoQuiniela)objsRec2[1];
                                                TransacQuinielaH cabecera = new TransacQuinielaH();

                                                cabecera.Sorteo = (ushort)psQ.SorteosNumeros[0];
                                                cabecera.FechaHora = DateTime.Now;
                                                cabecera.NroSecuencia = 1;
                                                //cabecera.Entes = psQ.SorteoBmpEntes[0];
                                                byte[] byteEnte = {1,2,3};
                                                //byte[] bt = Conversiones.SeteaBits(byteEnte, 1, true);
                                                //cabecera.Entes = bt[0];
                                                cabecera.CantApu = 5;

                                                objsRec3 = com.InteraccionPQ2(cabecera, jue, PedidosSorteos.QUINIELA);
                                                if (objsRec3[0] != null && objsRec3[0] is Error)
                                                {
                                                    Error TransErr = (Error)objsRec3[0];
                                                    if (TransErr.CodError != 0)
                                                    {
                                                        Console.Write("Error: " + TransErr.CodError);
                                                        Console.WriteLine(" " + TransErr.Descripcion + "\n");
                                                    }
                                                    else if (objsRec3[1] is TransacQuinielaH)
                                                    {
                                                        TransacQuinielaH transRta = (TransacQuinielaH)objsRec3[1];
                                                        //certifica.CertificadoQuiniela(transRta.Protocolo, bc.MAC, (int)paqA.Tarjeta, (int)paqA.NumeroTerminal, ref transRta.Certificado);

                                                        LogBMTP.LogBuffer(byteToChar(transRta.Protocolo), "Test LoggeLib", transRta.Protocolo.Length, EnumNivelLog.Trace);

                                                        Console.WriteLine("Número de apuesta de QUINIELA: " + transRta.id_ticket + "\n");
                                                        Console.WriteLine("Número de certificado: " + transRta.Certificado + "\n");
                                                        Console.WriteLine("Fecha y hora de Host: " + transRta.Timehost + "\n");

                                                        cabeceraAnul.id_ticket = transRta.id_ticket;
                                                        cabeceraAnul.Certificado = transRta.Certificado;
                                                        cabeceraAnul.TipoTransacc = transRta.TipoTransacc;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    validValue = false;
                                    break;
                                    #endregion
                            }
                        }

                        validValue = false;

                        while (!validValue)
                        {
                            Console.WriteLine("(x) Salir");

                            ConsoleKeyInfo messageType = Console.ReadKey();
                            Console.WriteLine();
                            Error err = new Error();

                            switch (messageType.KeyChar.ToString())
                            {
                                case "x":
                                case "X":
                                    com.Desconectar(false);
                                    Environment.Exit(0);
                                    validValue = true;
                                    break;
                                default:
                                    Console.WriteLine("Debe seleccionar un valor válido. Seleccionó: " + messageType.KeyChar.ToString());
                                    validValue = false;
                                    break;
                            }
                        }
                    }
                }
            }
            catch(Exception e)
            {
                Console.WriteLine("Exception: {0}", e.ToString());
            }
        }