コード例 #1
0
        private void LoadSpendInfoByCustoNo(string custoNo)
        {
            List <Spend> lstSource = new SpendService().SelectSpendByCustoNo(custoNo);

            this.dgvRoomSell.DataSource          = lstSource;
            this.dgvRoomSell.AutoGenerateColumns = false;
        }
コード例 #2
0
        public void Calculate_TotalSpend_GroupedByYears_ForInternalSupplier()
        {
            Mock <ISupplierService>              supplierServiceMock   = new Mock <ISupplierService>();
            Mock <IInvoiceRepository>            invoiceRepositoryMock = new Mock <IInvoiceRepository>();
            Mock <IExternalInvoiceProcessor>     externalInvoiceServiceProcessorMock = new Mock <IExternalInvoiceProcessor>();
            Mock <IExternalInvoiceServiceFacade> externalInvoiceSericeFacadeMock     = new Mock <IExternalInvoiceServiceFacade>();

            var sut = new SpendService(supplierServiceMock.Object, invoiceRepositoryMock.Object,
                                       externalInvoiceServiceProcessorMock.Object);

            supplierServiceMock.SetupAllProperties();
            supplierServiceMock.Setup(x => x.GetById(It.IsAny <int>()))
            .Returns(new SupplierBuilder().WithInternalSupplier().WithName("InternalSupplier").Build());
            invoiceRepositoryMock.Setup(x => x.Get()).Returns(new InvoiceBuilder().SampleInvoices().AsQueryable);


            var spendSummary = sut.GetTotalSpend(1);

            Assert.NotNull(spendSummary);
            Assert.Equal("InternalSupplier", spendSummary.Name);
            Assert.Equal(2, spendSummary.Years.Count);
            Assert.Equal(2010, spendSummary.Years[0].Year);
            Assert.Equal(200, spendSummary.Years[0].TotalSpend);
            Assert.Equal(2011, spendSummary.Years[1].Year);
            Assert.Equal(400, spendSummary.Years[1].TotalSpend);

            invoiceRepositoryMock.Verify(x => x.Get(), Times.Once);
            externalInvoiceServiceProcessorMock.Verify(x => x.Process(It.IsAny <int>()), Times.Never);
        }
コード例 #3
0
 private void btnBalance_Click(object sender, EventArgs e)
 {
     if (txtReceipts.Text != "" && Convert.ToInt32(txtReceipts.Text) >= Convert.ToInt32(lblVIPPrice.Text))
     {
         Room   r         = RoomService.SelectRoomByRoomNo(txtRoomNo.Text); //根据房间编号查询房间信息
         string checktime = r.CheckTime.ToString();                         //获取入住时间
         if (SpendService.UpdateMoneyState(txtRoomNo.Text, checktime) > 0)
         {
             int n = RoomService.UpdateRoomByRoomNo(txtRoomNo.Text);
             if (n > 0)
             {
                 this.Close();
             }
             else
             {
                 return;
             }
             MessageBox.Show("结算成功!", "系统提示");
         }
         else
         {
             MessageBox.Show("结算失败!", "系统提示");
         }
     }
     else
     {
         MessageBox.Show("输入金额有误,请重新输入!", "系统提示");
     }
 }
コード例 #4
0
        public JsonResult SpendTransfer(SpendTransferViewModel model)
        {
            Mapper.Initialize(cfg => cfg.CreateMap <SpendTransferViewModel, SpendTransfer>());
            SpendTransfer trans = Mapper.Map <SpendTransferViewModel, SpendTransfer>(model);

            SpendService.Instance(UserSid).CreateTransfer(trans);
            return(Json(new { }));
        }
コード例 #5
0
        public JsonResult GetLastadd()
        {
            int totalCount;
            var list   = SpendService.Instance(UserSid).GetSpendList(out totalCount, 1, 3);
            var models = Spend2SpendViewModel.MapList2LastAddViewModelList(list);

            return(Json(models));
        }
コード例 #6
0
        public JsonResult GetTop()
        {
            //var list = Spend.GetTop(ClientId, 7);
            var list   = SpendService.Instance(UserSid).GetTop(7);
            var models = Spend2SpendViewModel.MapList2TopViewModelList(list);

            return(Json(models));
        }
コード例 #7
0
        public JsonResult SpendExpense(SpendNewViewModel model)
        {
            var spend = SpendViewModel2Spend.Map(model);

            SpendService.Instance(UserSid).CreateExpense(spend);
            //model.Save(ClientId);
            return(Json(new { }));
            //return RedirectToAction("New");
        }
