public void Should_fire_actions_on_table_members()
        {
            var transformColor = Color.Blue;
            var action = new ReportControlAction<XRControl>(c => true, c => c.BackColor = transformColor);

            var table = new XRTable();
            var row = new XRTableRow();
            var cell = new XRTableCell();
            row.Cells.Add(cell);
            table.Rows.Add(row);

            var report = new XtraReport();
            report.Bands.Add(new DetailBand());
            report.Bands[0].Controls.Add(table);

            //var subscriber = XRRuntimeSubscriber.SubscribeWithActions(action);
            var reportb = new ReportController(new EventAggregator(), report, new ReportControlActionFacade(action)).Print(r => r.ExportToMemory());

            var tableB = (XRTable)reportb.Bands[0].Controls[0];
            var rowB = tableB.Rows[0];
            var cellb = rowB.Cells[0];




            Assert.AreEqual(transformColor, cellb.BackColor);
        }
        public void Should_print_multiple_times_with_actions_firing_correct_count()
        {
            var counter = 0;

            var report = new XtraReport();
            report.Bands.Add(new DetailBand());
            report.Bands[0].Controls.Add(new XRLine());

            var facade =
                new ReportControlActionFacade(ReportControlAction<XRLine>.WithNoPredicate(l =>
                                                                                              {
                                                                                                  l.ForeColor =
                                                                                                      Color.Blue;
                                                                                                  counter++;
                                                                                              }));

            var controller = new ReportController(new EventAggregator(), report,facade);

            var newReport1 = controller.Print(r => r.ExportToMemory());
            var newReport2 = controller.Print(r => r.ExportToMemory());

            newReport1.Bands[0].Controls[0].ForeColor.Should().Be(Color.Blue,"Action should have been applied to control");
            newReport2.Bands[0].Controls[0].ForeColor.Should().Be(Color.Blue, "Action should have been applied to control");

            counter.Should().Be(2,"Action should only have fired once for each time");
        }
示例#3
0
    public void BindData(ReportFilter filter)
    {
        //    xrl_ThangBaoCao.Text = "Tháng: " + DateTime.Now.Month + " năm " + DateTime.Now.Year;
        ReportController control = new ReportController();

        xrtngayketxuat.Text  = control.GetFooterReport(filter.SessionDepartment, filter.ReportedDate);
        xrl_TenCongTy.Text   = control.GetCompanyName(filter.SessionDepartment);
        xrl_TenThanhPho.Text = control.GetCityName(filter.SessionDepartment);
        DataTable table = DataHandler.GetInstance().ExecuteDataTable("sp_CanBoDoanTrongCongTy", "@MaDonVi", "@MaBoPhan", "@WhereClause", filter.SessionDepartment, filter.SelectedDepartment, filter.WhereClause);

        DataSource = table;
        xrtmanhanvien.DataBindings.Add("Text", DataSource, "MA_CB");
        xrttencbcnv.DataBindings.Add("Text", DataSource, "HO_TEN");
        xrt_ngaysinh.DataBindings.Add("Text", DataSource, "NGAY_SINH", "{0:dd/MM/yyyy}");
        xrtgioitinh.DataBindings.Add("Text", DataSource, "TEN_GIOITINH");
        xrtdienthoai.DataBindings.Add("Text", DataSource, "DI_DONG");
        xrt_ngayvao.DataBindings.Add("Text", DataSource, "NGAY_TUYEN_CHINHTHUC", "{0:dd/MM/yyyy}");
        xrtsocmnd.DataBindings.Add("Text", DataSource, "SO_CMND");
        xrt_tongiao.DataBindings.Add("Text", DataSource, "TEN_TONGIAO");
        xrtvanhoa.DataBindings.Add("Text", DataSource, "TEN_TD_VANHOA");
        xrttrinhdo.DataBindings.Add("Text", DataSource, "TEN_TRINHDO");
        xrtbacluong.DataBindings.Add("Text", DataSource, "BAC_LUONG");
        xrthsluong.DataBindings.Add("Text", DataSource, "HS_LUONG");
        xrtngayhluong.DataBindings.Add("Text", DataSource, "NGAY_HLUONG", "{0:dd/MM/yyyy}");

        this.GroupHeader1.GroupFields.AddRange(new DevExpress.XtraReports.UI.GroupField[] {
            new DevExpress.XtraReports.UI.GroupField("TEN_PHONG", DevExpress.XtraReports.UI.XRColumnSortOrder.Ascending)
        });
        xrt_group.DataBindings.Add("Text", DataSource, "TEN_PHONG");
        if (!string.IsNullOrEmpty(filter.ReportTitle))
        {
            xrl_TitleBC.Text = filter.ReportTitle.ToUpper();
        }
        if (!string.IsNullOrEmpty(filter.Title1))
        {
            xrl_footer1.Text = filter.Title1;
        }
        if (!string.IsNullOrEmpty(filter.Title2))
        {
            xrl_footer2.Text = filter.Title2;
        }
        if (!string.IsNullOrEmpty(filter.Title3))
        {
            xrl_footer3.Text = filter.Title3;
        }

        if (!string.IsNullOrEmpty(filter.Name1))
        {
            xrl_ten1.Text = filter.Name1;
        }
        if (!string.IsNullOrEmpty(filter.Name2))
        {
            xrl_ten2.Text = filter.Name2;
        }
        if (!string.IsNullOrEmpty(filter.Name3))
        {
            xrl_ten3.Text = filter.Name3;
        }
    }
