public ActionResult XiaoFeiJiLu(int current = 1)
        {
            if (current > 1)
            {
                ViewBag.currents = current - 1;
            }
            else
            {
                ViewBag.currents = 1;
            }
            ConsumeManager a       = new ConsumeManager();
            int            count   = 5;
            List <consume> consume = a.GetAll();
            //List<consume> consume = a.Where(x => x.consume_Condition == "可见").ToList();
            var list = consume.OrderByDescending(x => x.consume_Time).Skip((current - 1) * 5).Take(count).ToList();

            int zongshu = consume.Count();
            int zongye  = zongshu / count;

            zongye = zongshu % count == 0 ? zongye : zongye + 1;
            if (current < zongye)
            {
                ViewBag.currentc = current + 1;
            }
            else
            {
                ViewBag.currentc = zongye;
            }
            ViewBag.zongye  = zongye;
            ViewBag.current = current;
            return(View(list));
        }
        //员工缴费状态
        public ActionResult XiaoFeiDelete(int id)
        {
            //根据id,找到这个对象
            ConsumeManager aa   = new ConsumeManager();
            var            info = aa.GetByPK(id);

            if (info.consume_Condition == "可见")
            {
                info.consume_Condition = "不可见";
                var qq = aa.Update(info);
                if (qq)
                {
                    return(Redirect("~/ZhengLiang/FinanceHT/XiaoFeiJiLu"));
                }
                else
                {
                    return(Content("<script>alert('异常');window.location = '/ZhengLiang/FinanceHT/XiaoFeiJiLu';</script>"));
                }
            }
            else
            {
                info.consume_Condition = "可见";
                var qq = aa.Update(info);
                if (qq)
                {
                    return(Redirect("~/ZhengLiang/FinanceHT/XiaoFeiJiLu"));
                }
                else
                {
                    return(Content("<script>alert('异常');window.location = '/ZhengLiang/FinanceHT/XiaoFeiJiLu';</script>"));
                }
            }
        }
        public ActionResult XiaoFeiAdd(consume info)
        {
            //查询出总经费
            MoneyManager aa  = new MoneyManager();
            money        mys = aa.GetByPK(1);

            if (info.consume_money <= mys.overmoney)
            {
                ConsumeManager a  = new ConsumeManager();
                var            qq = a.Add(info);
                if (qq)
                {
                    if (mys.overmoney == null)
                    {
                        mys.overmoney = 0;
                    }
                    if (mys.openmoney == null)
                    {
                        mys.openmoney = 0;
                    }
                    //修改总经费
                    money my = new money();
                    if (my.overmoney == null)
                    {
                        my.overmoney = 0;
                    }
                    if (my.openmoney == null)
                    {
                        my.openmoney = 0;
                    }
                    my.sunId     = 1;
                    my.overmoney = (mys.overmoney - info.consume_money);
                    my.openmoney = (mys.openmoney + info.consume_money);
                    MoneyManager aq  = new MoneyManager();
                    var          boo = aq.Update(my);
                    if (boo)
                    {
                        return(Redirect("~/ZhengLiang/FinanceHT/XiaoFeiAdd"));
                    }

                    else
                    {
                        return(Redirect("~/ZhengLiang/FinanceHT/XiaoFeiAdd"));
                    }
                }
                else
                {
                    return(Content("<script>alert('添加失败')</script>"));
                }
            }
            else
            {
                return(Content("<script>alert('余额不足');window.location = '/ZhengLiang/FinanceHT/XiaoFeiAdd';</script>"));
            }
        }