コード例 #8
0
        public ActionResult SpendDelete(int?id)
        {
            if (!id.HasValue)
            {
                return(HttpNotFound());
            }
            SpendService.Instance(UserSid).SpendDelete(id.Value);

            return(Json(new { }));
        }
コード例 #9
0
        public void SpendService_ExternalCustomer_Spend_FailoverCase_ObsoleteDate_Test()
        {
            // Arrange
            int          supplierId   = 4;
            SpendService spendService = container.Resolve <ExternalSpendService>();

            // Act
            SpendSummary result = spendService.GetTotalSpend(supplierId);

            // Assert - See Exception
        }
コード例 #10
0
        public ActionResult Stat(int?id)
        {
            if (!id.HasValue)
            {
                return(HttpNotFound());
            }
            int year  = DateTime.Now.Year;
            int month = DateTime.Now.Month;
            var stat  = SpendService.Instance(UserSid).GetMonthlyBilleport(year, month, billId: id).First();

            return(View(stat));
        }
コード例 #11
0
        static void Main(string[] args)
        {
            SpendService spendService = new SpendService(
                new SupplierService(),
                new InvoiceRepository(),
                new ExternalInvoiceProcessor(new ExternalInvoiceServiceFacade(), new FailoverInvoiceService()));

            var spendSummary  = spendService.GetTotalSpend(1);
            var spendSummary2 = spendService.GetTotalSpend(2);

            Console.ReadLine();
        }
コード例 #12
0
        public void SpendService_ExternalCustomer_Name_Test()
        {
            // Arrange
            int          supplierId   = 2;
            SpendService spendService = container.Resolve <ExternalSpendService>();

            // Act
            SpendSummary result = spendService.GetTotalSpend(supplierId);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Supplier External", result.Name);
        }
コード例 #13
0
        public FileResult PrintExpensesPDF(int id, int month)
        {
            DateTime now         = DateTime.Now;
            var      startDate   = new DateTime(now.Year, month, 1);
            var      endDate     = startDate.AddMonths(1).AddDays(-1);
            var      spendsList  = SpendService.GetByConsortiumId(id, startDate, endDate);
            var      unitsReport = this.ConsortiumService.GetConsortiumAccountStatusSummary(id, month);
            var      consortium  = ConsortiumService.GetConsortium(id);

            var expensesHtml = ExpensesBillService.GetExpensesBill(consortium, spendsList, unitsReport, month);

            return(File(ExpensesBillService.GetPDFTickets(expensesHtml), "application/pdf"));
        }
コード例 #14
0
        public ContentResult PrintExpensesHtml(int id, int month)
        {
            DateTime now         = DateTime.Now;
            var      startDate   = new DateTime(now.Year, month, 1);
            var      endDate     = startDate.AddMonths(1).AddDays(-1);
            var      spendsList  = SpendService.GetByConsortiumId(id, startDate, endDate);
            var      unitsReport = this.ConsortiumService.GetConsortiumAccountStatusSummary(id, month);
            var      consortium  = ConsortiumService.GetConsortium(id);

            var expensesHtml = ExpensesBillService.GetExpensesBill(consortium, spendsList, unitsReport, month);

            return(Content("<style>" + expensesHtml.HtmlExpensesStyles + "</style>\n" + expensesHtml.HtmlExpenses));
        }