示例#4
0
    public void BindData(ReportFilter filter)
    {
        xrl_TenCongTy.Text   = ReportController.GetInstance().GetCompanyName(filter.SessionDepartment);
        xrl_TenThanhPho.Text = ReportController.GetInstance().GetCityName(filter.SessionDepartment);
        DataTable table = DataHandler.GetInstance().ExecuteDataTable("sp_CanBoQuanNhanTrongCongTy", "@MaDonVi", "@MaBoPhan", "@WhereClause", filter.SessionDepartment, filter.SelectedDepartment, filter.WhereClause);

        DataSource = table;
        xrtmanhanvien.DataBindings.Add("Text", DataSource, "MA_CB");
        xrttencbcnv.DataBindings.Add("Text", DataSource, "HO_TEN");
        xrt_ngaysinh.DataBindings.Add("Text", DataSource, "NGAY_SINH", "{0:dd/MM/yyyy}");
        xrtgioitinh.DataBindings.Add("Text", DataSource, "TEN_GIOITINH");
        xrt_phongban.DataBindings.Add("Text", DataSource, "TEN_PHONG");
        xrtdienthoai.DataBindings.Add("Text", DataSource, "DI_DONG");
        xrt_ngaytgcm.DataBindings.Add("Text", DataSource, "NGAY_TGCM", "{0:dd/MM/yyyy}");
        xrt_ngaynhapngu.DataBindings.Add("Text", DataSource, "NGAYVAO_QDOI", "{0:dd/MM/yyyy}");
        xrtngayxuatngu.DataBindings.Add("Text", DataSource, "NGAYRA_QDOI", "{0:dd/MM/yyyy}");
        xrttrinhdo.DataBindings.Add("Text", DataSource, "TEN_TRINHDO");
        this.GroupHeader1.GroupFields.AddRange(new DevExpress.XtraReports.UI.GroupField[] {
            new DevExpress.XtraReports.UI.GroupField("TEN_CAPBAC_QDOI", DevExpress.XtraReports.UI.XRColumnSortOrder.Ascending)
        });
        xrl_tenphongban.DataBindings.Add("Text", DataSource, "TEN_CAPBAC_QDOI");
        if (!string.IsNullOrEmpty(filter.ReportTitle))
        {
            xrl_TitleBC.Text = filter.ReportTitle.ToUpper();
        }
        if (!string.IsNullOrEmpty(filter.Title1))
        {
            xrl_footer1.Text = filter.Title1;
        }
        if (!string.IsNullOrEmpty(filter.Title2))
        {
            xrl_footer2.Text = filter.Title2;
        }
        if (!string.IsNullOrEmpty(filter.Title3))
        {
            xrl_footer3.Text = filter.Title3;
        }

        //if (!string.IsNullOrEmpty(filter.Ten1))
        //{
        //    xrl_ten1.Text = filter.Ten1;
        //}
        //else
        //{
        //    xrl_ten1.Text = filter.NguoiLapBaoCao.ToString();
        //}
        if (!string.IsNullOrEmpty(filter.Name1))
        {
            xrl_ten1.Text = filter.Name1;
        }
        if (!string.IsNullOrEmpty(filter.Name2))
        {
            xrl_ten2.Text = filter.Name2;
        }
        if (!string.IsNullOrEmpty(filter.Name3))
        {
            xrl_ten3.Text = filter.Name3;
        }
    }
    /// <summary>
    /// @Nghia
    /// </summary>

    public void BindData(ReportFilter filter)
    {
        ReportController rpCtr = new ReportController();

        xrLabel3.Text       = "Ngày báo cáo: " + rpCtr.GetFormatDate(filter.ReportedDate);
        xrngaythangnam.Text = rpCtr.GetFooterReport(filter.SessionDepartment, DateTime.Now);
        DataTable table = DataHandler.GetInstance().ExecuteDataTable("report_BaoCaoNhanVienNghiOmTrongThang", "@Thang", "@Nam", "@MaDonVi", "@WhereClause",
                                                                     filter.StartMonth, filter.Year, filter.SelectedDepartment, filter.WhereClause);

        DataSource = table;
        xrTableCell8.DataBindings.Add("Text", DataSource, "MA_CB");
        xrTableCell9.DataBindings.Add("Text", DataSource, "HO_TEN");
        xrTableCell10.DataBindings.Add("Text", DataSource, "TEN_CHUCVU");
        xrTableCell11.DataBindings.Add("Text", DataSource, "Om");
        xrTableCell12.DataBindings.Add("Text", DataSource, filter.Note);

        //Người lập báo cáo
        if (!string.IsNullOrEmpty(filter.Name1))
        {
            xrLabel7.Text = filter.Name1;
        }
        else
        {
            xrLabel7.Text = rpCtr.GetCreatedReporterName(filter.SessionDepartment, filter.Reporter);
        }
        //chữ ký
        xrLabel5.Text  = rpCtr.GetTitleOfSignature(xrLabel5.Text, filter.Title1);
        xrLabel6.Text  = rpCtr.GetTitleOfSignature(xrLabel6.Text, filter.Title2);
        xrLabel10.Text = rpCtr.GetTitleOfSignature(xrLabel10.Text, filter.Title3);
        //Trưởng phòng HCNS
        if (!string.IsNullOrEmpty(filter.Name3))
        {
            xrLabel11.Text = filter.Name3;
        }
        else
        {
            xrLabel11.Text = rpCtr.GetHeadOfHRroom(filter.SessionDepartment, filter.Name3);
        }

        //Kế toán trưởng
        if (!string.IsNullOrEmpty(filter.Name2))
        {
            xrLabel8.Text = filter.Name2;
        }
        else
        {
            xrLabel8.Text = rpCtr.GetHeadAccountant(filter.SessionDepartment, filter.Name2);
        }

        //tieu de
        if (!string.IsNullOrEmpty(filter.ReportTitle))
        {
            xrLabel2.Text = filter.ReportTitle + " " + filter.StartMonth + " NĂM " + filter.Year;
        }
        else
        {
            xrLabel2.Text = "BÁO CÁO NHÂN VIÊN NGHỈ ỐM TRONG THÁNG " + filter.StartMonth + " NĂM " + filter.Year;
        }
    }
        public void BarcodesFromProduction(int id)
        {
            var repo = new ItemRepository(Properties.Settings.Default.ManufacturingConStr);
            var itemsFromProduction = repo.GetItemsForBarcodes(id);
            var data = new ReportController().ConvertProductionIntoBarcodeItems(itemsFromProduction, 80);

            PrintBarcodes(data);
        }
