Exemplo n.º 1
0
 private static Parse <T> RepeatHelper <T>(Parse <T> parse)
 {
     return(value =>
     {
         ParseResult <T> parseResult = parse(value);
         if (parseResult.Succeeded)
         {
             return RepeatHelper(parse)(parseResult.RemainingInput);
         }
         return parseResult;
     });
 }
Exemplo n.º 2
0
 public static Parse <T> Repeat <T>(this Parse <T> parse1, Parse <T> parse2)
 {
     return(value =>
     {
         var parse1Result = parse1(value);
         ParseResult <T> parse2Result = parse2(parse1Result.RemainingInput);
         if (parse2Result.Succeeded)
         {
             return RepeatHelper(parse2)(parse2Result.RemainingInput);
         }
         return parse2Result;
     });
 }
Exemplo n.º 3
0
        public ContentResult ToAdd(BasePostCode para)
        {
            if (string.IsNullOrWhiteSpace(para.PostName))
            {
                return(Content("快递公司名不能为空"));
            }
            if (RepeatHelper.NoRepeat("BasePostCode", "PostName", para.PostName, para.ID) > 0)
            {
                return(Content("快递公司名已存在"));
            }
            if (!string.IsNullOrWhiteSpace(para.PostCode))
            {
                if (RepeatHelper.NoRepeat("BasePostCode", "PostCode", para.PostCode, para.ID) > 0)
                {
                    return(Content("快递公司代号已存在"));
                }
            }
            int rtn = para.InsertAndReturnIdentity();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("添加出错"));
        }
Exemplo n.º 4
0
        public ContentResult ToEdit(BasePostCode para)
        {
            if (string.IsNullOrWhiteSpace(para.PostName))
            {
                return(Content("快递公司名不能为空"));
            }
            if (RepeatHelper.NoRepeat("BasePostCode", "PostName", para.PostName, para.ID) > 0)
            {
                return(Content("快递公司名已存在"));
            }
            if (!string.IsNullOrWhiteSpace(para.PostCode))
            {
                if (RepeatHelper.NoRepeat("BasePostCode", "PostCode", para.PostCode, para.ID) > 0)
                {
                    return(Content("快递公司代号已存在"));
                }
            }
            int rtn = para.UpdateByID();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("保存出错"));
        }
Exemplo n.º 5
0
        public ActionResult ToEditGoods(jf_Goods goods)
        {
            jf_Goods OldGoods  = jf_Goods.GetEntityByID(goods.ID);
            string   oldImgUrl = OldGoods.Main_img;//原来的图片

            if (oldImgUrl.Contains("?"))
            {
                oldImgUrl = oldImgUrl.SubStringSafe(0, oldImgUrl.IndexOf("?"));
            }
            string msg = "";

            if (RepeatHelper.NoRepeat("jf_Goods", "GoodsName", goods.GoodsName, goods.ID) > 0)
            {
                msg         = "该礼品已存在!";
                goods.error = msg;
                return(View("EditGoods", goods));
            }
            OldGoods.GoodsName = goods.GoodsName;
            var file = Request.Files[0];

            if (file.ContentLength > 0 && file != null)
            {
                if (file.ContentLength > 5242880)
                {
                    msg         = "上传图片不能超过5MB!";
                    goods.error = msg;
                    return(View("EditGoods", goods));
                }
                if (!Directory.Exists(Server.MapPath("~/images/jf_Goods/")))
                {
                    Directory.CreateDirectory(Server.MapPath("~/images/jf_Goods/"));
                }
                string path = Request.MapPath("~/");
                string ext  = Path.GetExtension(file.FileName); //获得文件扩展名
                OldGoods.Main_img = "/images/jf_Goods/G_" + OldGoods.ID + ext;
                string saveName = OldGoods.Main_img;            //实际保存文件名

                try
                {
                    string delFile = Server.MapPath("~") + oldImgUrl;
                    System.IO.File.Delete(delFile);
                }
                catch (Exception ex) { }


                file.SaveAs(path + saveName);
            }
            OldGoods.Main_img     = OldGoods.Main_img + "?" + DateTime.Now.ToString("yyyyMMddHHmmss");
            OldGoods.SaleIntegral = goods.SaleIntegral;
            OldGoods.Quantity     = goods.Quantity;
            if (OldGoods.EditByID() > 0)
            {
                goods.error = "ok";
            }
            else
            {
                goods.error = "修改礼品失败!";
            }
            return(View("EditGoods", goods));
        }
