private void lqtListView1_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; double newvalue; switch (e.ColumnIndex) { case 2: if (double.TryParse(li.SubItems[2].Text, out newvalue)) { if (site.OldDataPatientOnTreatment != newvalue) { SetOnTreatmentAllocation(site, newvalue); RefreshListView(); } } break; case 3: if (double.TryParse(li.SubItems[3].Text, out newvalue)) //b { if (site.OldDataPatientOnPreTreatment != newvalue) { SetOnPreTreatmentAllocation(site, newvalue); RefreshListView(); } } break; } _edited = true; }
private void lstSites_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; double Num; //b bool isNum = double.TryParse(li.SubItems[e.ColumnIndex].Text, out Num); //b if (isNum) //b { double newvalue = double.Parse(li.SubItems[e.ColumnIndex].Text); if (e.ColumnIndex == 2) { site.AdultTestingEfficiency = newvalue; } else if (e.ColumnIndex == 3) { site.PediatricTestingEfficiency = newvalue; } else if (e.ColumnIndex == 4) { site.PediatricsPreExistingPatients = newvalue; } _edited = true; } }
void lsvInstrument_OnSubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; LQTListViewTag tag = (LQTListViewTag)li.Tag; ForecastCategoryInstrument si; if (tag.Id <= 0) { si = (ForecastCategoryInstrument)_fCategoryInstrument[tag.Index]; } else { si = _fCategoryInstrument[_fCategoryInstrument.IndexOf(DataRepository.GetFCInstrumentById(tag.Id))]; } try { if (li.SubItems[1].Text == "0") { li.SubItems[1].Text = "100"; } decimal testRun = decimal.Parse(li.SubItems[1].Text); if (testRun >= 0) { si.TestRunPercentage = testRun; } else { li.SubItems[1].Text = si.TestRunPercentage.ToString(); } } catch { li.SubItems[1].Text = si.TestRunPercentage.ToString(); } }
private void lqtListView1_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; int newvalue; if (e.ColumnIndex == 2) { if (int.TryParse(li.SubItems[2].Text, out newvalue))//b { SetOnTreatmentAllocation(site, newvalue); } } else { if (int.TryParse(li.SubItems[3].Text, out newvalue)) { SetOnPreTreatmentAllocation(site, newvalue); } } _edited = true; }
void lsvProductUsage_OnSubitemTextChanged(object sender, SubitemTextEventArgs e) { LQTListViewTag tag = (LQTListViewTag)e.ListVItem.Tag; ListViewItem li = e.ListVItem; ProductUsage pu;// = (ProductUsage)li.Tag; if (tag.Id > 0) { pu = _test.GetProductUsage(tag.Id); } else { pu = _test.ProductUsages[tag.Index]; } try { decimal rate = decimal.Parse(li.SubItems[1].Text); pu.Rate = rate; } catch { li.SubItems[1].Text = pu.Rate.ToString(); } if (OnDataUsageEdit != null) { OnDataUsageEdit(this, new EventArgs()); } }
void lsvProductUsageI_OnSubitemTextChanged(object sender, SubitemTextEventArgs e) { LQTListViewTag tag = (LQTListViewTag)e.ListVItem.Tag; ListViewItem li = e.ListVItem; ConsumableUsage cu;// = (ProductUsage)li.Tag; if (tag.Id > 0) { cu = _consum.GetConsumableUsage(tag.Id); } else { // cu = _consum.ConsumableUsages[tag.Index]; cu = _consum.GetPerInstrumentUsage()[tag.Index]; } try { decimal rate = decimal.Parse(li.SubItems[2].Text); cu.ProductUsageRate = rate; } catch { li.SubItems[1].Text = cu.ProductUsageRate.ToString(); } if (OnDataUsageEdit != null) { OnDataUsageEdit(this, new EventArgs()); } }
private void lqtListView1_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; int index = e.ColumnIndex; double Num; //b bool isNum = double.TryParse(li.SubItems[index].Text, out Num); //b if (isNum) //b { if (e.ColumnIndex == 2) { site.ScrTest1Percent = double.Parse(li.SubItems[index].Text); } if (e.ColumnIndex == 4) { site.ScrTest2Percent = double.Parse(li.SubItems[index].Text); } if (e.ColumnIndex == 6) { site.ScrTest3Percent = double.Parse(li.SubItems[index].Text); } if (e.ColumnIndex == 8) { site.ConTest1Percent = double.Parse(li.SubItems[index].Text); } if (e.ColumnIndex == 10) { site.ConTest2Percent = double.Parse(li.SubItems[index].Text); } if (e.ColumnIndex == 12) { site.ConTest3Percent = double.Parse(li.SubItems[index].Text); } if (e.ColumnIndex == 14) { site.TieTest1Percent = double.Parse(li.SubItems[index].Text); } if (e.ColumnIndex == 16) { site.TieTest2Percent = double.Parse(li.SubItems[index].Text); } if (e.ColumnIndex == 18) { site.TieTest3Percent = double.Parse(li.SubItems[index].Text); } _edited = true; } }
void lsvInstrument_OnSubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem;// (ListViewItem)sender; LQTListViewTag tag = (LQTListViewTag)li.Tag; SiteInstrument si; if (tag.Id <= 0) { si = (SiteInstrument)_site.SiteInstruments[tag.Index]; } else { si = _site.GetSiteInstrumentById(tag.Id); } try { int qty = int.Parse(li.SubItems[2].Text); if (qty >= 0) { si.Quantity = qty; } else { li.SubItems[2].Text = si.Quantity.ToString(); } decimal testRun = decimal.Parse(li.SubItems[3].Text); if (testRun >= 0) { si.TestRunPercentage = testRun; } else { li.SubItems[3].Text = si.TestRunPercentage.ToString(); } } catch { li.SubItems[3].Text = si.TestRunPercentage.ToString(); li.SubItems[2].Text = si.Quantity.ToString(); } if (OnDataUsageEdit != null) { OnDataUsageEdit(this, new EventArgs()); } }
private void lvproductQinstock_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; LQTListViewTag tag = (LQTListViewTag)li.Tag; MorbiditySupplyProcurement msp; if (tag.Id <= 0) { msp = (MorbiditySupplyProcurement)_supplyProcurement[tag.Index]; } else { msp = DataRepository.GetMorbiditySupplyProcurementById(tag.Id); } double newvalue = double.Parse(li.SubItems[4].Text); if (newvalue >= 0) { msp.QuantityInStock = newvalue; } else { li.SubItems[4].Text = msp.QuantityInStock.ToString(); } double QtoPurchase = double.Parse(li.SubItems[3].Text) - double.Parse(li.SubItems[4].Text); if (QtoPurchase < 0) { QtoPurchase = 0; } li.SubItems[5].Text = QtoPurchase.ToString(); NumberStyles styles = NumberStyles.Number | NumberStyles.AllowCurrencySymbol; double totalCost = double.Parse(li.SubItems[6].Text, styles) * double.Parse(li.SubItems[5].Text, styles); li.SubItems[7].Text = string.Format("{0:C}", totalCost); CalculateTotal(); _edited = true; }
private void lqtListView1_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; double Num; //b bool isNum = double.TryParse(li.SubItems[e.ColumnIndex].Text, out Num); //b if (isNum) //b { if (e.ColumnIndex == 2) { site.ScrTest1Percent = double.Parse(li.SubItems[2].Text); site.ScrTest1 = screening[0].Product != null ? screening[0].Product.Id : 0; site.ConTest1 = conf[0].Product != null ? conf[0].Product.Id : 0; } if (e.ColumnIndex == 5) { site.ScrTest2Percent = double.Parse(li.SubItems[5].Text); site.ScrTest2 = screening[1].Product != null ? screening[1].Product.Id : 0; site.ConTest2 = conf[1].Product != null ? conf[1].Product.Id : 0; } if (e.ColumnIndex == 8) { site.ScrTest3Percent = double.Parse(li.SubItems[8].Text); site.ScrTest3 = screening[2].Product != null ? screening[2].Product.Id : 0; site.ConTest3 = conf[2].Product != null ? conf[2].Product.Id : 0; } if (e.ColumnIndex == 11) { site.TieTest1Percent = double.Parse(li.SubItems[11].Text); site.TieTest1 = tieb[0].Product != null ? tieb[0].Product.Id : 0; } if (e.ColumnIndex == 13) { site.TieTest2Percent = double.Parse(li.SubItems[13].Text); site.TieTest2 = tieb[2].Product != null ? tieb[1].Product.Id : 0; } if (e.ColumnIndex == 15) { site.TieTest3Percent = double.Parse(li.SubItems[15].Text); site.TieTest3 = tieb[2].Product != null ? tieb[2].Product.Id : 0; } _edited = true; } }
private void lstSites_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; double Num; //b bool isNum = double.TryParse(li.SubItems[e.ColumnIndex].Text, out Num); //b if (isNum) //b { double newvalue = double.Parse(li.SubItems[e.ColumnIndex].Text); if (e.ColumnIndex == 2) { site.PITAnnualPatientAttrition = newvalue; } else if (e.ColumnIndex == 3) { site.PITExistingPatientBloodDraws = newvalue; } else if (e.ColumnIndex == 4) { site.PITNewPatientBloodDraws = newvalue; } else if (e.ColumnIndex == 5) { site.PIPAnualPatientAttrition = newvalue; } else if (e.ColumnIndex == 6) { site.PIPAnnualMigration = newvalue; } else if (e.ColumnIndex == 7) { site.PIPExistingPatientBloodDraws = newvalue; } else if (e.ColumnIndex == 8) { site.PIPNewPatientBloodDraws = newvalue; } _edited = true; } }
private void lsvParallel_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; RapidTestSpec rt = (RapidTestSpec)li.Tag; switch (e.ColumnIndex) { case 1: rt.ParallelTestSensitivity = double.Parse(li.SubItems[1].Text); li.SubItems[3].Text = rt.ParallelFalseNegative.ToString(); break; case 2: rt.ParallelTestSpecificity = double.Parse(li.SubItems[2].Text); li.SubItems[4].Text = rt.ParallelFalsePositive.ToString(); break; } _edited = true; }
private void lstSites_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; double Num; //b bool isNum = double.TryParse(li.SubItems[e.ColumnIndex].Text, out Num); //b if (isNum) //b { double newvalue = double.Parse(li.SubItems[e.ColumnIndex].Text); if (e.ColumnIndex == 2) { site.AdultTestingPopulation = newvalue; } else if (e.ColumnIndex == 3) { site.PediatricTestingPopulation = newvalue; } else if (e.ColumnIndex == 4) { site.AdultDepartWoutFollowup = newvalue; } else if (e.ColumnIndex == 5) { site.PediatricDepartWoutFollowup = newvalue; } else if (e.ColumnIndex == 6) { site.DiagnosesReceiveCD4 = newvalue; } _edited = true; } }
private void lqtListView1_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; double newvalue; switch (e.ColumnIndex) { case 2: if (double.TryParse(li.SubItems[2].Text, out newvalue)) { if (site.OldDataPatientOnTreatment != newvalue) { SetOnTreatmentAllocation(site, newvalue); RefreshListView(); } } break; case 3: if (double.TryParse(li.SubItems[3].Text, out newvalue))//b { if (site.OldDataPatientOnPreTreatment != newvalue) { SetOnPreTreatmentAllocation(site, newvalue); RefreshListView(); } } break; } _edited = true; }
private void lqtListView1_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; double Num;//b bool isNum = double.TryParse(li.SubItems[e.ColumnIndex].Text, out Num);//b if (isNum)//b { if (e.ColumnIndex == 2) { site.ScrTest1Percent = double.Parse(li.SubItems[2].Text); site.ScrTest1 = screening[0].Product != null ? screening[0].Product.Id : 0; site.ConTest1 = conf[0].Product != null ? conf[0].Product.Id : 0; } if (e.ColumnIndex == 5) { site.ScrTest2Percent = double.Parse(li.SubItems[5].Text); site.ScrTest2 = screening[1].Product != null ? screening[1].Product.Id : 0; site.ConTest2 = conf[1].Product != null ? conf[1].Product.Id : 0; } if (e.ColumnIndex == 8) { site.ScrTest3Percent = double.Parse(li.SubItems[8].Text); site.ScrTest3 = screening[2].Product != null ? screening[2].Product.Id : 0; site.ConTest3 = conf[2].Product != null ? conf[2].Product.Id : 0; } if (e.ColumnIndex == 11) { site.TieTest1Percent = double.Parse(li.SubItems[11].Text); site.TieTest1 = tieb[0].Product != null ? tieb[0].Product.Id : 0; } if (e.ColumnIndex == 13) { site.TieTest2Percent = double.Parse(li.SubItems[13].Text); site.TieTest2 = tieb[2].Product != null ? tieb[1].Product.Id : 0; } if (e.ColumnIndex == 15) { site.TieTest3Percent = double.Parse(li.SubItems[15].Text); site.TieTest3 = tieb[2].Product != null ? tieb[2].Product.Id : 0; } _edited = true; } }
private void lstSites_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; double Num;//b bool isNum = double.TryParse(li.SubItems[e.ColumnIndex].Text, out Num);//b if (isNum)//b { double newvalue = double.Parse(li.SubItems[e.ColumnIndex].Text); if (e.ColumnIndex == 2) { site.AdultTestingPopulation = newvalue; } else if (e.ColumnIndex == 3) { site.PediatricTestingPopulation = newvalue; } else if (e.ColumnIndex == 4) { site.AdultDepartWoutFollowup = newvalue; } else if (e.ColumnIndex == 5) { site.PediatricDepartWoutFollowup = newvalue; } else if (e.ColumnIndex == 6) { site.DiagnosesReceiveCD4 = newvalue; } _edited = true; } }
private void _lvHistData_SubitemTextChanged(object sender, SubitemTextEventArgs e) { try { ListViewItem li = new ListViewItem(); li = e.ListVItem; LQTListViewTag tag = new LQTListViewTag(); tag.GroupTitle = li.Group.ToString(); tag.Index = e.ColumnIndex; tag = (LQTListViewTag)li.Tag; // int id = e.ColumnIndex-1 +tag.Id; //tag.Id = id; IBaseDataUsage fp = GetDataUsage((LQTListViewTag)li.Tag); bool flag = false; for (int i = 1; tag.Id < (_forecastInfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION ? productListunsorted : testListunsorted); i++) { if (fp != null) { if (e.ListVItem.ListView.Columns[e.ColumnIndex].Text == fp.CDuration && tag.GroupTitle == (_forecastInfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION ? fp.Product.ProductName : fp.Test.TestName)) { flag = true; break; } else { tag.Id = 1 + tag.Id; fp = GetDataUsage((LQTListViewTag)li.Tag); } } else { tag.Id = 1 + tag.Id; fp = GetDataUsage((LQTListViewTag)li.Tag); } } // } if (flag == false) { for (int i = 1; ; i++) { if(tag.Id<0) break; if (fp != null) { if (e.ListVItem.ListView.Columns[e.ColumnIndex].Text == fp.CDuration && (tag.GroupTitle == (_forecastInfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION ? fp.Product.ProductName : fp.Test.TestName))) { flag = true; break; } else { tag.Id = tag.Id - 1; fp = GetDataUsage((LQTListViewTag)li.Tag); } } else { tag.Id = tag.Id - 1; fp = GetDataUsage((LQTListViewTag)li.Tag); } } } if (tag.Id > 0) { ListView l1 = _lvHistData; double am = 0, adj = 0, In = 0, St = 0; int k = 0; foreach (ListViewItem item in this._lvHistData.Items) { if (li.Group == item.Group) { if (k == 0) { am = double.Parse((string)item.SubItems[e.ColumnIndex].Text);//st } else if (k == 3)//4 { adj = double.Parse((string)item.SubItems[e.ColumnIndex].Text); } else if (k == 2)//3 { In = double.Parse((string)item.SubItems[e.ColumnIndex].Text);//am } else if (k == 1)//2 { St = double.Parse((string)item.SubItems[e.ColumnIndex].Text);//In } k++; } } decimal oldamount = fp.AmountUsed; fp.AmountUsed = decimal.Parse(am.ToString()); fp.Adjusted = decimal.Parse(adj.ToString()); ; fp.InstrumentDowntime = int.Parse(In.ToString()); fp.StockOut = int.Parse(St.ToString()); if (_forecastInfo.DatausageEnum == DataUsageEnum.DATA_USAGE2) UpdateProductOfNReportedSite(fp); OnForecastInfoDataChanged(); int activeid = 0, adjustment = 0; if (_activeCategory != null || _activeFSite != null) { if (_activeCategory != null) activeid = _activeCategory.Id; else if (_activeFSite != null) activeid = _activeFSite.Id; int activeIndex = _lvHistData.SelectedItems[0].Index; foreach (IBaseDataUsage p in _forecastInfo.GetListOfDataUsages(activeid, activeIndex)) { if (p.Id == tag.Id)//b { //_lvHistData.BeginUpdate(); p.Adjusted = p.AmountUsed; if (p.AmountUsed == 0) { try { Consumption cs = (_forecastInfo.FMethodologeyEnum == MethodologyEnum.CONSUMPTION ? GetConsumption(p.Product.Id) : GetConsumption(p.Test.Id)); p.Adjusted = Math.Round(cs.TotalConsumption / cs.NoConsumption, 2, MidpointRounding.ToEven); } catch { p.Adjusted = p.AmountUsed; } } if ((p.InstrumentDowntime > 0 || p.StockOut > 0) && p.AmountUsed > 0)// p.Adjusted = LqtUtil.GetAdjustedVolume(p.AmountUsed, p.StockOut + p.InstrumentDowntime, _forecastInfo.PeriodEnum, GetActiveSiteWorkingDays());//b foreach (ListViewItem item in this._lvHistData.Items) { if (li.Group == item.Group) { if (item.Text == "Adjusted") { item.SubItems[e.ColumnIndex].Text = p.Adjusted.ToString(); adjustment++; } if (item.Text == "Note") { if ((p.InstrumentDowntime > 0 || p.StockOut > 0) && p.AmountUsed > 0) item.SubItems[e.ColumnIndex].Text = "Adjusted"; adjustment++; } } if (adjustment == 2) break; } //_lvHistData.EndUpdate(); break; } } } } else { int k = 0; foreach (ListViewItem item in this._lvHistData.Items) { if (li.Group == item.Group) { if (k == 0) { item.SubItems[e.ColumnIndex].Text = "-"; } else if (k == 3)//4 { item.SubItems[e.ColumnIndex].Text = "-"; } else if (k == 2)//3 { item.SubItems[e.ColumnIndex].Text = "-"; } else if (k == 1)//2 { item.SubItems[e.ColumnIndex].Text = "-"; } k++; } } } } catch (Exception ex) { } // UpdateAdjustment(); }
void lsvInstrument_OnSubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem;// (ListViewItem)sender; LQTListViewTag tag = (LQTListViewTag)li.Tag; SiteInstrument si; _isedited = true; if (tag.Id <= 0) { si = (SiteInstrument)_site.SiteInstruments[tag.Index]; } else { si = _site.GetSiteInstrumentById(tag.Id); } try { if (li.SubItems[3].Text == "0") { li.SubItems[3].Text = "100"; } //if (TestInstrumentPercentage()=="") //{ int qty = int.Parse(li.SubItems[2].Text); if (qty >= 0) { si.Quantity = qty; } else { li.SubItems[2].Text = si.Quantity.ToString(); } decimal testRun = decimal.Parse(li.SubItems[3].Text); if (testRun >= 0) { si.TestRunPercentage = testRun; } else { li.SubItems[3].Text = si.TestRunPercentage.ToString(); } //} //else //{ // MessageBox.Show("The sum of % Tests Run for the "+TestInstrumentPercentage()+" must add up to 100%"); // decimal testRun = decimal.Parse(li.SubItems[3].Text); // if (testRun >= 0) // { // si.TestRunPercentage = testRun; // } // else // li.SubItems[3].Text = si.TestRunPercentage.ToString(); // //li.SubItems[2].Text = si.Quantity.ToString(); // //li.SubItems[3].Text = si.TestRunPercentage.ToString(); //} } catch { li.SubItems[3].Text = si.TestRunPercentage.ToString(); li.SubItems[2].Text = si.Quantity.ToString(); } if (OnDataUsageEdit != null) { OnDataUsageEdit(this, new EventArgs()); } }
private void lstSites_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; double newvalue;//b bool isNum = double.TryParse(li.SubItems[e.ColumnIndex].Text, out newvalue);//b if (isNum)//b { //double newvalue = double.Parse(li.SubItems[e.ColumnIndex].Text); if (e.ColumnIndex == 2) { site.AITAnnualPatientAttrition = newvalue; } else if (e.ColumnIndex == 3) { site.AITExistingPatientBloodDraws = newvalue; } else if (e.ColumnIndex == 4) { site.AITNewPatientBloodDraws = newvalue; } else if (e.ColumnIndex == 5) { site.AIPAnualPatientAttrition = newvalue; } else if (e.ColumnIndex == 6) { site.AIPAnnualMigration = newvalue; } else if (e.ColumnIndex == 7) { site.AIPExistingPatientBloodDraws = newvalue; } else if (e.ColumnIndex == 8) { site.AIPNewPatientBloodDraws = newvalue; } _edited = true; } }
private void lqtListView1_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; int index = e.ColumnIndex; double Num;//b bool isNum = double.TryParse(li.SubItems[index].Text, out Num);//b if (isNum)//b { if (e.ColumnIndex == 2) site.ScrTest1Percent = double.Parse(li.SubItems[index].Text); if (e.ColumnIndex == 4) site.ScrTest2Percent = double.Parse(li.SubItems[index].Text); if (e.ColumnIndex == 6) site.ScrTest3Percent = double.Parse(li.SubItems[index].Text); if (e.ColumnIndex == 8) site.ConTest1Percent = double.Parse(li.SubItems[index].Text); if (e.ColumnIndex == 10) site.ConTest2Percent = double.Parse(li.SubItems[index].Text); if (e.ColumnIndex == 12) site.ConTest3Percent = double.Parse(li.SubItems[index].Text); if (e.ColumnIndex == 14) site.TieTest1Percent = double.Parse(li.SubItems[index].Text); if (e.ColumnIndex == 16) site.TieTest2Percent = double.Parse(li.SubItems[index].Text); if (e.ColumnIndex == 18) site.TieTest3Percent = double.Parse(li.SubItems[index].Text); _edited = true; } }
void lsvProductUsage_OnSubitemTextChanged(object sender, SubitemTextEventArgs e) { LQTListViewTag tag = (LQTListViewTag)e.ListVItem.Tag; ListViewItem li = e.ListVItem; ProductUsage pu;// = (ProductUsage)li.Tag; if (tag.Id > 0) pu = _test.GetProductUsage(tag.Id); else pu = _test.ProductUsages[tag.Index]; try { decimal rate = decimal.Parse(li.SubItems[1].Text); pu.Rate = rate; } catch { li.SubItems[1].Text = pu.Rate.ToString(); } if (OnDataUsageEdit != null) { OnDataUsageEdit(this, new EventArgs()); } }
private void lstSites_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; ARTSite site = (ARTSite)li.Tag; double Num;//b bool isNum = double.TryParse(li.SubItems[e.ColumnIndex].Text, out Num);//b if (isNum)//b { double newvalue = double.Parse(li.SubItems[e.ColumnIndex].Text); if (e.ColumnIndex == 2) { site.AdultTestingEfficiency = newvalue; } else if (e.ColumnIndex == 3) { site.PediatricTestingEfficiency = newvalue; } else if (e.ColumnIndex == 4) { site.PediatricsPreExistingPatients = newvalue; } _edited = true; } }
void lvsysmpDirected_OnSubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; LQTListViewTag tag = (LQTListViewTag)li.Tag; PSymptomDirectedTest sdt=new PSymptomDirectedTest(); if (tag.Id <= 0) sdt = (PSymptomDirectedTest)_protocol.SymptomDirectedTests[tag.Index]; else sdt = _protocol.GetSymptomDirectedTestById(tag.Id); try { double sdtAITAmt = double.Parse(li.SubItems[1].Text); if (sdtAITAmt > 0) sdt.AdultInTreatmeant = sdtAITAmt; else li.SubItems[1].Text = sdt.AdultInTreatmeant.ToString(); double sdtPITAmt = double.Parse(li.SubItems[2].Text); if (sdtPITAmt > 0) sdt.PediatricInTreatmeant = sdtPITAmt; else li.SubItems[2].Text = sdt.PediatricInTreatmeant.ToString(); double sdtAPAAmt = double.Parse(li.SubItems[3].Text); if (sdtAPAAmt > 0) sdt.AdultPreART = sdtAPAAmt; else li.SubItems[3].Text = sdt.AdultPreART.ToString(); double sdtPPAAmt = double.Parse(li.SubItems[4].Text); if (sdtPPAAmt > 0) sdt.PediatricPreART = sdtPPAAmt; else li.SubItems[4].Text = sdt.PediatricPreART.ToString(); } catch { li.SubItems[1].Text = sdt.AdultInTreatmeant.ToString(); li.SubItems[2].Text = sdt.PediatricInTreatmeant.ToString(); li.SubItems[3].Text = sdt.AdultPreART.ToString(); li.SubItems[4].Text = sdt.PediatricPreART.ToString(); } if (OnDataUsageEdit != null) { OnDataUsageEdit(this, new EventArgs()); } }
void lvsysmpDirected_OnSubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; LQTListViewTag tag = (LQTListViewTag)li.Tag; PSymptomDirectedTest sdt = new PSymptomDirectedTest(); if (tag.Id <= 0) { sdt = (PSymptomDirectedTest)_protocol.SymptomDirectedTests[tag.Index]; } else { sdt = _protocol.GetSymptomDirectedTestById(tag.Id); } try { double sdtAITAmt = double.Parse(li.SubItems[1].Text); if (sdtAITAmt > 0) { sdt.AdultInTreatmeant = sdtAITAmt; } else { li.SubItems[1].Text = sdt.AdultInTreatmeant.ToString(); } double sdtPITAmt = double.Parse(li.SubItems[2].Text); if (sdtPITAmt > 0) { sdt.PediatricInTreatmeant = sdtPITAmt; } else { li.SubItems[2].Text = sdt.PediatricInTreatmeant.ToString(); } double sdtAPAAmt = double.Parse(li.SubItems[3].Text); if (sdtAPAAmt > 0) { sdt.AdultPreART = sdtAPAAmt; } else { li.SubItems[3].Text = sdt.AdultPreART.ToString(); } double sdtPPAAmt = double.Parse(li.SubItems[4].Text); if (sdtPPAAmt > 0) { sdt.PediatricPreART = sdtPPAAmt; } else { li.SubItems[4].Text = sdt.PediatricPreART.ToString(); } } catch { li.SubItems[1].Text = sdt.AdultInTreatmeant.ToString(); li.SubItems[2].Text = sdt.PediatricInTreatmeant.ToString(); li.SubItems[3].Text = sdt.AdultPreART.ToString(); li.SubItems[4].Text = sdt.PediatricPreART.ToString(); } if (OnDataUsageEdit != null) { OnDataUsageEdit(this, new EventArgs()); } }
private void lvproductQinstock_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; LQTListViewTag tag = (LQTListViewTag)li.Tag; MorbiditySupplyProcurement msp; if (tag.Id <= 0) msp = (MorbiditySupplyProcurement)_supplyProcurement[tag.Index]; else msp =DataRepository.GetMorbiditySupplyProcurementById(tag.Id); double newvalue = double.Parse(li.SubItems[4].Text); if (newvalue >= 0) msp.QuantityInStock = newvalue; else li.SubItems[4].Text = msp.QuantityInStock.ToString(); double QtoPurchase = double.Parse(li.SubItems[3].Text) - double.Parse(li.SubItems[4].Text); if (QtoPurchase < 0) QtoPurchase = 0; li.SubItems[5].Text = QtoPurchase.ToString(); NumberStyles styles = NumberStyles.Number | NumberStyles.AllowCurrencySymbol; double totalCost = double.Parse(li.SubItems[6].Text, styles) * double.Parse(li.SubItems[5].Text,styles); li.SubItems[7].Text = string.Format("{0:C}",totalCost); CalculateTotal(); _edited = true; }
void lsvInstrument_OnSubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem;// (ListViewItem)sender; LQTListViewTag tag = (LQTListViewTag)li.Tag; SiteInstrument si; if (tag.Id <= 0) si = (SiteInstrument)_site.SiteInstruments[tag.Index]; else si = _site.GetSiteInstrumentById(tag.Id); try { int qty = int.Parse(li.SubItems[2].Text); if (qty >= 0) si.Quantity = qty; else li.SubItems[2].Text = si.Quantity.ToString(); decimal testRun = decimal.Parse(li.SubItems[3].Text); if (testRun >= 0) si.TestRunPercentage = testRun; else li.SubItems[3].Text = si.TestRunPercentage.ToString(); } catch { li.SubItems[3].Text = si.TestRunPercentage.ToString(); li.SubItems[2].Text = si.Quantity.ToString(); } if (OnDataUsageEdit != null) { OnDataUsageEdit(this, new EventArgs()); } }
void lsvInstrument_OnSubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem;// (ListViewItem)sender; LQTListViewTag tag = (LQTListViewTag)li.Tag; SiteInstrument si; _isedited = true; if (tag.Id <= 0) si = (SiteInstrument)_site.SiteInstruments[tag.Index]; else si = _site.GetSiteInstrumentById(tag.Id); try { if (li.SubItems[3].Text == "0") { li.SubItems[3].Text = "100"; } //if (TestInstrumentPercentage()=="") //{ int qty = int.Parse(li.SubItems[2].Text); if (qty >= 0) si.Quantity = qty; else li.SubItems[2].Text = si.Quantity.ToString(); decimal testRun = decimal.Parse(li.SubItems[3].Text); if (testRun >= 0) { si.TestRunPercentage = testRun; } else li.SubItems[3].Text = si.TestRunPercentage.ToString(); //} //else //{ // MessageBox.Show("The sum of % Tests Run for the "+TestInstrumentPercentage()+" must add up to 100%"); // decimal testRun = decimal.Parse(li.SubItems[3].Text); // if (testRun >= 0) // { // si.TestRunPercentage = testRun; // } // else // li.SubItems[3].Text = si.TestRunPercentage.ToString(); // //li.SubItems[2].Text = si.Quantity.ToString(); // //li.SubItems[3].Text = si.TestRunPercentage.ToString(); //} } catch { li.SubItems[3].Text = si.TestRunPercentage.ToString(); li.SubItems[2].Text = si.Quantity.ToString(); } if (OnDataUsageEdit != null) { OnDataUsageEdit(this, new EventArgs()); } }
private void lsvSerial_SubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; RapidTestSpec rt = (RapidTestSpec)li.Tag; switch (e.ColumnIndex) { case 1: rt.SerialTestSensitivity = double.Parse(li.SubItems[1].Text); li.SubItems[3].Text = rt.SerialFalseNegative.ToString(); break; case 2: rt.SerialTestSpecificity = double.Parse(li.SubItems[2].Text); li.SubItems[4].Text = rt.SerialFalsePositive.ToString(); break; } _edited = true; }
void lsvProductUsageT_OnSubitemTextChanged(object sender, SubitemTextEventArgs e) { LQTListViewTag tag = (LQTListViewTag)e.ListVItem.Tag; ListViewItem li = e.ListVItem; ConsumableUsage cu;// = (ProductUsage)li.Tag; if (tag.Id > 0) cu = _consum.GetConsumableUsage(tag.Id); else // cu = _consum.ConsumableUsages[tag.Index]; cu = _consum.GetPerTestUsage()[tag.Index]; try { decimal rate = decimal.Parse(li.SubItems[2].Text); cu.ProductUsageRate = rate; } catch { li.SubItems[1].Text = cu.ProductUsageRate.ToString(); } if (OnDataUsageEdit != null) { OnDataUsageEdit(this, new EventArgs()); } }
void lsvInstrument_OnSubitemTextChanged(object sender, SubitemTextEventArgs e) { ListViewItem li = e.ListVItem; LQTListViewTag tag = (LQTListViewTag)li.Tag; ForecastCategoryInstrument si; if (tag.Id <= 0) si = (ForecastCategoryInstrument)_fCategoryInstrument[tag.Index]; else { si = _fCategoryInstrument[_fCategoryInstrument.IndexOf(DataRepository.GetFCInstrumentById(tag.Id))]; } try { if (li.SubItems[1].Text == "0") { li.SubItems[1].Text = "100"; } decimal testRun = decimal.Parse(li.SubItems[1].Text); if (testRun >= 0) { si.TestRunPercentage = testRun; } else li.SubItems[1].Text = si.TestRunPercentage.ToString(); } catch { li.SubItems[1].Text = si.TestRunPercentage.ToString(); } }