示例#7
0
        public void GetLectureJsonReport_BadRequestResult()
        {
            var response = ReportController.GetLectureReport(ReportController.FileType.JSON,
                                                             null);
            var code = (StatusCodeResult)response;

            Assert.AreEqual((int)HttpStatusCode.BadRequest, code.StatusCode);
        }
        public void ReportController_AdditionMentorsReportInController_ReturnViewResult()
        {
            ReportController reportCrtl = new ReportController(Mock.Of <IReportLogic>(), Mock.Of <IUserLogic>(), Mock.Of <ICustomLogger>());
            ActionResult     result     = reportCrtl.AddMentorsReport();

            Assert.IsNotNull(result);
            Assert.IsAssignableFrom(typeof(ViewResult), result);
        }
示例#9
0
 public void Initialization()
 {
     Year  = 2017;
     Month = 2;
     ReportService.Helpers.ReportHelper.IsDebugMode = true;
     ReportService.Helpers.ReportHelper.XmlDocPath  = @"testDataEmps.xml";
     Controller = new ReportController();
 }
示例#10
0
    protected void btnPrintByCompany_Click(object sender, EventArgs e)
    {
        DateTime fromDate  = DateTime.Parse(tbStartDate.Text);
        DateTime toDate    = DateTime.Parse(tbEndDate.Text);
        int      companyID = int.Parse(ddlCompanies.SelectedValue);

        ReportController.AllPolicies(fromDate, toDate, 0, 0, 0, 0, companyID);
    }
        public void CreateByDatesView_ViewReturned()
        {
            var target = new ReportController(null, null, null, null);

            var result = target.CreateByDatesView();

            Assert.IsInstanceOfType(result, typeof(PartialViewResult));
        }
        public void SetUp()
        {
            orderRepository       = MockRepository.GenerateStub <IRepository <Order> >();
            mailingListRepository = MockRepository.GenerateStub <IRepository <MailingListSubscription> >();
            refererRepository     = MockRepository.GenerateStub <IRepository <Referer> >();

            reportController = new ReportController(orderRepository, mailingListRepository, refererRepository);
        }
        public void Setup()
        {
            settings = new Settings();

            coverageFileReader = Substitute.For<CoverageFileReader>();

            reportController = new ReportController(settings, coverageFileReader);
        }
