protected void Page_Load(object sender, EventArgs e) { showNav(); int userId = Convert.ToInt32(Session["userId"]); TransactionReports reports = new TransactionReports(); reports.SetDataSource(GetData(userId)); CrystalReportViewer1.ReportSource = reports; }
public string DisplayStatistics(TransactionReports reports) { var str = new StringBuilder(); str.Append("Sales this month flowers\n"); str.Append("\nFlowerName\t\tQuantity \tEarnings \tDay of month\n"); str.Append("----------------------------------------------------------------\n"); foreach (var rep in reports.FlowersSales) { str.Append($"{rep.Name} \t\t\t{rep.Quantity} \t\t{rep.TotalEarnings} \t\t{rep.CurrentDate}").AppendLine(); } if (reports.BouchetSales.Count > 0) { str.Append("----------------------------------------------------------------\n"); str.AppendLine(); str.Append("Sales this month bouchets\n"); str.Append("\nBouchetType\t\tQuantity \tEarnings \tDay of month\n"); str.Append("----------------------------------------------------------------\n"); foreach (var rep in reports.BouchetSales) { str.Append($"{rep.Name} \t\t{rep.Quantity} \t\t{rep.TotalEarnings} \t\t{rep.CurrentDate}").AppendLine(); } } if (_paymentFlower.Transactions.Count > 0) { str.Append("----------------------------------------------------------------\n"); str.AppendLine(); str.Append("Individual transactions for flowers \n"); str.Append("\nFlowerName\t\tQuantity \tCost \tDay of month\n"); str.Append("----------------------------------------------------------------\n"); foreach (var flowerRep in _paymentFlower.Transactions) { str.Append($"{flowerRep.Name} \t\t\t{flowerRep.Quantity} \t\t{flowerRep.Cost} \t\t{flowerRep.CurrentDate}").AppendLine(); } } if (_paymentBouchet.Transactions.Count > 0) { str.Append("----------------------------------------------------------------\n"); str.AppendLine(); str.Append("Individual transactions for bouchets \n"); str.Append("\nFlowerName\t\tQuantity \tCost \tDay of month\n"); str.Append("----------------------------------------------------------------\n"); foreach (var bouchetRep in _paymentBouchet.Transactions) { str.Append($"{bouchetRep.Name} \t\t{bouchetRep.Quantity} \t\t{bouchetRep.Cost} \t\t{bouchetRep.CurrentDate}").AppendLine(); } str.Append("----------------------------------------------------------------\n"); } return(str.ToString()); }
public SolutionExercise() { _reports = new TransactionReports(); _paymentBouchet = new PaymentBouchet(_reports); _paymentFlower = new PaymentFlower(_reports); }