private void UpdateProductOfNReportedSite(IBaseDataUsage fc) { int id; if (_forecastInfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION) id = ((ForecastSiteProduct)fc).ForecastSite.Id; else id = ((ForecastSiteTest)fc).ForecastSite.Id; foreach (ForecastSite fs in _forecastInfo.GetNoneReportedForecastSite(id)) { if (_forecastInfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION) { foreach (ForecastSiteProduct fp in fs.SiteProducts) { if (fp.DurationDateTime == fc.DurationDateTime) { fp.AmountUsed = fc.AmountUsed; fp.StockOut = fc.StockOut; fp.Adjusted = fc.Adjusted; fp.InstrumentDowntime = fc.InstrumentDowntime; } } } else { foreach (ForecastSiteTest fp in fs.SiteTests) { if (fp.DurationDateTime == fc.DurationDateTime) { fp.AmountUsed = fc.AmountUsed; fp.StockOut = fc.StockOut; fp.Adjusted = fc.Adjusted; fp.InstrumentDowntime = fc.InstrumentDowntime; } } } } if (_forecastInfo.StatusEnum == ForecastStatusEnum.CLOSED) _forecastInfo.Status = ForecastStatusEnum.REOPEN.ToString(); }
private void AddProductToNReportedSite(int sourceid, IBaseDataUsage fc) { foreach (ForecastSite fs in _forecastInfo.GetNoneReportedForecastSite(sourceid)) { if (_forecastInfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION) { ForecastSiteProduct fsp = (ForecastSiteProduct)GetCloneForecastSiteProduct(fc); fsp.ForecastSite = fs; fs.SiteProducts.Add(fsp); } else { ForecastSiteTest fst = (ForecastSiteTest)GetCloneForecastSiteProduct(fc); fst.ForecastSite = fs; fs.SiteTests.Add(fst); } } if (_forecastInfo.StatusEnum == ForecastStatusEnum.CLOSED) _forecastInfo.Status = ForecastStatusEnum.REOPEN.ToString(); }
private IBaseDataUsage GetCloneForecastSiteProduct(IBaseDataUsage fsp) { IBaseDataUsage dusage; if (_forecastInfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION) dusage = new ForecastSiteProduct(); else dusage = new ForecastSiteTest(); dusage.Product = fsp.Product; dusage.AmountUsed = fsp.AmountUsed; dusage.Adjusted = fsp.Adjusted; dusage.CDuration = fsp.CDuration; dusage.DurationDateTime = fsp.DurationDateTime; dusage.Test = fsp.Test; //Feb 19 2015 return dusage; }
private void AddDataUsageToSiteOrCat(IBaseDataUsage dusage) { if (_forecastInfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION) { if (_forecastInfo.DatausageEnum == DataUsageEnum.DATA_USAGE3) { _activeCategory.CategoryProducts.Add((ForecastCategoryProduct)dusage); //ArrayList.Adapter(_activeCategory.CategoryProducts).Sort(); } else _activeFSite.SiteProducts.Add((ForecastSiteProduct)dusage); } else { if (_forecastInfo.DatausageEnum == DataUsageEnum.DATA_USAGE3) _activeCategory.CategoryTests.Add((ForecastCategoryTest)dusage); else _activeFSite.SiteTests.Add((ForecastSiteTest)dusage); } if (_forecastInfo.StatusEnum == ForecastStatusEnum.CLOSED) _forecastInfo.Status = ForecastStatusEnum.REOPEN.ToString(); }