Exemplo n.º 6
0
        public ContentResult MenusToAdd(B_Menu menu)
        {
            menu.IsShow  = Request["IsShow"] != null && Request["IsShow"].ToString() == "on" ? true : false;
            menu.IsValid = Request["IsValid"] != null && Request["IsValid"].ToString() == "on" ? true : false;
            menu.IsRobot = Request["IsRobot"] != null && Request["IsRobot"].ToString() == "on" ? false : true;

            if (string.IsNullOrWhiteSpace(menu.MenuName))
            {
                return(Content("名称不能为空"));
            }
            if (RepeatHelper.NoRepeat("B_Menu", "MenuName", menu.MenuName, menu.ID) > 0)
            {
                return(Content("菜单名已存在"));
            }
            if (!string.IsNullOrWhiteSpace(menu.MenuUrl) && RepeatHelper.NoRepeat("B_Menu", "MenuUrl", menu.MenuUrl, menu.ID) > 0)
            {
                return(Content("菜单链接已存在"));
            }

            int rtn = menu.InsertAndReturnIdentity();

            if (rtn > 0)
            {
                bool hasMainMenuTag          = false;
                bool hasError                = false;
                List <B_MenuRights> muRights = null;
                if (string.IsNullOrWhiteSpace(menu.MenuUrl) == false)
                {
                    menu.MenuUrl = menu.MenuUrl.Trim().TrimEnd('/');
                    try
                    {
                        string[] arrUrl = menu.MenuUrl.TrimStart('/').Split('/');
                        Type     type   = Type.GetType("WeBusiness.Controllers." + arrUrl[0] + "Controller");
                        muRights = BaseAuthorizeHelper.GetBOMenuRightsByControllerType(type, arrUrl[1], out hasMainMenuTag);
                    }
                    catch (Exception ex)
                    {
                        DAL.Log.Instance.Write(ex.ToString(), "BOMenu_Add");
                        hasError = true;
                    }
                }

                if (hasMainMenuTag && muRights != null)
                {
                    B_MenuRights.RelevanceList(rtn, muRights);
                }
                if (hasError)
                {
                    return(Content("添加菜单成功,但菜单没有添加权限!"));
                }


                return(Content("ok"));
            }
            return(Content("添加出错"));
        }
Exemplo n.º 7
0
        public ContentResult B_RoleToAdd(B_Role role)
        {
            if (string.IsNullOrWhiteSpace(role.RoleName))
            {
                return(Content("角色名不能为空"));
            }
            if (RepeatHelper.NoRepeat("B_Role", "RoleName", role.RoleName, role.ID) > 0)
            {
                return(Content("角色名已存在"));
            }
            int rtn = role.InsertAndReturnIdentity();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("添加出错"));
        }
        public ContentResult ToEdit(SYSICodeIntegralSet para)
        {
            if (string.IsNullOrWhiteSpace(para.CodePrefix))
            {
                return(Content("前缀不能为空"));
            }
            if (RepeatHelper.NoRepeat("SYSICodeIntegralSet", "CodePrefix", para.CodePrefix, para.ID) > 0)
            {
                return(Content("该前缀已存在"));
            }
            int rtn = para.UpdateByID();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("保存出错"));
        }
Exemplo n.º 9
0
        public ContentResult ToEdit(BaseParameters para)
        {
            if (string.IsNullOrWhiteSpace(para.NickName))
            {
                return(Content("参数名称不能为空"));
            }
            if (RepeatHelper.NoRepeat("BaseParameters", "ParametersKey", para.ParametersKey, para.ID) > 0)
            {
                return(Content("唯一标识已存在"));
            }
            int rtn = para.SYSEditByID();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("保存出错"));
        }
Exemplo n.º 10
0
        public ContentResult B_RoleToEdit(B_Role role)
        {
            if (string.IsNullOrWhiteSpace(role.RoleName))
            {
                return(Content("角色名不能为空"));
            }
            if (RepeatHelper.NoRepeat("B_Role", "RoleName", role.RoleName, role.ID) > 0)
            {
                return(Content("角色名已存在"));
            }
            int rtn = role.UpdateByID();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("保存出错"));
        }
        public ContentResult ToAdd(SYSICodeIntegralSet para)
        {
            if (string.IsNullOrWhiteSpace(para.CodePrefix))
            {
                return(Content("前缀不能为空"));
            }
            if (RepeatHelper.NoRepeat("SYSICodeIntegralSet", "CodePrefix", para.CodePrefix, para.ID) > 0)
            {
                return(Content("该前缀已存在"));
            }
            int rtn = para.InsertAndReturnIdentity();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("添加出错"));
        }