コード例 #15
0
        public void SpendService_ExternalCustomer_Spend_ReturnToNormalAfter1Minute_Test()
        {
            // Arrange
            Mock <ICircuitBreaker> mockedInstance = new Mock <ICircuitBreaker>();

            mockedInstance.Setup(mc => mc.ClosedTimeSeconds).Returns(5); // Adjust Timeout to 5 Seconds
            mockedInstance.Setup(mc => mc.GetSpendDetail(2)).Returns(    // Set Data
                new List <SpendDetail>(
                    new SpendDetail[] {
                new SpendDetail()
                {
                    TotalSpend = 1001, Year = 2018
                },
                new SpendDetail()
                {
                    TotalSpend = 1001, Year = 2017
                }
            }
                    ));

            UnityContainer container = new UnityContainer();

            container.RegisterType <ISupplierDataService, SupplierDataServiceStub>();
            container.RegisterType <ISupplierService, SupplierService>();
            container.RegisterType <IInvoiceRepository, InvoiceRepositoryStub>();
            container.RegisterType <IExternalSpendService, ExternalInvoiceServiceStub>();
            container.RegisterType <ICircuitBreaker, ExternalSpendServiceInvoker>();
            container.RegisterType <IFailoverInvoiceService, FailoverInvoiceServiceStub>();

            SpendService spendService   = container.Resolve <ExternalSpendService>();
            SpendSummary resultFailover = spendService.GetTotalSpend(3);

            Thread.Sleep(1000 * 5 + 1); // Wait 6 Seconds

            // Act
            container.RegisterInstance <ICircuitBreaker>(mockedInstance.Object);
            spendService = container.Resolve <ExternalSpendService>();
            SpendSummary resultNormal = spendService.GetTotalSpend(2);

            // Assert
            Assert.IsNotNull(resultFailover);
            Assert.AreEqual("Supplier External (Failover)", resultFailover.Name);
            Assert.AreEqual(1, resultFailover.Years.Count);
            Assert.AreEqual(900, resultFailover.Years[0].TotalSpend);

            Assert.IsNotNull(resultNormal);
            Assert.AreEqual("Supplier External", resultNormal.Name);
            Assert.AreEqual(2, resultNormal.Years.Count);
            Assert.AreEqual(1001, resultNormal.Years[0].TotalSpend);
            Assert.AreEqual(1001, resultNormal.Years[1].TotalSpend);
        }
コード例 #16
0
ファイル: BaseController.cs プロジェクト: WakeDown/OwnAgent
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            UserSid         = User.Identity.GetUserId();
            ViewBag.UserSid = UserSid;

            //Создание категорий для нового пользователя
            if (!String.IsNullOrEmpty(UserSid) && (Session["HasDefaultValues"] == null || !Convert.ToBoolean(Session["HasDefaultValues"])))
            {
                SpendService.Instance(UserSid).CreateDefaultBills();
                SpendService.Instance(UserSid).CreateDefaultCategories();
                Session["HasDefaultValues"] = true;
            }

            base.OnActionExecuting(filterContext);
        }
コード例 #17
0
        public void SpendService_ExternalCustomer_Spend_FailoverCase_Test()
        {
            // Arrange
            int          supplierId   = 3;
            SpendService spendService = container.Resolve <ExternalSpendService>();

            // Act
            SpendSummary result = spendService.GetTotalSpend(supplierId);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Supplier External (Failover)", result.Name);
            Assert.AreEqual(1, result.Years.Count);
            Assert.AreEqual(900, result.Years[0].TotalSpend);
        }
コード例 #18
0
        public void SpendService_ExternalCustomer_Spend_ActionCase_Test()
        {
            // Arrange
            int          supplierId   = 2;
            SpendService spendService = container.Resolve <ExternalSpendService>();

            // Act
            SpendSummary result = spendService.GetTotalSpend(supplierId);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Years.Count);
            Assert.AreEqual(1000, result.Years[0].TotalSpend);
            Assert.AreEqual(1000, result.Years[1].TotalSpend);
        }
コード例 #19
0
        public ActionResult List(string filter = null, int?year = null, int?month = null, int?quarter = null, int?categoryId = null, int?vectorId = null, int?billId = null)
        {
            DateTime?dateStart = null;
            DateTime?dateEnd   = null;

            if (!year.HasValue)
            {
                year = DateTime.Now.Year;
            }
            if (!month.HasValue)
            {
                month = DateTime.Now.Month;
            }
            if (filter == "month")
            {
                dateStart = new DateTime(year.Value, month.Value, 1);
                dateEnd   = new DateTime(year.Value, month.Value, DateTime.DaysInMonth(year.Value, month.Value));
            }
            if (filter == "quarter")
            {
                dateEnd = new DateTime(year.Value, month.Value, DateTime.DaysInMonth(year.Value, month.Value));
                var startMonth = dateEnd.Value.AddMonths(-3).Month;
                var startYear  = dateEnd.Value.AddMonths(-3).Year;
                dateStart = new DateTime(startYear, startMonth, 1);
            }
            if (filter == "year")
            {
                dateEnd = new DateTime(year.Value, month.Value, DateTime.DaysInMonth(year.Value, month.Value));
                var startMonth = dateEnd.Value.AddMonths(-12).Month;
                var startYear  = dateEnd.Value.AddMonths(-12).Year;
                dateStart = new DateTime(startYear, startMonth, 1);
            }
            if (filter == "5year")
            {
                dateEnd = new DateTime(year.Value, month.Value, DateTime.DaysInMonth(year.Value, month.Value));
                var startMonth = dateEnd.Value.AddYears(-5).Month;
                var startYear  = dateEnd.Value.AddYears(-5).Year;
                dateStart = new DateTime(startYear, startMonth, 1);
            }

            //var list =Spend.GetList(ClientId);
            int totalCount;
            var list = SpendService.Instance(UserSid).GetSpendList(out totalCount, dateStart: dateStart, dateEnd: dateEnd, categoryId: categoryId, vectorId: vectorId, billId: billId);

            return(View(list));
        }
