Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(Request["TemporaryId"]))
            {
                GeneralReport _generalReport = new GeneralReport()
                {
                    Allow = true, Temporary = true, TemporaryCreationDate = DateTime.Now, Format = "Excel"
                };
                //Выставляем плательщика 921 (Офис123)
                //todo: Возможно потом это надо удалить
                _generalReport.Payer = Payer.Find((uint)921);
                using (new TransactionScope()) {
                    _generalReport.Save();
                }
                Response.Redirect("TemporaryReport.aspx?TemporaryId=" + _generalReport.Id);
            }

            if (!this.IsPostBack)
            {
                ReportType[] _reportTypes = ReportType.FindAll(Order.Asc("ReportTypeName"));
                ddlReportTypes.DataSource     = _reportTypes;
                ddlReportTypes.DataTextField  = "ReportTypeName";
                ddlReportTypes.DataValueField = "Id";
                ddlReportTypes.DataBind();

                tbReportName.Text = _reportTypes[0].AlternateSubject;

                BindTemplateReports(_reportTypes[0]);
            }
        }
Ejemplo n.º 2
0
        public void TestRecipientsList()
        {
            var payer = new TestPayer("Тестовый плательщик");

            session.Save(payer);

            var contactGroupOwner = new TestContactGroupOwner();

            contactGroupOwner.SaveAndFlush();

            var client1 = TestClient.CreateNaked(session);
            var client2 = TestClient.CreateNaked(session);

            client1.Payers.Add(payer);
            client2.Payers.Add(payer);

            session.CreateSQLQuery(@"INSERT INTO Billing.PayerClients(ClientId, PayerId) VALUES(:clientid1, :payerid);
										INSERT INTO Billing.PayerClients(ClientId, PayerId) VALUES(:clientid2, :payerid);"                                        )
            .SetParameter("clientid1", client1.Id).SetParameter("clientid2", client2.Id).SetParameter("payerid", payer.Id).ExecuteUpdate();

            var repPayer = Payer.Find(payer.Id);

            var new_report = new GeneralReport()
            {
                Format = "Excel", Payer = repPayer, Comment = "Тестовый отчет"
            };

            new_report.SaveAndFlush();
            var reportId = new_report.Id;
            var report   = GeneralReport.Find(Convert.ToUInt64(reportId));

            Assert.That(report.Payer.AllClients.Count, Is.EqualTo(2));
            Assert.That(report.Payer.Clients[0].ShortName, Is.EqualTo(client1.Name));
            Assert.That(report.Payer.Clients[1].ShortName, Is.EqualTo(client2.Name));
        }