Exemple #4
0
        static async Task Main(string[] args)
        {
            var settings = new RabbitMqConfig
            {
                HostName       = "localhost",
                Port           = 5672,
                UserName       = "******",
                Password       = "******",
                VirtualHost    = "/",
                ExchangePrefix = "myTestExchange",
            };

            using var consumeMngr = ConsumeManager.Create(settings);
            consumeMngr.AddConsumer("myTestQueue2", new Action <TestDto>(TestConsumer.ProcessMessage), true);

            consumeMngr.ConnectionRecoveredEvent += RabbitConnectionRecovered;
            consumeMngr.ConnectionShutdownEvent  += RabbitConnectionShutdown;


            var pubSrv = PublishService.Create(settings);

            Console.WriteLine("App started");

            var id = 0;

            while (true)
            {
                Console.WriteLine();

                var message = Console.ReadLine();

                if (message == "q" || message == "quit")
                {
                    break;
                }

                var dto = new TestDto
                {
                    Id      = ++id,
                    Guid    = Guid.NewGuid(),
                    Message = message
                };

                await pubSrv.PublishAsync(dto);

                pubSrv.Publish(dto);
            }

            consumeMngr.ConnectionRecoveredEvent -= RabbitConnectionRecovered;
            consumeMngr.ConnectionShutdownEvent  -= RabbitConnectionShutdown;
        }
        public ActionResult XiaoFeiJiLu(consume info)
        {
            if (info.consume_Condition.Equals("全部"))
            {
                int current = 1;
                if (current > 1)
                {
                    ViewBag.currents = current - 1;
                }
                else
                {
                    ViewBag.currents = 1;
                }
                int            count = 5;
                ConsumeManager a     = new ConsumeManager();

                if (info.consume_cause == null)
                {
                    List <consume> detail  = a.GetAll();
                    var            list    = detail.OrderByDescending(x => x.consume_Time).Skip((current - 1) * count).Take(count).ToList();
                    int            zongshu = detail.Count();
                    int            zongye  = zongshu / count;
                    zongye = zongshu % count == 0 ? zongye : zongye + 1;
                    if (current < zongye)
                    {
                        ViewBag.currentc = current + 1;
                    }
                    else
                    {
                        ViewBag.currentc = zongye;
                    }
                    ViewBag.zongye  = zongye;
                    ViewBag.current = current;
                    return(View(list));
                }
                else
                {
                    List <consume> detail = a.Where(x => x.consume_cause.Contains(info.consume_cause)).ToList();
                    var            list   = detail.OrderByDescending(x => x.consume_Time).Skip((current - 1) * count).Take(count).ToList();

                    int zongshu = detail.Count();
                    int zongye  = zongshu / count;
                    zongye = zongshu % count == 0 ? zongye : zongye + 1;
                    if (current < zongye)
                    {
                        ViewBag.currentc = current + 1;
                    }
                    else
                    {
                        ViewBag.currentc = zongye;
                    }
                    ViewBag.zongye  = zongye;
                    ViewBag.current = current;
                    return(View(list));
                }
            }
            else
            {
                int current = 1;
                if (current > 1)
                {
                    ViewBag.currents = current - 1;
                }
                else
                {
                    ViewBag.currents = 1;
                }
                int            count = 5;
                ConsumeManager a     = new ConsumeManager();
                //List<action> detail = a.GetAll();
                if (info.consume_cause == null)
                {
                    List <consume> detail  = a.Where(x => x.consume_Condition == info.consume_Condition).ToList();
                    var            list    = detail.OrderByDescending(x => x.consume_Time).Skip((current - 1) * count).Take(count).ToList();
                    int            zongshu = detail.Count();
                    int            zongye  = zongshu / count;
                    zongye = zongshu % count == 0 ? zongye : zongye + 1;
                    if (current < zongye)
                    {
                        ViewBag.currentc = current + 1;
                    }
                    else
                    {
                        ViewBag.currentc = zongye;
                    }
                    ViewBag.zongye  = zongye;
                    ViewBag.current = current;
                    return(View(list));
                }
                else
                {
                    List <consume> detail = a.Where(x => x.consume_cause.Contains(info.consume_cause) && x.consume_Condition == info.consume_Condition).ToList();
                    //List<action> detail = a.Where(x => x.actionhead.Contains(info.actionhead)).ToList();
                    var list = detail.OrderByDescending(x => x.consume_Time).Skip((current - 1) * count).Take(count).ToList();

                    int zongshu = detail.Count();
                    int zongye  = zongshu / count;
                    zongye = zongshu % count == 0 ? zongye : zongye + 1;
                    if (current < zongye)
                    {
                        ViewBag.currentc = current + 1;
                    }
                    else
                    {
                        ViewBag.currentc = zongye;
                    }
                    ViewBag.zongye  = zongye;
                    ViewBag.current = current;
                    return(View(list));
                }
            }
        }
        // GET: ZhengLiang/FinanceQT
        public ActionResult Show(int index = 1, int indexs = 1)
        {
            if (index > 1)
            {
                ViewBag.index1 = index - 1;
            }
            else
            {
                ViewBag.index1 = 1;
            }
            if (indexs > 1)
            {
                ViewBag.indexss = indexs - 1;
            }
            else
            {
                ViewBag.indexss = 1;
            }
            int           count  = 3;
            ActionManager a      = new ActionManager();
            List <action> action = a.Where(x => x.actiontype == "通过").ToList();
            var           list   = action.OrderBy(x => x.actiontime).Skip((index - 1) * count).Take(count).ToList();


            int zongshu = action.Count();
            int zongye  = zongshu / count;

            zongye = zongshu % count == 0 ? zongye : zongye + 1;
            if (index < zongye)
            {
                ViewBag.zongyeqq = index + 1;;
            }
            else
            {
                ViewBag.zongyeqq = zongye;
            }
            ViewBag.zongshu = zongshu;
            ViewBag.index   = index;
            ViewBag.list    = list;

            ConsumeManager aa       = new ConsumeManager();
            List <consume> consume  = aa.GetAll();
            var            lists    = consume.OrderBy(x => x.consume_Time).Skip((indexs - 1) * count).Take(count).ToList();
            int            zongshus = consume.Count();
            int            zongyes  = zongshus / count;

            zongyes = zongshus % count == 0 ? zongyes : zongyes + 1;
            if (indexs < zongyes)
            {
                ViewBag.zongyeaa = indexs + 1;
            }
            else
            {
                ViewBag.zongyeaa = zongye;
            }
            ViewBag.zongyes = zongyes;
            ViewBag.indexs  = indexs;
            ViewBag.lists   = lists;


            return(View());
        }
Exemple #7
0
 public override void func(int type)
 {
     ConsumeManager.damage();
 }