コード例 #20
0
        public ActionResult SpendCategoryDelete(int?id)
        {
            if (!id.HasValue)
            {
                return(HttpNotFound());
            }
            try
            {
                SpendService.Instance(UserSid).SpendCategoryDelete(id.Value);
            }
            catch (ArgumentException ex)
            {
                return(Json(new { responseText = ex.Message }));
            }

            return(Json(new { }));
        }
コード例 #21
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (rs == 1)//判断房间编号是否可消费
            {
                if (CheckInput())
                {
                    SellThing st = new SellService().SelectSellThingByNo(txtSellNo.Text);

                    Room  r = new RoomService().SelectRoomByRoomNo(txtRoomNo.Text);
                    Spend s = new Spend()
                    {
                        RoomNo      = txtRoomNo.Text,
                        SpendName   = txtSellName.Text,
                        SpendAmount = (int)nudNum.Value,
                        CustoNo     = r.CustoNo,
                        SpendPrice  = Convert.ToDecimal(txtPrice.Text),
                        SpendMoney  = Convert.ToDecimal(Convert.ToDouble(txtPrice.Text) * nudNum.Value),
                        SpendTime   = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                        MoneyState  = "未结算",
                    };
                    bool m = new SpendService().InsertSpendInfo(s);
                    if (m == true)
                    {
                        string Stock = (st.Stock - nudNum.Value).ToString();
                        bool   n     = new SellService().UpdateSellThing(Stock, st.SellNo);
                        MessageBox.Show("添加成功");
                        LoadSpendInfoByCustoNo(r.CustoNo);
                        LoadSellThingInfo();
                        #region 获取添加操作日志所需的信息
                        OperationLog o = new OperationLog();
                        o.OperationTime    = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd,HH:mm:ss"));
                        o.Operationlog     = LoginInfo.WorkerClub + LoginInfo.WorkerPosition + LoginInfo.WorkerName + "于" + DateTime.Now + "帮助" + s.CustoNo + "进行了消费商品:" + txtSellName.Text + "操作!";
                        o.OperationAccount = LoginInfo.WorkerNo;
                        o.datains_usr      = LoginInfo.WorkerNo;
                        o.datains_date     = DateTime.Now;
                        #endregion
                        new OperationlogService().InsertOperationLog(o);
                    }
                    else
                    {
                        MessageBox.Show("添加失败");
                    }
                }
            }
        }
コード例 #22
0
        public void TestMethod_External()
        {
            int supplierId        = 1;
            List <SpendDetail> sd = new List <SpendDetail>();

            sd.Add(new SpendDetail()
            {
                TotalSpend = 5000, Year = DateTime.Now.Year
            });
            sd.Add(new SpendDetail()
            {
                TotalSpend = 7000, Year = DateTime.Now.AddYears(-1).Year
            });
            sd.Add(new SpendDetail()
            {
                TotalSpend = 8000, Year = DateTime.Now.AddYears(-2).Year
            });
            sd.Add(new SpendDetail()
            {
                TotalSpend = 9000, Year = DateTime.Now.AddYears(-3).Year
            });
            SpendSummary expectedspsum = new SpendSummary()
            {
                Name = "Bob", Years = sd
            };
            SpendSummary actualspsum = new SpendSummary();



            actualspsum = new SpendService().GetTotalSpend(supplierId);
            Assert.AreEqual(expectedspsum.Name, actualspsum.Name);
            if (expectedspsum.Years.Count == actualspsum.Years.Count)
            {
                foreach (SpendDetail spd in actualspsum.Years)
                {
                    Assert.IsNotNull(expectedspsum.Years.Find(x => x.TotalSpend == spd.TotalSpend && x.Year == spd.Year));
                }
            }
            else
            {
                Assert.Fail();
            }
        }