Exemplo n.º 12
0
        public ActionResult ToAddGoods(jf_Goods goods)
        {
            string msg = "";

            if (RepeatHelper.NoRepeat("jf_Goods", "GoodsName", goods.GoodsName, goods.ID) > 0)
            {
                msg         = "该礼品名称已存在!";
                goods.error = msg;
                return(View("AddGoods", goods));
            }
            var    file = Request.Files[0];
            string path = Request.MapPath("~/");
            string ext  = Path.GetExtension(file.FileName);//获得文件扩展名

            if (!Directory.Exists(Server.MapPath("~/images/jf_Goods/")))
            {
                Directory.CreateDirectory(Server.MapPath("~/images/jf_Goods/"));
            }
            if (file.ContentLength == 0 || file == null)
            {
                msg         = "上传的图片没有内容!";
                goods.error = msg;
                return(View("AddGoods", goods));
            }
            if (file.ContentLength > 5242880)
            {
                msg         = "上传图片不能超过5MB!";
                goods.error = msg;
                return(View("AddGoods", goods));
            }

            goods.PublishStat = "未上架";
            int rtn = goods.AddGoods(ext, CurrentUser.UserName);

            if (rtn > 0)
            {
                file.SaveAs(path + goods.Main_img);
                return(RedirectToAction("GoodsDetailEdit", "jf_Goods", new { id = goods.ID }));
            }
            msg         = "礼品添加失败!";
            goods.error = msg;
            return(View("AddGoods", goods));
        }
        public ContentResult ToEdit(SYSIntegralCodeArea para)
        {
            if (string.IsNullOrWhiteSpace(para.AreaName))
            {
                return(Content("区域名称不能为空"));
            }

            if (RepeatHelper.NoRepeatTwoAnd("SYSIntegralCodeArea", "AreaName", para.AreaName, "ActivityID", para.ActivityID.ToString(), para.ID) > 0)
            {
                return(Content("区域名称已存在"));
            }
            int rtn = para.EditByID();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("保存出错"));
        }
Exemplo n.º 14
0
        public ContentResult ToEdit(LotteryActivitys para)
        {
            if (string.IsNullOrWhiteSpace(para.Title))
            {
                return(Content("活动标题不能为空"));
            }
            if (RepeatHelper.NoRepeat("LotteryActivitys", "Title", para.Title, para.ID) > 0)
            {
                return(Content("活动标题已存在"));
            }
            para.IsValid = true;
            int rtn = para.EditByID();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("保存出错"));
        }
Exemplo n.º 15
0
        public ContentResult ToAdd(LotteryActivitys para)
        {
            para.IsValid = true;
            if (string.IsNullOrWhiteSpace(para.Title))
            {
                return(Content("fail|活动标题不能为空"));
            }
            if (RepeatHelper.NoRepeat("LotteryActivitys", "Title", para.Title, para.ID) > 0)
            {
                return(Content("fail|活动标题已存在"));
            }
            int rtn = para.InsertAndReturnIdentity();

            if (rtn > 0)
            {
                return(Content("ok|" + rtn));
            }
            return(Content("fail|添加出错"));
        }
        public ActionResult ToAdd(SYSIntegralCodeArea para)
        {
            if (string.IsNullOrWhiteSpace(para.AreaName))
            {
                return(Content("区域名称不能为空"));
            }

            if (RepeatHelper.NoRepeatTwoAnd("SYSIntegralCodeArea", "AreaName", para.AreaName, "ActivityID", para.ActivityID.ToString(), para.ID) > 0)
            {
                return(Content("区域名称已存在"));
            }
            int rtn = para.InsertAndReturnIdentity();

            if (rtn > 0)
            {
                para.ID = rtn;
                return(Json(para, JsonRequestBehavior.AllowGet));
            }
            return(Json("error"));
        }
