Ejemplo n.º 1
0
        void UpdateLabel()
        {
            CalculatorController cc = new CalculatorController();
            AnalyticsData        ad = cc.GetDailyProfit(_currentId);
            double   totalProfit    = cc.GetTotalProfit(_currentId);
            double   pricePerUnit   = cc.GetPricePerUnit();
            DateTime startDate      = cc.GetStartDate(_currentId);

            // System
            {
                LabelEnergyToday.Text = ad.UnitCount.ToString("N3");
                LabelIncomeToday.Text = (ad.Profit).ToString("N2");

                LabelEnergyTotal.Text = totalProfit.ToString("N3");
                LabelIncomeTotal.Text = (totalProfit * pricePerUnit).ToString("N2");

                LabelSystemStart.Text  = startDate.ToString("D");
                LabelSystemUpTime.Text = (DateTime.Now - startDate).ToString("d'd 'h'h 'm'm 's's'");
                LabelStatus.Text       = "OK";
            }

            // Individual
            double pctShare = GetYourSharePercent();
            {
                double yourYieldToday = ad.UnitCount * pctShare;
                LabelYourYieldToday.Text  = yourYieldToday.ToString("N3");
                LabelYourIncomeToday.Text = (yourYieldToday * pricePerUnit).ToString("N2");

                double yourTotalYield = totalProfit * pctShare;
                LabelYourTotalYield.Text  = yourTotalYield.ToString("N3");
                LabelYourTotalIncome.Text = (yourTotalYield * pricePerUnit).ToString("N2");
            }
        }