コード例 #23
0
ファイル: SpendServiceTest.cs プロジェクト: azsatti/CodeT
        public void Test_ExternalSupplierWithoutFailOver()
        {
            var loggerFactory = new LoggerFactory().AddConsole(LogLevel.Information);
            var supplier      = new Supplier(1, "External Supplier Without failover", true);
            var mockSupplier  = new Mock <ISupplierService>();

            mockSupplier.Setup(m => m.GetById(1)).Returns(supplier);
            mockSupplier.Verify();
            var mockRepository = new Mock <ISpendService>();
            var mockFailover   = new Mock <IFailoverInvoiceService>();

            var spendService = new SpendService(mockSupplier.Object,
                                                mockRepository.Object,
                                                mockFailover.Object,
                                                loggerFactory); // We can replace with other loggers etc

            var result = spendService.GetTotalSpend(1);

            result.Name.Should().Be("External Supplier Without failover");
        }
コード例 #24
0
        public SpendServiceTests()
        {
            var container = new UnityContainer();

            container.RegisterType <IInvoiceRepository, InvoiceRepository>();
            container.RegisterType <ISupplierService, SupplierService>();

            this._spendService      = container.Resolve <SpendService>();
            this._supplierService   = container.Resolve <SupplierService>();
            this._invoiceRepository = container.Resolve <InvoiceRepository>();

            var jsonSuppliersData = File.ReadAllText("SuppliersData.json");

            this._supplierService.Suppliers = JsonConvert.DeserializeObject <List <Supplier> >(jsonSuppliersData);

            var jsonInvoicesData = File.ReadAllText("InvoicesData.json");

            this._invoiceRepository.Invoices = JsonConvert.DeserializeObject <List <Invoice> >(jsonInvoicesData);

            this._spendService.supplierService   = this._supplierService;
            this._spendService.invoiceRepository = this._invoiceRepository;
        }
コード例 #25
0
        public void InvokeExternalInvoiceService_For_ExternalSupplier()
        {
            Mock <ISupplierService>              supplierServiceMock   = new Mock <ISupplierService>();
            Mock <IInvoiceRepository>            invoiceRepositoryMock = new Mock <IInvoiceRepository>();
            Mock <IExternalInvoiceProcessor>     externalInvoiceServiceProcessorMock = new Mock <IExternalInvoiceProcessor>();
            Mock <IExternalInvoiceServiceFacade> externalInvoiceSericeFacadeMock     = new Mock <IExternalInvoiceServiceFacade>();

            var sut = new SpendService(supplierServiceMock.Object, invoiceRepositoryMock.Object,
                                       externalInvoiceServiceProcessorMock.Object);

            supplierServiceMock.SetupAllProperties();

            supplierServiceMock.Setup(x => x.GetById(It.IsAny <int>()))
            .Returns(new Supplier()
            {
                Id = 1, IsExternal = true, Name = "Internal Supplier"
            });
            sut.GetTotalSpend(1);

            invoiceRepositoryMock.Verify(x => x.Get(), Times.Never);
            externalInvoiceServiceProcessorMock.Verify(x => x.Process(It.IsAny <int>()), Times.Once);
        }
コード例 #26
0
        public ActionResult GetCategoryChartDataGroupByMonthes(string filter, int?year, int?quarter = null, string vectorSysName = null, int?cat = null, int?bill = null)
        {
            IEnumerable <KeyValuePair <string, IEnumerable <SpendChartViewModel> > > list = new List <KeyValuePair <string, IEnumerable <SpendChartViewModel> > >();

            if (filter == "year")
            {
                list = SpendService.Instance(UserSid)
                       .GetYearlyCategoryChartDataGroupByMonthes(year.Value, vectorSysName, cat, bill);
            }
            //.Where(x=>x.Key.Contains("Бензин"));
            //if (filter == "5year") list = SpendService.Instance(UserSid).Get5YearlyCumulativeTotalChartData(year.Value);
            //if (filter == "alltime") list = SpendService.Instance(UserSid).GetAllTimeCumulativeTotalChartData();

            //var viewList = new List<SpendChartGroupByViewModel>();

            //for (int i = 0; i < 12; i++)
            //{

            //    foreach (var item in list)
            //    {

            //        var listItem = new SpendChartGroupByViewModel()
            //        {
            //            CategoryName = item.Key,
            //        };
            //        var values = new List<SpendChartViewModel>();

            //        var value = new SpendChartViewModel();



            //    }
            //    listItem.Values = values;
            //    viewList.Add(listItem);
            //}

            return(Json(list));
        }