Exemplo n.º 17
0
        public ContentResult ToEdit(SYSNotify para)
        {
            if (string.IsNullOrWhiteSpace(para.MsgType))
            {
                return(Content("消息类别不能为空"));
            }
            if (string.IsNullOrWhiteSpace(para.MsgCode))
            {
                return(Content("消息代号不能为空"));
            }
            if (RepeatHelper.NoRepeat("SYSNotify", "MsgCode", para.MsgCode, para.ID) > 0)
            {
                return(Content("消息代号已存在"));
            }
            int rtn = para.EditByID();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("保存出错"));
        }
Exemplo n.º 18
0
        public ContentResult ToAdd(SYSMNotify notify)
        {
            if (string.IsNullOrWhiteSpace(notify.Title))
            {
                return(Content("标题不能为空"));
            }
            if (RepeatHelper.NoRepeat("SYSMNotify", "Title", notify.Title, notify.ID) > 0)
            {
                return(Content("标题已存在"));
            }
            notify.OperCreate = CurrentUser.UserName;
            notify.DatCreate  = DateTime.Now;
            notify.DatEdit    = DateTime.Now;
            notify.OperEdit   = CurrentUser.UserName;
            int rtn = notify.InsertAndReturnIdentity();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("添加出错"));
        }
Exemplo n.º 19
0
        public ContentResult ToAdd(SYSNotify para)
        {
            if (string.IsNullOrWhiteSpace(para.MsgType))
            {
                return(Content("消息类别不能为空"));
            }
            if (string.IsNullOrWhiteSpace(para.MsgCode))
            {
                return(Content("消息代号不能为空"));
            }
            if (RepeatHelper.NoRepeat("SYSNotify", "MsgCode", para.MsgCode, para.ID) > 0)
            {
                return(Content("消息代号已存在"));
            }
            int rtn = para.InsertAndReturnIdentity();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("添加出错"));
        }
Exemplo n.º 20
0
        public ContentResult ToAdd(BaseParameters para)
        {
            if (string.IsNullOrWhiteSpace(para.ParametersKey))
            {
                return(Content("唯一标识不能为空"));
            }
            if (string.IsNullOrWhiteSpace(para.NickName))
            {
                return(Content("参数名称不能为空"));
            }
            if (RepeatHelper.NoRepeat("BaseParameters", "ParametersKey", para.ParametersKey, para.ID) > 0)
            {
                return(Content("唯一标识已存在"));
            }
            int rtn = para.InsertAndReturnIdentity();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("添加出错"));
        }
Exemplo n.º 21
0
        public ContentResult ToEditParam(LotteryActivitysRedPack para)
        {
            para.ActivityID = 1;
            if (para.MaxPrice <= 0)
            {
                return(Content("最大金额不能小于0"));
            }

            if (para.MaxPrice < para.MinPrice)
            {
                return(Content("最大金额不能小于最小金额"));
            }

            if (RepeatHelper.NoRepeatThreeAnd("LotteryActivitysRedPack", "MaxPrice", para.MaxPrice.ToString(), "MinPrice", para.MinPrice.ToString(), "ActivityID", para.ActivityID.ToString(), para.ID) > 0)
            {
                return(Content("该设置已存在"));
            }

            para.UpdateByID();

            return(Content("ok"));
        }