示例#14
0
 private List <TheKho> GetTheKho(string itemID)
 {
     using (ReportController controller = new ReportController())
     {
         string warehouseID = Warehouse_LookUpEdit.EditValue?.ToString();
         return(controller.GetTheKho(FromDate, ToDate, warehouseID, itemID, PhatSinh_CheckBox.Checked));
     }
 }
示例#15
0
 private List <GetTongHopKho> GetTongHopKhoDataReport()
 {
     using (ReportController controller = new ReportController())
     {
         string warehouseID = Warehouse_LookUpEdit.EditValue?.ToString();
         return(controller.GetNhapXuatKhoTongHopReport(FromDate, ToDate, warehouseID, PhatSinh_CheckBox.Checked));
     }
 }
示例#16
0
    protected void btnPrintByInsuranceSubType_Click(object sender, EventArgs e)
    {
        DateTime fromDate           = DateTime.Parse(tbStartDate.Text);
        DateTime toDate             = DateTime.Parse(tbEndDate.Text);
        int      insuranceSubTypeID = int.Parse(ddlInsuranceSubTypes.SelectedValue);

        ReportController.AllPolicies(fromDate, toDate, 0, insuranceSubTypeID, 0, 0, 0);
    }
示例#17
0
    protected void btnPrintByBranch_Click(object sender, EventArgs e)
    {
        DateTime fromDate = DateTime.Parse(tbStartDate.Text);
        DateTime toDate   = DateTime.Parse(tbEndDate.Text);
        int      branchID = int.Parse(ddlBranches.SelectedValue);

        ReportController.AllPolicies(fromDate, toDate, 0, 0, 0, branchID, 0);
    }