コード例 #27
0
        public void ItShouldSendARequestToEbayBasedOnARandomKeyword()
        {
            var          keywordsRepository = Substitute.For <IKeywordRepository>();
            const string keyword            = "keyword";

            keywordsRepository.GetRandomKeyword().Returns(keyword);


            const string itemName    = "WASHING MACHINE";
            const string imageUrl    = "image url";
            const string bigImageUrl = "big image url";
            const string itemUrl     = "item url";
            const double price       = 29.99;

            var ebayService = Substitute.For <IEbayService>();

            ebayService.GetEbayProduct(keyword).Returns(new EbayProductModel
            {
                Price       = price,
                BigImageUrl = bigImageUrl,
                ImageUrl    = imageUrl,
                ItemUrl     = itemUrl,
                Name        = itemName
            });

            var mapper = MapperConfig.Initialise();

            var sut = new SpendService(keywordsRepository, ebayService, mapper);

            var actual = sut.GetRandomIdea();

            Assert.That(actual.Name, Is.EqualTo(itemName));
            Assert.That(actual.LinkToArticle, Is.EqualTo(itemUrl));
            Assert.That(actual.ImageUrl, Is.EqualTo(imageUrl));
            Assert.That(actual.Price, Is.EqualTo(price));
            Assert.That(actual.BigImageUrl, Is.EqualTo(bigImageUrl));
        }
コード例 #28
0
        public void Calculate_TotalSpend_GroupedByYears_ForExternalSupplier()
        {
            Mock <ISupplierService>              supplierServiceMock   = new Mock <ISupplierService>();
            Mock <IInvoiceRepository>            invoiceRepositoryMock = new Mock <IInvoiceRepository>();
            Mock <IExternalInvoiceProcessor>     externalInvoiceServiceProcessorMock = new Mock <IExternalInvoiceProcessor>();
            Mock <IExternalInvoiceServiceFacade> externalInvoiceSericeFacadeMock     = new Mock <IExternalInvoiceServiceFacade>();
            Mock <IFailoverInvoiceService>       failOverInvoiceServiceMock          = new Mock <IFailoverInvoiceService>();


            var sut = new SpendService(supplierServiceMock.Object, invoiceRepositoryMock.Object,
                                       new ExternalInvoiceProcessor(externalInvoiceSericeFacadeMock.Object, failOverInvoiceServiceMock.Object));


            supplierServiceMock.SetupAllProperties();
            supplierServiceMock.Setup(x => x.GetById(It.IsAny <int>()))
            .Returns(new SupplierBuilder().WithExternalSupplier().WithName("ExternalSupplier").Build());
            externalInvoiceSericeFacadeMock.Setup(x => x.GetInvoices(It.IsAny <string>())).Returns(new ExternalInvoiceBuilder().SampleExternalInvoices());


            var spendSummary = sut.GetTotalSpend(1);

            invoiceRepositoryMock.Verify(x => x.Get(), Times.Never);
            externalInvoiceSericeFacadeMock.Verify(x => x.GetInvoices(It.IsAny <string>()), Times.AtLeastOnce);
        }
コード例 #29
0
        public ActionResult GetDifferenceChartData(string filter, int?year, int?month)
        {
            if (String.IsNullOrEmpty(filter))
            {
                return(RedirectToAction("SpendCategoryReport", new { filter = "month" }));
            }
            if (!year.HasValue)
            {
                return(RedirectToAction("SpendCategoryReport", new { filter = filter, year = DateTime.Now.Year, month = month }));
            }
            if (!month.HasValue)
            {
                return(RedirectToAction("SpendCategoryReport", new { filter = filter, year = year, month = DateTime.Now.Month }));
            }

            IEnumerable <SpendChartViewModel> list = new List <SpendChartViewModel>();

            if (filter == "month")
            {
                list = SpendService.Instance(UserSid).GetDifferenceMonthlyChartData(year.Value, month.Value);
            }

            return(Json(list));
        }
コード例 #30
0
ファイル: SpendsController.cs プロジェクト: BrunoBog/Finance
 public SpendsController(SpendService ss)
 {
     this.SpendService = ss;
 }