Exemplo n.º 22
0
        public ActionResult DirectlyIndex_inport()
        {
            C_UserType usertype = C_UserType.GetMaxLevel_UserType();



            int    idLen = C_User.GetTopUseID().ToString().Length;
            string idDQ  = (C_User.GetTopUseID() + 1).ToString();

            if (idLen < 5)
            {
                string zero = new string('0', 5 - idLen);
                idDQ = zero + idDQ;
            }
            string msg = "";

            try
            {
                var    file = Request.Files[0];
                string path = Request.MapPath("~/");
                string ext  = Path.GetExtension(file.FileName);//获得文件扩展名
                if (!Directory.Exists(Server.MapPath("~/Codetxt/")))
                {
                    Directory.CreateDirectory(Server.MapPath("~/Codetxt/"));
                }
                if (file.ContentLength == 0 || file == null)
                {
                    msg = "上传的文件没有内容!";
                    TempData["ToIndex_err"] = msg;
                    return(View());
                }
                if (file.ContentLength > 3242880)
                {
                    msg = "上传的文件不能超过3MB!!";
                    TempData["ToIndex_err"] = msg;
                    return(View());
                }
                if (ext != ".txt")
                {
                    msg = "上传文件格式不对!";
                    TempData["ToIndex_err"] = msg;
                    return(View());
                }
                string DatNow = DateTime.Now.ToString("yyyyMMddHHmmss");
                file.SaveAs(Server.MapPath("~/Codetxt/" + DatNow + ".txt"));
                StreamReader sr = new StreamReader(Server.MapPath("~/Codetxt/" + DatNow + ".txt"), Encoding.Default);
                String       line;
                var          i        = 0;
                int          idDQ_num = 0;
                while ((line = sr.ReadLine()) != null)
                {
                    i++;
                    if (i == 1)
                    {
                        continue;
                    }
                    try
                    {
                        string[] list = line.ToString().Split(',');
                        if (string.IsNullOrWhiteSpace(list[0]) || string.IsNullOrWhiteSpace(list[1]))
                        {
                            continue;
                        }
                        if (C_User.GetPhoneCnt(list[1]) > 0 || C_User.GetNameCnt(list[0]) > 0)
                        {
                            SYSLog.add("导入失败(数据重复):手机号-" + list[1] + "||经销商名称-" + list[0], "电脑端后台用户" + CurrentUser.Name + "(" + CurrentUser.UserName + ")", CurrentURL, "导入用户", "电脑后台");
                            DAL.Log.Instance.Write("数据重复:手机号-" + list[1] + "||经销商名称-" + list[0], "导入用户失败");
                            continue;
                        }

                        /* var ls = idDQ.Length;
                         * if (Convert.ToInt32(idDQ)==idDQ_num)
                         * {
                         *   idDQ = (idDQ_num + 1).ToString();
                         *   idDQ_num = Convert.ToInt32(idDQ);
                         * }
                         * else
                         * {
                         *   idDQ_num = Convert.ToInt32(idDQ);0
                         * }
                         * if (ls > idDQ.ToString().Length)
                         * {
                         *   int length1 = ls - idDQ.ToString().Length;
                         *   if (length1 == 5) idDQ = "00000" + idDQ;
                         *   if (length1 == 4) idDQ = "0000" + idDQ;
                         *   if (length1 == 3) idDQ = "000" + idDQ;
                         *   if (length1 == 2) idDQ = "00" + idDQ;
                         *   if (length1 == 1) idDQ = "0" + idDQ;
                         * }*/
                        C_User para = new C_User();
                        para.state        = "已审核";
                        para.Chief        = 0;
                        para.C_UserTypeID = 1;
                        para.UserName     = usertype.TypeCode + (C_User.GetTopUseID() + 1 + 10000);
                        //经销商名称 联系人 联系方式 省份 市区 城镇 详细地址

                        para.Name       = list[0];
                        para.Phone      = list[2];
                        para.PassWord   = para.Phone.Substring(para.Phone.Length - 6, 6);
                        para.Card       = "";
                        para.Identifier = usertype.TypeCode + (C_User.GetTopUseID() + 1 + 10000);
                        para.wxNo       = list[1];
                        if (list.Count() > 4)
                        {
                            para.Province = string.IsNullOrWhiteSpace(list[3]) ? "" : list[4];
                        }
                        if (list.Count() > 5)
                        {
                            para.City = string.IsNullOrWhiteSpace(list[4]) ? "" : list[5];
                        }
                        if (list.Count() > 6)
                        {
                            para.Area = string.IsNullOrWhiteSpace(list[5]) ? "" : list[6];
                        }
                        if (list.Count() > 7)
                        {
                            para.WxQRCode = string.IsNullOrWhiteSpace(list[6]) ? "" : list[7];
                        }
                        para.DatCreate = DateTime.Now;
                        if (string.IsNullOrWhiteSpace(para.UserName))
                        {
                            return(Content("经销商编号不能为空"));
                        }
                        if (string.IsNullOrWhiteSpace(para.Name))
                        {
                            return(Content("姓名不能为空"));
                        }
                        if (string.IsNullOrWhiteSpace(para.Identifier))
                        {
                            return(Content("授权编号不能为空"));
                        }
                        if (RepeatHelper.NoRepeat("C_User", "Identifier", para.Identifier, para.ID) > 0)
                        {
                            return(Content("授权编号已存在"));
                        }



                        para.InsertAndReturnIdentity();
                    }
                    catch (Exception e)
                    {
                        DAL.Log.Instance.Write(e.Message, "导入用户失败");
                        continue;
                    }
                }
                sr.Close();
                System.IO.File.Delete(Server.MapPath("~/Codetxt/" + DatNow + ".txt"));
                msg = "导入成功!";
                TempData["ToIndex_err"] = msg;
                return(View("DirectlyIndex"));
            }
            catch
            {
                msg = "导入失败,文件太大!!";
                TempData["ToIndex_err"] = msg;
                return(View("DirectlyIndex"));
            }
        }