示例#18
0
 private void FinishReport_Load(object sender, EventArgs e)
 {
     lb_date.Text = "Ngày " + addZero(dt.Day) + "/" + addZero(dt.Month) + "/" + addZero(dt.Year);
     lb_amountofcustomers.Text = ReportController.getamountofday(dt).ToString();
     lb_newcustomers.Text      = ReportController.getnewamountofday(dt).ToString();
     dataGridView1             = Module.MydataGridView(dataGridView1);
     dataGridView1.DataSource  = ReportController.getTypeReport(dt);
 }
        public void Init()
        {
            _repository = new DocumentDbRepository(new TestEnvironmentDefinition());
            _userRegistrationReferenceProviderMock = new UserRegistrationReferenceProviderMock();

            _reportController = new ReportController(_repository, new TelemetryClient(),
                                                     _userRegistrationReferenceProviderMock);
        }
示例#20
0
 public static ReportController GetInstance()
 {
     if (Instance == null)
     {
         Instance = new ReportController();
     }
     return(Instance);
 }
        public void Index_ViewResultReturned()
        {
            var target = new ReportController(null, null, null, null);

            var result = target.Index();

            Assert.IsInstanceOfType(result, typeof(PartialViewResult));
        }
示例#22
0
        private void btnPayFatura_Click(object sender, EventArgs e)
        {
            frmPayInvoice pay = new frmPayInvoice(report, ctrReport.Context);

            pay.ShowDialog();
            ctrReport = new ReportController();
            LoadFilds(date, ctrReport.GenerateByCreditCard(date, report.CreditCards[0]));
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     rc = new ReportController();
     //List<String> categories = rc.getAllStationeryCategories();
     //foreach (var c in categories)
     //    categoryDropDownList.Items.Add(c);
     //categoryDropDownList.DataBind();
 }
 public ReportControllerTest()
 {
     _svc        = new Mock <IReportService>();
     _db         = new TestContext().GetContext("ReportControllerTest");
     _Controller = new ReportController(_db, _svc.Object);
     // Create Temp Data Disctionary So Alerts dont throw errors.
     httpContext = new DefaultHttpContext();
 }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            initReport();
            string           basepath   = "";
            string           detailpath = "";
            string           path       = "";
            ReportDataSource rds        = new ReportDataSource();
            DateTime         nowdate    = new DateTime();

            if (txtDate.Text != "")
            {
                string        date     = txtDate.Text;
                List <string> dateList = new List <string>();
                foreach (string i in date.Split('-'))
                {
                    dateList.Add(i);
                }
                int year  = Convert.ToInt32(dateList[0]);
                int month = Convert.ToInt32(dateList[1]);
                nowdate = new DateTime(year, month, 1);
            }


            basepath = "/LogicUniversity/View/StoreClerk/Report/Normal/";
            switch (ddldepNor.SelectedValue)
            {
            case "Department":
                if (txtDate.Text != "")
                {
                    detailpath = "requisition.rdlc";
                    path       = basepath + detailpath;
                    rds        = new ReportDataSource("DepReq", ReportController.getRequisitionByYear(nowdate));
                }
                else
                {
                    ReportViewer.Visible = false;
                    lblError.Visible     = true;
                    lblError.Text        = "Pls Choose Date";
                }


                break;

            case "Store":
                detailpath = "store.rdlc";
                path       = basepath + detailpath;
                rds        = new ReportDataSource("DataSet1", ReportController.getAllItem());
                break;
            }


            path = basepath + detailpath;

            ReportViewer.Visible                = true;
            ReportViewer.ProcessingMode         = ProcessingMode.Local;
            ReportViewer.LocalReport.ReportPath = Server.MapPath(path);
            ReportViewer.LocalReport.DataSources.Add(rds);
        }
