Ejemplo n.º 1
0
        public void sendReports()
        {
            ReportServiceClient rclient = new ReportServiceClient();
            DailyReport dr = new DailyReport();
            dr.Date = DateTime.Now.Date;
            FuelItem[] prchs=getFuelOrders();
            FuelData[] purchase = new FuelData[2];

            purchase[0] = new FuelData();
            purchase[1] = new FuelData();
            for (int i = 0; i < prchs.Length; i++)
            {
                if(prchs[i]!=null && prchs[i].Date==dr.Date)
                {
                    int ind = 1;
                    if (prchs[i].Type == "unleaded")
                        ind = 0;
                    purchase[ind].FuelType = prchs[i].Type;
                    purchase[ind].Quantity += prchs[i].Amount;
                    purchase[ind].Value += prchs[i].Value;
                 }
            }
            dr.Purchases = purchase;

            FuelItem[] sl = getSaleData();
            FuelData[] sales=new FuelData[2];
            sales[0] = new FuelData();
            sales[1] = new FuelData();
            for (int i = 0; i < sl.Length; i++)
            {
                if (sl[i] != null && sl[i].Date == dr.Date)
                {
                    int ind = 1;
                    if (sl[i].Type == "unleaded")
                        ind = 0;
                    sales[ind].FuelType = sl[i].Type;
                    sales[ind].Quantity = sl[i].Amount;
                    sales[ind].Value = sl[i].Value;
                }
            }
            dr.Sales = sales;
            rclient.SendDailyReport(dr);
        }