Exemplo n.º 23
0
        public void Start()
        {
            switch (LoggingSourceType)
            {
            case LoggingTypeSourceEnum.Console:
                if (ConsoleProcess != null)
                {
                    if (ConsoleProcess.HasExited)
                    {
                        ConsoleProcess.Start();
                    }

                    return;
                }
                else
                {
                    if (File.Exists(FilePath))
                    {
                        ConsoleOutputStream = new ObservableCollection <OutputText>();

                        var startInfo = new ProcessStartInfo(FilePath)
                        {
                            WorkingDirectory       = RootFolderPath,
                            Arguments              = StartingArguments,
                            RedirectStandardOutput = true,
                            UseShellExecute        = false,
                            CreateNoWindow         = true
                        };
                        ConsoleProcess = new System.Diagnostics.Process {
                            StartInfo = startInfo
                        };

                        ConsoleProcess.EnableRaisingEvents = true;

                        var setts = MeasureSettings.Where(x => x.IsReadyToUse && x.IsActive);

                        ConsoleProcess.OutputDataReceived += (sender, args) =>
                        {
                            if (!_isAppClosing && args.Data != null)
                            {
                                App.Current.Dispatcher.Invoke((System.Action) delegate
                                {
                                    var rowData = args.Data.Trim();

                                    CreateMeasureUnit(rowData, DateTime.Now);
                                    PublishMessageToConsole(rowData);
                                });
                            }
                        };
                        ConsoleProcess.Exited += (sender, args) =>
                        {
                            InProgress = false;
                        };

                        ConsoleProcess.Start();
                        ConsoleProcess.BeginOutputReadLine();
                    }
                    else
                    {
                        Console.WriteLine("File not found.");
                        InProgress = false;
                    }
                }

                _calculationCancellationTokenSource = new CancellationTokenSource();
                _calculationWorker = RepeatHelper.Interval(TimeSpan.FromSeconds(LoopingDelay), () => EvaluateUnitData(), _calculationCancellationTokenSource.Token);

                break;

            case LoggingTypeSourceEnum.RabbitMQ:

                var con = ConfigurationManager.AppSettings.Get(Constants.RabbitMQConnectionName);

                if (con == null)
                {
                    con = @"host=localhost;port=5672;virtualHost=/;username=admin;password=admin;requestedHeartbeat=0";
                }

                var processMQId = $"{FileName}_{Guid.NewGuid()}";
                bus = RabbitHutch.CreateBus(con);
                var exchange = bus.Advanced.ExchangeDeclare("Ariane.MQ", ExchangeType.Topic, autoDelete: true);

                // stops disposes bus and kills queue
                //queue = bus.Advanced.QueueDeclare(processMQId, autoDelete: true, perQueueMessageTtl: 10000);
                queue = bus.Advanced.QueueDeclare(processMQId, autoDelete: true);
                var q = bus.Advanced.Bind(exchange, queue, RabbitMQTopicName);

                bus.Advanced.Consume <LogMessageBase>(queue, (x, a) => {
                    var log = x.Body;

                    string rowData;
                    var m = $"{log.TimeStamp.ToString("HH:mm:ss")} -{log.Level}- {log.FormattedMessage}";

                    // apply aditional formatting
                    if (!String.IsNullOrEmpty(log.Message))
                    {
                        rowData = String.Format(log.Message, m);
                    }
                    else
                    {
                        rowData = m;
                    }

                    var timeStamp = log.TimeStamp;

                    CreateMeasureUnit(rowData, timeStamp);
                    Application.Current.Dispatcher.Invoke(delegate
                    {
                        PublishMessageToConsole(rowData);
                    });

                    //}, x => {
                    //x.WithTopic(RabbitMQTopicName);
                });

                InProgress = true;

                break;

            default:
                throw new Exception($"Logging source '{LoggingSourceType}' has not supported.");
            }
        }