示例#26
0
    public void BindData(ReportFilter filter)
    {
        try
        {
            ReportController controller = new ReportController();
            xrLabel1.Text = controller.GetCompanyName(filter.SessionDepartment);
            xrLabel2.Text = "Trụ sở chính: " + controller.GetCompanyAddress(filter.SessionDepartment);
            xrLabel4.Text = string.Format(xrLabel4.Text, controller.GetCompanyPhoneNumber(filter.SessionDepartment),
                                          controller.GetCompanyEmail(filter.SessionDepartment));
            if (!string.IsNullOrEmpty(filter.ReportTitle))
            {
                xrLabel5.Text = filter.ReportTitle;
            }
            else
            {
                xrLabel5.Text = "BẢNG TỔNG HỢP ĐIỂM VÀ KẾT QUẢ ĐÁNH GIÁ HÀNG THÁNG NĂM " + filter.Year;
            }

            DataTable table = DataController.DataHandler.GetInstance().ExecuteDataTable("rpap_TongHopDiemDanhGiaHangThang", "@MaBoPhan", "@Nam", filter.SelectedDepartment, filter.Year);
            DataSource = table;
            xrTableCell54.DataBindings.Add("Text", DataSource, "HO_TEN");
            xrTableCell55.DataBindings.Add("Text", DataSource, "MA_CB");
            xrTableCell56.DataBindings.Add("Text", DataSource, "TEN_CHUCVU");
            xrTableCell57.DataBindings.Add("Text", DataSource, "TEN_DONVI");
            xrTableCell49.DataBindings.Add("Text", DataSource, "NGAY_TUYEN_CHINHTHUC");
            xrTableCell70.DataBindings.Add("Text", DataSource, "Point1", "{0:n1}");
            xrTableCell63.DataBindings.Add("Text", DataSource, "Percen1", "{0:n1}");
            xrTableCell71.DataBindings.Add("Text", DataSource, "Point2", "{0:n1}");
            xrTableCell62.DataBindings.Add("Text", DataSource, "Percen2", "{0:n1}");
            xrTableCell72.DataBindings.Add("Text", DataSource, "Point3", "{0:n1}");
            xrTableCell60.DataBindings.Add("Text", DataSource, "Percen3", "{0:n1}");
            xrTableCell73.DataBindings.Add("Text", DataSource, "Point4", "{0:n1}");
            xrTableCell65.DataBindings.Add("Text", DataSource, "Percen4", "{0:n1}");
            xrTableCell74.DataBindings.Add("Text", DataSource, "Point5", "{0:n1}");
            xrTableCell64.DataBindings.Add("Text", DataSource, "Percen5", "{0:n1}");
            xrTableCell75.DataBindings.Add("Text", DataSource, "Point6", "{0:n1}");
            xrTableCell59.DataBindings.Add("Text", DataSource, "Percen6", "{0:n1}");
            xrTableCell76.DataBindings.Add("Text", DataSource, "Point7", "{0:n1}");
            xrTableCell67.DataBindings.Add("Text", DataSource, "Percen7", "{0:n1}");
            xrTableCell77.DataBindings.Add("Text", DataSource, "Point8", "{0:n1}");
            xrTableCell66.DataBindings.Add("Text", DataSource, "Percen8", "{0:n1}");
            xrTableCell78.DataBindings.Add("Text", DataSource, "Point9", "{0:n1}");
            xrTableCell61.DataBindings.Add("Text", DataSource, "Percen9", "{0:n1}");
            xrTableCell79.DataBindings.Add("Text", DataSource, "Point10", "{0:n1}");
            xrTableCell69.DataBindings.Add("Text", DataSource, "Percen10", "{0:n1}");
            xrTableCell80.DataBindings.Add("Text", DataSource, "Point11", "{0:n1}");
            xrTableCell68.DataBindings.Add("Text", DataSource, "Percen11", "{0:n1}");
            xrTableCell81.DataBindings.Add("Text", DataSource, "Point12", "{0:n1}");
            xrTableCell58.DataBindings.Add("Text", DataSource, "Percen12", "{0:n1}");
            xrTableCell82.DataBindings.Add("Text", DataSource, "DiemTB", "{0:n1}");
            xrTableCell50.DataBindings.Add("Text", DataSource, "PhanTramTB", "{0:n1}");
            xrTableCell52.DataBindings.Add("Text", DataSource, "TongDiem", "{0:n1}");
        }
        catch (Exception ex)
        {
            Dialog.ShowError("Có lỗi xảy ra: " + ex.Message);
        }
    }
        public Report()
        {
            var app = Application.Current as App;

            medicationController = app.medicationController;
            reportController     = app.reportController;

            InitializeComponent();
        }
        public async Task SubcategoriesReport_RaisesWebUiException()
        {
            _payItemSubcategoriesHelperMock
            .Setup(m => m.GetPayItemsWithSubcategoriesInDatesWeb(It.IsAny <DateTime>(), It.IsAny <DateTime>(),
                                                                 It.IsAny <IWorkingUser>(), It.IsAny <int>())).Throws <WebUiHelperException>();
            var target = new ReportController(_payItemSubcategoriesHelperMock.Object, null, null, null);

            await target.SubcategoriesReport(new WebUser(), 1, DateTime.Now);
        }
        public void GetByDatesReport_RaisesWebuiException()
        {
            _reportModelCreator
            .Setup(m => m.CreateByDatesReportModel(It.IsAny <WebUser>(), It.IsAny <DateTime>(), It.IsAny <DateTime>(), It.IsAny <int>()))
            .Throws <WebUiException>();
            var target = new ReportController(null, null, _reportModelCreator.Object, null);

            target.GetByDatesReport(new WebUser(), DateTime.Now, DateTime.Now, 1);
        }
