示例#1
0
        private void butAddI_Click_1(object sender, EventArgs e)
        {
            Instrument ins = LqtUtil.GetComboBoxValue <Instrument>(comInstrumentI);

            if (ins != null)
            {
                MasterProduct pro = LqtUtil.GetComboBoxValue <MasterProduct>(comProductI);
                if (pro != null)
                {
                    //if (! _consum.IsExsistProductUsage(ins.Id, pro.Id))
                    // {
                    if (comPeriodI.SelectedValue != null)
                    {
                        if (!_consum.IsExsistUsageRatePerInst(ins.Id, pro.Id))
                        {
                            ConsumableUsage cu = new ConsumableUsage();
                            cu.Period           = comPeriodI.Text;
                            cu.PerInstrument    = true;
                            cu.Product          = pro;
                            cu.Instrument       = ins;
                            cu.ProductUsageRate = 1;
                            cu.MasterConsumable = _consum;
                            _consum.ConsumableUsages.Add(cu);
                            BindProductUsageI();
                            if (OnDataUsageEdit != null)
                            {
                                OnDataUsageEdit(this, new EventArgs());
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        private void BindProcurement()
        {
            lvproductQinstock.Items.Clear();
            lvproductQinstock.BeginUpdate();
            int index = 0;

            foreach (MorbiditySupplyProcurement p in _supplyProcurement)
            {
                LQTListViewTag tag = new LQTListViewTag();
                tag.GroupTitle = (p.PlatformEnum.ToString());
                tag.Id         = p.Id;
                tag.Index      = index;
                MasterProduct product = DataRepository.GetProductById(p.ProductId);

                ListViewItem li = new ListViewItem(product.ProductName)
                {
                    Tag = tag
                };

                li.SubItems.Add(p.PackSize.ToString());
                li.SubItems.Add(product.BasicUnit);
                li.SubItems.Add(p.QuantityNeeded.ToString());
                li.SubItems.Add(p.QuantityInStock.ToString());
                li.SubItems.Add(p.QuantityToPurchase.ToString());
                li.SubItems.Add(string.Format("{0:C}", p.UnitCost).ToString());
                li.SubItems.Add(string.Format("{0:C}", p.TotalCost).ToString());

                LqtUtil.AddItemToGroup(lvproductQinstock, li);

                lvproductQinstock.Items.Add(li);
                index++;
            }

            lvproductQinstock.EndUpdate();
        }
示例#3
0
        /// <summary>
        /// sample referral
        /// </summary>
        /// <param name="result"></param>
        public void SetTestsReceivedFromReferringSites(ClassOfChemistryTests[] result)
        {
            ChemistryTestNameEnum[] chemTests = LqtUtil.EnumToArray <ChemistryTestNameEnum>();

            for (int i = 1; i <= 12; i++)
            {
                for (int x = 0; x < chemTests.Length; x++)
                {
                    ChemistrySymptomDirectedTest csdt = _chemMonthlyOutputs[i].GetChemSymptomDirectedTestById(chemTests[x]);
                    if ((i + 1) >= PeriodInfo.FirstMonth && (i + 1) <= PeriodInfo.LastMonth)
                    {
                        csdt.TestsonInstrumentForecastPeriodFromReferringSites = result[i - 1].GetChemTestValue(chemTests[x]);
                    }

                    if ((i + 1) > PeriodInfo.LastMonth)
                    {
                        csdt.TestsonInstrumentBufferStockFromReferringSites = result[i - 1].GetChemTestValue(chemTests[x]);
                    }
                }

                if ((i + 1) >= PeriodInfo.FirstMonth && (i + 1) <= PeriodInfo.LastMonth)
                {
                    _chemMonthlyOutputs[i].TotalSampleForecastPeriodRecivedFromReferrSites = result[i - 1].TotalSamples;
                }
                if ((i + 1) > PeriodInfo.LastMonth)
                {
                    _chemMonthlyOutputs[i].TotalSampleBufferStockRecivedFromReferrSites = result[i - 1].TotalSamples;
                }
            }

            _testsReceivedFromReferringSitesBeyondForecast = result[12];
        }
        private void chartSiteCategory_Load(object sender, EventArgs e)
        {
            _morbiditySP          = DataRepository.GetMorbiditySPByForecastId(_ForecastId);
            chart1.Titles[0].Text = " Supply Procurement Forecast";
            ClassOfMorbidityTestEnum[] platforms = LqtUtil.EnumToArray <ClassOfMorbidityTestEnum>();

            double[] yval = new double[platforms.Length];
            string[] xval = new string[platforms.Length];

            int i = 0;

            foreach (ClassOfMorbidityTestEnum m in platforms)
            {
                xval[i] = m.ToString();

                foreach (MorbiditySupplyProcurement mp in _morbiditySP)
                {
                    if (m == mp.PlatformEnum)
                    {
                        yval[i] = mp.TotalCost + yval[i];
                    }
                }
                i++;
            }


            chart1.Series["morbiditySP"].Points.DataBindXY(xval, yval);
        }
示例#5
0
        public LQTUserMessage SaveOrUpdateObject()
        {
            if (txtAreaname.Text.Trim() == "")
            {
                throw new LQTUserException("Group name must not be empty.");
            }

            this._testingGroup.GroupName = this.txtAreaname.Text.Trim();
            TestingArea ta = LqtUtil.GetComboBoxValue <TestingArea>(comTestarea);

            if (ta == null)
            {
                throw new LQTUserException("A testing-area must be selected.");
            }

            if (_testingGroup.TestingArea == null)
            {
                this._testingGroup.TestingArea = ta;
                ta.TestingGroups.Add(_testingGroup);
            }
            else if (!ta.TestingGroups.Contains(_testingGroup))
            {
                this._testingGroup.TestingArea = ta;
                ta.TestingGroups.Add(_testingGroup);
            }
            DataRepository.SaveOrUpdateTestingArea(ta);
            return(new LQTUserMessage("Testing Group was saved or updated successfully."));
        }
示例#6
0
        public override LQTUserMessage SaveOrUpdateObject()
        {
            if (txtName.Text.Trim() == "")
            {
                throw new LQTUserException("Product name must not be empty.");
            }
            else if (DataRepository.GetProductByName(txtName.Text.Trim()) != null &&
                     _product.Id <= 0)
            {
                throw new LQTUserException("The Product Name already exists.");
            }

            _product.ProductName     = this.txtName.Text;
            _product.BasicUnit       = this.txtBasicunit.Text;
            _product.ProductNote     = this.txtNote.Text;
            _product.SerialNo        = this.txtSerialno.Text;
            _product.Specification   = this.txtSpecification.Text;
            _product.MinimumPackSize = int.Parse(txtminimumPacks.Text);

            if (_product.ProductType == null)
            {
                _product.ProductType = LqtUtil.GetComboBoxValue <ProductType>(comCategory);
            }

            DataRepository.SaveOrUpdateProduct(_product);

            return(new LQTUserMessage("Product was saved or updated successfully."));
        }
示例#7
0
        private void butSelect_Click(object sender, EventArgs e)
        {
            int          len = lvProductAll.SelectedItems.Count;
            QuantifyMenu qm  = LqtUtil.GetComboBoxValue <QuantifyMenu>(comClass);
            IList <QuantificationMetric> templits = new List <QuantificationMetric>();

            for (int i = 0; i < len; i++)
            {
                QuantificationMetric metric = new QuantificationMetric();
                metric.ClassOfTest = qm.ClassOfTest;
                metric.CollectionSupplieAppliedTo = CollectionSupplieAppliedToEnum.Testing.ToString();
                metric.Product      = (MasterProduct)lvProductAll.SelectedItems[i].Tag;
                metric.QuantifyMenu = qm;
                metric.UsageRate    = 1;
                qm.QuantificationMetrics.Add(metric);
                templits.Add(metric);
            }

            lstSelectedPro.BeginUpdate();

            foreach (QuantificationMetric m in templits)
            {
                ListViewItem li = new ListViewItem(m.Product.ProductName)
                {
                    Tag = m
                };

                li.SubItems.Add(qm.DisplayTitle);

                lstSelectedPro.Items.Add(li);
            }

            lstSelectedPro.EndUpdate();
        }
示例#8
0
        private void butAddP_Click(object sender, EventArgs e)
        {
            MasterProduct pro = LqtUtil.GetComboBoxValue <MasterProduct>(comProductP);

            if (pro != null)
            {
                if (comPeriodP.SelectedValue != null)
                {
                    if (!_consum.IsExsistUsageRatePerPeriod(pro.Id))
                    {
                        ConsumableUsage cu = new ConsumableUsage();
                        cu.Period           = comPeriodP.SelectedValue.ToString();
                        cu.PerPeriod        = true;
                        cu.Product          = pro;
                        cu.ProductUsageRate = 1;
                        cu.MasterConsumable = _consum;
                        _consum.ConsumableUsages.Add(cu);
                        BindProductUsageP();
                        if (OnDataUsageEdit != null)
                        {
                            OnDataUsageEdit(this, new EventArgs());
                        }
                    }
                }
            }
        }
示例#9
0
        private void BindProductUsage()
        {
            lsvProductUsage.BeginUpdate();
            lsvProductUsage.Items.Clear();

            int index = 0;

            foreach (ProductUsage r in _test.ProductUsages)
            {
                LQTListViewTag tag = new LQTListViewTag();
                tag.GroupTitle = r.Instrument.InstrumentName;
                tag.Id         = r.Id;
                tag.Index      = index;
                ListViewItem li = new ListViewItem(r.Product.ProductName)
                {
                    Tag = tag
                };

                li.SubItems.Add(r.Rate.ToString());
                //li.SubItems.Add(r.ProductUsedIn);
                LqtUtil.AddItemToGroup(lsvProductUsage, li);
                lsvProductUsage.Items.Add(li);
                index++;
            }

            lsvProductUsage.EndUpdate();
        }
示例#10
0
        private void butAddT_Click(object sender, EventArgs e)
        {
            MasterProduct pro = LqtUtil.GetComboBoxValue <MasterProduct>(comProductT);

            if (pro != null)
            {
                if (!_consum.IsExsistUsageRatePerTest(pro.Id))
                {
                    if (txtNoofTest.Text != "0")
                    {
                        ConsumableUsage cu = new ConsumableUsage();
                        cu.NoOfTest         = int.Parse(txtNoofTest.Text);
                        cu.PerTest          = true;
                        cu.Product          = pro;
                        cu.ProductUsageRate = 1;
                        cu.MasterConsumable = _consum;
                        _consum.ConsumableUsages.Add(cu);
                        BindProductUsage();
                        if (OnDataUsageEdit != null)
                        {
                            OnDataUsageEdit(this, new EventArgs());
                        }
                    }
                }
            }
        }
示例#11
0
        private void BindProductUsageI()
        {
            lsvProductUsageI.BeginUpdate();
            lsvProductUsageI.Items.Clear();

            int index = 0;

            foreach (ConsumableUsage r in _consum.ConsumableUsages)
            {
                if (r.PerInstrument == true)
                {
                    LQTListViewTag tag = new LQTListViewTag();
                    tag.GroupTitle = r.Instrument.InstrumentName;
                    tag.Id         = r.Id;
                    tag.Index      = index;
                    ListViewItem li = new ListViewItem(r.Product.ProductName)
                    {
                        Tag = tag
                    };

                    li.SubItems.Add(r.Period.ToString());
                    li.SubItems.Add(r.ProductUsageRate.ToString());

                    LqtUtil.AddItemToGroup(lsvProductUsageI, li);
                    lsvProductUsageI.Items.Add(li);
                    index++;
                }
            }

            lsvProductUsageI.EndUpdate();
        }
示例#12
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            Instrument ins = LqtUtil.GetComboBoxValue <Instrument>(comInstrument);

            if (ins != null)
            {
                MasterProduct pro = LqtUtil.GetComboBoxValue <MasterProduct>(comProduct);
                if (pro != null)
                {
                    if (!_test.IsExsistProductUsage(ins.Id, pro.Id))
                    {
                        ProductUsage pu = new ProductUsage();
                        pu.Test       = _test;
                        pu.Instrument = ins;
                        pu.Product    = pro;
                        pu.Rate       = 1;
                        _test.ProductUsages.Add(pu);

                        BindProductUsage();
                        if (OnDataUsageEdit != null)
                        {
                            OnDataUsageEdit(this, new EventArgs());
                        }
                    }
                }
            }
        }
        private void PopInstruments()
        {
            // _fCategoryInstrument = DataRepository.GetFCInstrumentByFinfoId(_Fid);

            lsvInstrument.BeginUpdate();
            lsvInstrument.Items.Clear();

            int index = 0;

            foreach (ForecastCategoryInstrument s in _fCategoryInstrument)
            {
                LQTListViewTag tag = new LQTListViewTag();
                tag.Id         = s.Id;
                tag.Index      = index;
                tag.GroupTitle = s.Instrument.TestingArea.AreaName;

                ListViewItem li = new ListViewItem(s.Instrument.InstrumentName)
                {
                    Tag = tag
                };
                //i.SubItems.Add(s.Instrument.InstrumentName);
                li.SubItems.Add(s.TestRunPercentage.ToString());
                LqtUtil.AddItemToGroup(lsvInstrument, li);
                lsvInstrument.Items.Add(li);
                index++;
            }
            if (_fCategoryInstrument.Count <= 0)
            {
                lbtRemove.Enabled = false;
            }
            lsvInstrument.EndUpdate();
        }
示例#14
0
        private void AddSubItemToPlatformView()
        {
            ClassOfMorbidityTestEnum[] ctest = LqtUtil.EnumToArray <ClassOfMorbidityTestEnum>();
            _sPlatformView.Items.Clear();
            _sPlatformView.BeginUpdate();

            foreach (ARTSite site in _artSites)
            {
                ListViewGroup group = new ListViewGroup(site.Id.ToString(), site.MorbidityCategory.CategoryName + "-> " + site.Site.SiteName);
                _sPlatformView.Groups.Add(group);

                for (int i = 0; i < ctest.Length; i++)
                {
                    EXListViewItem item = new EXListViewItem(ctest[i].ToString())
                    {
                        Tag = site
                    };
                    string remark = IsValidRow(site, ctest[i]);
                    if (remark != null)
                    {
                        item.BackColor = Color.Tomato;
                    }
                    item.SubItems.Add(new EXBoolListViewSubItem(site.TestWasSelected(ctest[i]))
                    {
                        BackColor = item.BackColor
                    });
                    if (ctest[i] == ClassOfMorbidityTestEnum.RapidTest || ctest[i] == ClassOfMorbidityTestEnum.Consumable)
                    {
                        item.SubItems.Add(new EXListViewSubItem());
                        item.SubItems.Add(new EXListViewSubItem());
                        item.SubItems.Add(new EXListViewSubItem());
                        item.SubItems.Add(new EXListViewSubItem());
                    }
                    else
                    {
                        item.SubItems.Add(new EXBoolListViewSubItem(site.TestWasReffered(ctest[i]))
                        {
                            BackColor = item.BackColor
                        });
                        item.SubItems.Add(new EXBoolListViewSubItem(site.HasPlatform(ctest[i]))
                        {
                            BackColor = item.BackColor
                        });
                        item.SubItems.Add(new EXListViewSubItem(site.NoOfPlatform(ctest[i]).ToString())
                        {
                            BackColor = item.BackColor
                        });
                        item.SubItems.Add(new EXListViewSubItem(remark)
                        {
                            BackColor = item.BackColor
                        });
                    }
                    item.Group = group;
                    _sPlatformView.Items.Add(item);
                }
            }
            _platformVisted = true;
            _sPlatformView.EndUpdate();
        }
示例#15
0
        public LQTUserMessage SaveOrUpdateObject()
        {
            if (txtName.Text.Trim() == "")
            {
                throw new LQTUserException("Product name must not be empty.");
            }
            else if (DataRepository.GetProductByName(txtName.Text.Trim()) != null &&
                     _product.Id <= 0)
            {
                throw new LQTUserException("The Product Name already exists.");
            }

            if (txtBasicunit.Text.Trim() == "")//b
            {
                throw new LQTUserException("Basic Unit must not be empty.");
            }

            if (txtminimumPacks.Text.Trim() == "")//b
            {
                throw new LQTUserException("Package Size must not be empty.");
            }
            if (_product.ProductPrices.Count <= 0)
            {
                throw new LQTUserException("Price must not be empty.");
            }

            _product.ProductName     = this.txtName.Text.Trim();
            _product.BasicUnit       = this.txtBasicunit.Text;
            _product.ProductNote     = this.txtNote.Text;
            _product.SerialNo        = this.txtSerialno.Text;
            _product.Specification   = this.txtSpecification.Text;
            _product.MinimumPackSize = int.Parse(txtminimumPacks.Text);


            if (_product.ProductType == null)
            {
                _product.ProductType = LqtUtil.GetComboBoxValue <ProductType>(comCategory);
            }
            if (_product.ProductType.UseInDemography)
            {
                if (_product.ProductType.ClassOfTestToEnum == ClassOfMorbidityTestEnum.RapidTest)
                {
                    _product.RapidTestGroup = comSpecification.Text;
                }
                else
                {
                    _product.RapidTestGroup = null;
                }
            }
            else
            {
                _product.RapidTestGroup = null;
            }

            DataRepository.SaveOrUpdateProduct(_product);

            return(new LQTUserMessage("Product was saved or updated successfully."));
        }
示例#16
0
        private void PopInstrument()
        {
            TestingArea ta = LqtUtil.GetComboBoxValue <TestingArea>(comTestarea);

            if (ta != null)
            {
                comInstrument.DataSource = DataRepository.GetListOfInstrumentByTestingArea(ta.Id);
            }
        }
示例#17
0
        private void PopPeriod()
        {
            PeriodEnum[] period = LqtUtil.EnumToArray <PeriodEnum>();
            comPeriodP.DataSource    = period;
            comPeriodP.SelectedIndex = -1;

            comPeriodI.DataSource    = period;
            comPeriodI.SelectedIndex = -1;
        }
示例#18
0
        private void butImport_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtFilename.Text.Trim()))
            {
                return;
            }

            try
            {
                var ds = LqtUtil.ReadExcelFile(txtFilename.Text, 13);

                _rdata = GetDataRow(ds);
                lvImport.BeginUpdate();
                lvImport.Items.Clear();

                foreach (var rd in _rdata)
                {
                    var li = new ListViewItem(rd.RowNo.ToString());
                    li.SubItems.Add(rd.RegionName);
                    li.SubItems.Add(rd.SiteName);
                    li.SubItems.Add(rd.PatientOnTreatment.ToString());
                    li.SubItems.Add(rd.PatientOnPreTreatment.ToString());
                    li.SubItems.Add(rd.EverStartedPonT.ToString());
                    li.SubItems.Add(rd.EverStartedPonPreT.ToString());
                    li.SubItems.Add(rd.Vct.ToString());
                    li.SubItems.Add(rd.CD4.ToString());
                    li.SubItems.Add(rd.Chemistry.ToString());
                    li.SubItems.Add(rd.Hematology.ToString());
                    li.SubItems.Add(rd.ViralLoad.ToString());
                    li.SubItems.Add(rd.OtherTest.ToString());
                    li.SubItems.Add(rd.Consumable.ToString());
                    li.SubItems.Add(rd.IsExist ? "Yes" : "No");
                    li.SubItems.Add(rd.ErrorDescription);

                    if (rd.HasError)
                    {
                        li.BackColor = Color.Red;
                    }
                    else if (rd.IsExist)
                    {
                        li.BackColor = Color.Green;
                    }
                    lvImport.Items.Add(li);
                }

                lvImport.EndUpdate();

                butClear.Enabled = true;
                butSave.Enabled  = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Importing", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#19
0
        private void btnviewreport_Click(object sender, EventArgs e)
        {
            try
            {
                if (_parentId == 3)
                {
                    _mforecast = LqtUtil.GetComboBoxValue <MorbidityForecast>(cobforecast);
                    LoadReport(_subreportId);
                }
                else
                {
                    FileInfo filinfo = null;

                    _finfo = LqtUtil.GetComboBoxValue <ForecastInfo>(cobforecast);
                    List <ReportParameter> param = new List <ReportParameter>();
                    ReportParameter        finfo = new ReportParameter("ForecastId", _finfo.Id.ToString());
                    param.Add(finfo);


                    FillReportDataSet();


                    if (cobreporttype.SelectedIndex == 0)
                    {
                        filinfo = new FileInfo(Path.Combine(AppSettings.GetReportPath, String.Format("{0}.rdlc", OReports.ServiceQSummary)));
                    }
                    else
                    {
                        filinfo = new FileInfo(Path.Combine(AppSettings.GetReportPath, String.Format("{0}.rdlc", OReports.FullQSummary)));
                    }


                    _fileToLoad = filinfo;


                    FrmReportViewer frmRV = new FrmReportViewer(_fileToLoad, _rDataSet, param);



                    frmRV.Dock = DockStyle.Fill;
                    // Close();
                    frmRV.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                new FrmShowError(new ExceptionStatus()
                {
                    message = "", ex = ex
                }).ShowDialog();
            }
        }
示例#20
0
        private void buttonLaunchReport_Click(object sender, EventArgs e)
        {
            try
            {
                if (comMethodologey.Text == MethodologyEnum.DEMOGRAPHIC.ToString())
                {
                    _mforecast = LqtUtil.GetComboBoxValue <MorbidityForecast>(cbomforecast);
                    LoadReport(cboreport.SelectedIndex);
                }
                else
                {
                    FileInfo filinfo = null;

                    _finfo = LqtUtil.GetComboBoxValue <ForecastInfo>(comForecastinfo);
                    List <ReportParameter> param = new List <ReportParameter>();
                    ReportParameter        finfo = new ReportParameter("ForecastId", _finfo.Id.ToString());
                    param.Add(finfo);


                    FillReportDataSet();


                    if (rdosite.Checked)
                    {
                        filinfo = new FileInfo(Path.Combine(AppSettings.GetReportPath, String.Format("{0}.rdlc", OReports.ServiceQSummary)));
                    }
                    else
                    {
                        filinfo = new FileInfo(Path.Combine(AppSettings.GetReportPath, String.Format("{0}.rdlc", OReports.FullQSummary)));
                    }


                    _fileToLoad = filinfo;


                    FrmReportViewer frmRV = new FrmReportViewer(_fileToLoad, _rDataSet, param);



                    frmRV.Dock = DockStyle.Fill;
                    Close();
                    frmRV.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                new FrmShowError(new ExceptionStatus()
                {
                    message = "", ex = ex
                }).ShowDialog();
            }
        }
示例#21
0
        private void butImport_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtFilename.Text.Trim()))
            {
                return;
            }
            try
            {
                DataSet ds = LqtUtil.ReadExcelFile(txtFilename.Text, 4);

                _rdata = GetDataRow(ds);
                bool haserror = false;

                lvImport.BeginUpdate();
                lvImport.Items.Clear();

                foreach (ImportQVariableData rd in _rdata)
                {
                    ListViewItem li = new ListViewItem(rd.RowNo.ToString());
                    li.SubItems.Add(rd.ProductName);
                    li.SubItems.Add(rd.UsageRate.ToString());
                    li.SubItems.Add(rd.QuantifyMenu);
                    li.SubItems.Add(rd.AppliedTo);
                    li.SubItems.Add(rd.IsExist ? "Yes" : "No");
                    li.SubItems.Add(rd.ErrorDescription);

                    if (rd.HasError)
                    {
                        li.BackColor = Color.Red;
                        haserror     = true;
                    }
                    else if (rd.IsExist)
                    {
                        li.BackColor = Color.Green;
                    }
                    lvImport.Items.Add(li);
                }

                lvImport.EndUpdate();

                butClear.Enabled = true;
                //if (!haserror)
                butSave.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Importing", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#22
0
        public override LQTUserMessage SaveOrUpdateObject()
        {
            ForlabRegion region = LqtUtil.GetComboBoxValue <ForlabRegion>(comRegion);

            if (txtName.Text.Trim() == string.Empty)
            {
                throw new LQTUserException("Site Name must not be empty.");
            }
            if (LqtUtil.GetComboBoxValue <ForlabRegion>(comRegion) == null)
            {
                throw new LQTUserException("A Region must be selected.");
            }
            if (DataRepository.GetSiteByName(txtName.Text.Trim(), LqtUtil.GetComboBoxValue <ForlabRegion>(comRegion).Id) != null &&
                _site.Id <= 0)
            {
                throw new LQTUserException("The Site Name already exists in the region.");
            }
            if (txtworkingdays.Text.Trim() == string.Empty)
            {
                throw new LQTUserException("General Working Days Can not be empty.");
            }

            _site.SiteName = txtName.Text;
            _site.CD4TestingDaysPerMonth        = int.Parse(txtCd4Td.Text);
            _site.ChemistryTestingDaysPerMonth  = int.Parse(txtChemTd.Text);
            _site.HematologyTestingDaysPerMonth = int.Parse(txthemaTd.Text);
            _site.ViralLoadTestingDaysPerMonth  = int.Parse(txtViralTd.Text);
            _site.OtherTestingDaysPerMonth      = int.Parse(txtOtherTd.Text);


            _site.CD4RefSite        = int.Parse(comCD4RefSite.Tag.ToString());
            _site.ChemistryRefSite  = int.Parse(comChemistryRefSite.Tag.ToString());
            _site.HematologyRefSite = int.Parse(comHematologyRefSite.Tag.ToString());
            _site.ViralLoadRefSite  = int.Parse(comViralLoadRefSite.Tag.ToString());
            _site.OtherRefSite      = int.Parse(comOtheRefSite.Tag.ToString());

            _site.WorkingDays = int.Parse(txtworkingdays.Text);

            if (_site.Region == null)
            {
                _site.Region = LqtUtil.GetComboBoxValue <ForlabRegion>(comRegion);
            }
            _site.SiteCategory = LqtUtil.GetComboBoxValue <SiteCategory>(comCategory);

            AddDefaultStatus();
            DataRepository.SaveOrUpdateSite(_site);

            return(new LQTUserMessage("Site was saved or updated successfully."));
        }
示例#23
0
        private void PopTest()
        {
            TestingArea ta = LqtUtil.GetComboBoxValue <TestingArea>(comTestarea);

            if (ta != null)
            {
                comTest.DataSource = ta.Tests;////////////////////
            }
            if (comTest.Items.Count > 0)
            {
                comTest.SelectedIndex = -1;
                // EnableSaveButton(this, new EventArgs());
            }
            // else
            //  DisableSaveButton(this, new EventArgs());
        }
示例#24
0
        private void PopTestingGroup()
        {
            TestingArea ta = LqtUtil.GetComboBoxValue <TestingArea>(comTestarea);

            comGroup.DataSource = ta.TestingGroups;
            //comGroup.DisplayMember = "GroupName";
            //comGroup.ValueMember = "Id";

            if (comGroup.Items.Count > 0)
            {
                OnEnableSaveButton();
            }
            else
            {
                OnDisableSaveButton();
            }
        }
示例#25
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void comCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            ProductType pt = LqtUtil.GetComboBoxValue <ProductType>(comCategory);

            if (pt != null)
            {
                if (pt.UseInDemography)
                {
                    if (pt.ClassOfTestToEnum == ClassOfMorbidityTestEnum.RapidTest)
                    {
                        comSpecification.Enabled = true;
                        return;
                    }
                }
            }
            comSpecification.Enabled = false;
        }
示例#26
0
        public LQTUserMessage SaveOrUpdateObject()
        {
            if (comTestarea.SelectedIndex < 0)
            {
                throw new LQTUserException("Testing Area can not be empty.");
            }

            if (_consum.TestingArea == null)
            {
                _consum.TestingArea = LqtUtil.GetComboBoxValue <TestingArea>(comTestarea);
            }
            if (comTest.SelectedIndex > -1)
            {
                _consum.Test = (Test)_consum.TestingArea.Tests[comTest.SelectedIndex];// LqtUtil.GetComboBoxValue<Test>(comTest);
            }
            DataRepository.SaveOrUpdateConsumables(_consum);
            return(new LQTUserMessage("Consumable was saved or updated successfully."));
        }
示例#27
0
        private void SearchSelectedPro()
        {
            if (_selectedPro == null)
            {
                _selectedPro = new List <int>();
            }
            else
            {
                _selectedPro.Clear();
            }

            QuantifyMenu qm = LqtUtil.GetComboBoxValue <QuantifyMenu>(comClass);

            foreach (QuantificationMetric m in qm.QuantificationMetrics)
            {
                _selectedPro.Add(m.Product.Id);
            }
        }
示例#28
0
        private LQTUserMessage SaveOrUpdateObject()
        {
            if (_morbidityTest.Id <= 0)
            {
                Instrument ins = LqtUtil.GetComboBoxValue <Instrument>(comInstrument);
                if (ins == null)
                {
                    throw new LQTUserException("Platform must not be empty.");
                }
                this._morbidityTest.Instrument = ins;
                this._morbidityTest.TestName   = ManageQuantificationMenus.BuildTestName(ins.InstrumentName, _morbidityTest.ClassOfTestEnum);
                ManageQuantificationMenus.CreateQuantifyMenus(_morbidityTest);
            }

            DataRepository.SaveOrUpdateMorbidityTest(_morbidityTest);

            return(new LQTUserMessage("Test was saved or updated successfully."));
        }
示例#29
0
        private bool ISValidReferralSite(string Referralsite, string siten, string platform, out ForlabSite refSite)
        {
            IList <ForlabSite> _referingSites = new List <ForlabSite>();

            IList <ForlabSite> _validsites = new List <ForlabSite>();

            refSite = null;
            bool isvalid = false;

            if (!String.IsNullOrEmpty(Referralsite))
            {
                refSite = DataRepository.GetSiteByName(Referralsite);
                if (refSite != null)
                {
                    if (refSite.SiteName != siten)
                    {
                        _validsites    = DataRepository.GetAllSiteByRegionandPlatform(-1, LqtUtil.RemoveWhitespace(platform));
                        _referingSites = DataRepository.GetReferingSiteByPlatform(LqtUtil.RemoveWhitespace(platform));
                        if (_validsites.Contains(refSite) && !_referingSites.Contains(refSite))
                        {
                            isvalid = true;
                        }
                        else
                        {
                            isvalid = false;
                        }
                    }
                    else
                    {
                        isvalid = false;
                    }
                }
                else
                {
                    isvalid = false;
                }
            }
            else
            {
                isvalid = false;
            }

            return(isvalid);
        }
示例#30
0
        private void PopTestingGroup()
        {
            TestingArea ta = LqtUtil.GetComboBoxValue <TestingArea>(comTestarea);

            if (ta != null)
            {
                comGroup.DataSource = ta.TestingGroups;
            }

            if (comGroup.Items.Count > 0)
            {
                comGroup.SelectedIndex = -1;
                EnableSaveButton(this, new EventArgs());
            }
            else
            {
                DisableSaveButton(this, new EventArgs());
            }
        }