示例#30
0
        public void TestDeleteAReport()
        {
            _mockReportService.Setup(x => x.Delete(It.IsAny <string>())).Returns(true);
            var reportController  = new ReportController(_mockReportService.Object);
            var checkDeleteReport = reportController.DeleteAReport("5d247a04eff1030d7c5209a0");
            var type = checkDeleteReport.GetType();

            Assert.AreEqual(type.Name, "OkObjectResult");
        }
        public void GetTypeOfFlowReport_RaisesWebUiException()
        {
            _reportModelCreator
            .Setup(m => m.CreateByTypeReportModel(It.IsAny <TempReportModel>(), It.IsAny <WebUser>(), It.IsAny <int>()))
            .Throws <WebUiException>();
            var target = new ReportController(null, null, _reportModelCreator.Object, null);

            target.GetTypeOfFlowReport(new TempReportModel(), new WebUser(), 1);
        }
示例#32
0
        public void TestAddNewReportReturnBadRequest()
        {
            Report report            = null;
            var    reportController  = new ReportController(_mockReportService.Object);
            var    checkAddNewReport = reportController.AddNewReport(report);
            var    type = checkAddNewReport.GetType();

            Assert.AreEqual(type.Name, "BadRequestResult");
        }
示例#33
0
 public Report()
 {
     InitializeComponent();
     this.reportController        = new ReportController();
     this.startDatePicker.Value   = DateTime.Now;
     this.startDatePicker.MaxDate = DateTime.Now;
     this.endDatePicker.Value     = DateTime.Now;
     this.endDatePicker.MaxDate   = DateTime.Now;
 }
        public void Should_apply_actions_to_entire_report()
        {
            var color = Color.Green;
            var action = new ReportControlAction<XtraReport>(r => true, r => r.BackColor = color);

            var report = new XtraReport();
            var newReport = new ReportController(new EventAggregator(), report, new ReportControlActionFacade(action)).Print(r => r.ExportToMemory());

            Assert.AreEqual(color, newReport.BackColor);
        }
        public void Should_fire_injected_actions()
        {
            var aggregator = new EventAggregator();
            var view = new XtraReport { DataSource = new[] { new object(), new object() } };

            view.Bands.Add(new DetailBand());

            view.Bands[0].Controls.Add(new XRLabel { Text = "Original Text" });

            var action = ReportControlAction<XRLabel>.WithNoPredicate(l => l.Text = "TextChanged");
            var controller = new ReportController(aggregator, view,new ReportControlActionFacade(action));

            var newReport = controller.Print(p => p.ExportToMemory());

            newReport.Bands[0].Controls[0].Text.Should().Be("TextChanged");
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReportControllerTests"/> class.
 /// </summary>
 public ReportControllerTests()
 {
     Business.Dependencies.Register();
     this.reportManager = new Mock<IReportManager>();
     this.reportController = new ReportController(this.reportManager.Object);
     CommonHelper.MockHttpRequestContext();
     SessionData.Instance.MasterData = CommonHelper.SetupMasterDataForUIControllers();
     DIContainer.Instance.Resolve<IComponentSettingsEntities>().MaxPageSize = 2;
     DIContainer.Instance.Resolve<IComponentSettingsEntities>().GangwayApplicationId = "1";
 }
 public void GivenTheXtrasubreportEngineIsInitialized()
 {
     var facade = new ReportControlActionFacade(_action);
     _controller = new ReportController(new EventAggregator(),_report, facade);
     
 }
        public void Should_fire_actions_against_item_in_subreport()
        {
            var report = new XtraReport();
            var detailBand = new DetailBand();
            report.Bands.Add(detailBand);


            var subreport = new XtraReport();
            var container = new XRSubreport {ReportSource = subreport, Name = "container"};
            detailBand.Controls.Add(container);
            

            var subReportBand = new DetailBand();
            subreport.Bands.Add(subReportBand);
            subReportBand.Controls.Add(new XRLine {Name = "line"});

            var facade =
                new ReportControlActionFacade(ReportControlAction<XRLine>.WithNoPredicate(l => l.ForeColor = Color.Blue));

            var report2 = new ReportController(new EventAggregator(), report, facade).Print(r => r.ExportToMemory());

            var newSubreport =
                ((XRSubreport) report2.Bands[0].Controls[0]).ReportSource;

            ((XRLine) newSubreport.Bands[0].Controls[0]).ForeColor.Should().Be(Color.Blue);

        }
        public void Should_handle_detail_reports()
        {
            var textvalues = new List<Tuple<int, string>>();
            var report = new XtraReportWithLabelInDetailReport();
            report.DataSource = new List<Person2>
                                    {
                                        new Person2
                                            {
                                                Name = "Douglas Sam",
                                                Age = 17,
                                                Dogs = new List<Dog> {new Dog {Name = "Rex"}, new Dog {Name = "Rudy"}}
                                            },
                                        new Person2
                                            {
                                                Name = "Fred Thomas",
                                                Age = 35,
                                                Dogs =
                                                    new List<Dog> {new Dog {Name = "Sally"}, new Dog {Name = "Stubert"}}
                                            },
                                        new Person2
                                            {
                                                Name = "Alex Matthew",
                                                Age = 100,
                                                Dogs =
                                                    new List<Dog>
                                                        {new Dog {Name = "Nibbles"}, new Dog {Name = "Norbert"}}
                                            }

                                    };
            int counter = 0;
            var action = ReportControlAction<XRLabel>.WithNoPredicate(l =>
            {
                counter++;
                textvalues.Add(new Tuple<int, string>(l.Report.GetHashCode(), l.Text));
            });
            var facade = new ReportControlActionFacade(action);

            var c = new ReportController(new EventAggregator(), report, facade);
            var newReport = c.Print(a => a.ExportToMemory());

            counter.Should().Be(6);


        }
        public void Should_not_collide_with_another_controller_when_both_printing_using_save_event_aggregator()
        {
            var view = new XtraReport { DataSource = new[] { new object(), new object() } };

            var counterA = 0;
            var counterB = 0;

            IEventAggregator aggregator = new EventAggregator();

            var actionA = ReportControlAction<XRControl>.WithNoPredicate(c => counterA++);
            var actionB = ReportControlAction<XRControl>.WithNoPredicate(c => counterB++);
            var facadeA = new ReportControlActionFacade(actionA);
            var facadeB = new ReportControlActionFacade(actionB);

            var controllerA = new ReportController(aggregator, view, facadeA);
            var controllerB = new ReportController(aggregator, view, facadeB);

            controllerA.Print(r => r.ExportToMemory());
            controllerB.Print(r => r.ExportToMemory());

            counterA.Should().Be(1);
            counterB.Should().Be(1);
        }
        public void Should_convert_subreport_to_gc_xtra_report()
        {
            var report = new XtraReport();
            var detailBand = new DetailBand();
            var subReportContainer = new XRSubreport { ReportSource = new XtraReport() };
            report.Bands.Add(detailBand);
            detailBand.Controls.Add(subReportContainer);


            var controller = new ReportController(new EventAggregator(), report);
            var newReport = controller.Print(p => p.ExportToMemory());

            var newContainer = (XRSubreport)newReport.Bands[0].Controls[0];
            newContainer.ReportSource.GetType().Should().Be(typeof(gcXtraReport));
        }