示例#1
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());
                        }
                    }
                }
            }
        }
示例#2
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());
                        }
                    }
                }
            }
        }
示例#3
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();
        }
示例#4
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."));
        }
示例#5
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());
                        }
                    }
                }
            }
        }
示例#6
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());
                            }
                        }
                    }
                }
            }
        }
示例#7
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."));
        }
示例#8
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."));
        }
示例#9
0
        private void PopInstrument()
        {
            TestingArea ta = LqtUtil.GetComboBoxValue <TestingArea>(comTestarea);

            if (ta != null)
            {
                comInstrument.DataSource = DataRepository.GetListOfInstrumentByTestingArea(ta.Id);
            }
        }
示例#10
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();
            }
        }
示例#11
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();
            }
        }
示例#12
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."));
        }
示例#13
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());
        }
示例#14
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;
        }
示例#15
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();
            }
        }
示例#16
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."));
        }
示例#17
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);
            }
        }
示例#18
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."));
        }
示例#19
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());
            }
        }
示例#20
0
        public LQTUserMessage SaveOrUpdateObject()
        {
            if (txtTestname.Text == "")
            {
                throw new LQTUserException("Test name must not be empty.");
            }
            Test temp = DataRepository.GetTestByName(txtTestname.Text.Trim());

            if (_test.Id <= 0 && temp != null)
            {
                throw new LQTUserException("The Test Name already exists.");
            }
            if (temp != null && _test.Id != temp.Id)
            {
                throw new LQTUserException("The Test Name already exists.");
            }
            temp = null;

            this._test.TestName = this.txtTestname.Text.Trim();

            if (comTestarea.SelectedIndex < 0)
            {
                throw new LQTUserException("Testing Area can not be empty.");
            }


            if (_test.TestingArea == null)
            {
                _test.TestingArea = LqtUtil.GetComboBoxValue <TestingArea>(comTestarea);
            }

            DataRepository.SaveOrUpdateTest(_test);
            if (_consum != null)
            {
                this._consum.Test        = _test;
                this._consum.TestingArea = _test.TestingArea;
                if (_consum.ConsumableUsages.Count > 0)
                {
                    DataRepository.SaveOrUpdateConsumables(_consum);
                }
            }
            return(new LQTUserMessage("Test was saved or updated successfully."));
        }
示例#21
0
 private void comregion_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comregion.Text == "--Select Region Here--")
     {
         _regionId = 0;
     }
     else
     {
         if (LqtUtil.GetComboBoxValue <ForlabRegion>(comregion) != null)
         {
             _selectedRegion = LqtUtil.GetComboBoxValue <ForlabRegion>(comregion);
             _regionId       = _selectedRegion.Id;
         }
         else
         {
             _regionId = 0;
         }
     }
     BindDataToChart();
 }
示例#22
0
        public override LQTUserMessage SaveOrUpdateObject()
        {
            if (txtTestname.Text == "")
            {
                throw new LQTUserException("Test name must not be empty.");
            }
            else if (
                _test.Id <= 0 &&
                DataRepository.GetTestByNameAndTestArea(txtTestname.Text.Trim(), LqtUtil.GetComboBoxValue <TestingArea>(comTestarea).Id) != null)
            {
                throw new LQTUserException("The Test Name already exists.");
            }

            this._test.TestName = this.txtTestname.Text;
            if (_test.TestingArea == null || _test.TestingGroup == null)
            {
                _test.TestingArea  = LqtUtil.GetComboBoxValue <TestingArea>(comTestarea);
                _test.TestingGroup = LqtUtil.GetComboBoxValue <TestingGroup>(comGroup);
            }



            this._test.TestType = comTestType.SelectedValue.ToString();

            if (comTestType.SelectedValue.ToString() == TestTypeEnum.ControlTest.ToString())
            {
                this._test.TestingDuration = comTestingDuration.SelectedValue.ToString();
            }
            else
            {
                this._test.TestingDuration = null;
            }

            DataRepository.SaveOrUpdateTest(_test);
            if (!butAdd.Enabled)
            {
                butAdd.Enabled = true;
            }
            return(new LQTUserMessage("Test was saved or updated successfully."));
        }
示例#23
0
        private void PopInstrument()
        {
            TestingArea ta = LqtUtil.GetComboBoxValue <TestingArea>(comTestarea);

            if (ta != null)
            {
                comInstrument.DataSource = DataRepository.GetListOfInstrumentByTestingArea(ta.Id);
                if (comInstrument.Items.Count > 0)
                {
                    comInstrument.SelectedIndex = -1;
                    butAdd.Enabled = true;
                }
                else
                {
                    butAdd.Enabled = false;
                }
            }
            else
            {
                butAdd.Enabled = false;
            }
        }
        private void cobtestingarea_SelectedIndexChanged(object sender, EventArgs e)
        {
            cobtestingarea.DisplayMember = "AreaName";
            cobtestingarea.ValueMember   = "Id";

            if (cobtestingarea.Text == "--Select Here--")
            {
                _testingArea = string.Empty;
            }
            else
            {
                if (LqtUtil.GetComboBoxValue <TestingArea>(cobtestingarea) != null)
                {
                    _testingArea = LqtUtil.GetComboBoxValue <TestingArea>(cobtestingarea).AreaName;
                }
                else
                {
                    _testingArea = string.Empty;
                }
            }
            BindDataToChart();
        }
示例#25
0
        public override LQTUserMessage SaveOrUpdateObject()
        {
            if (txtAreaname.Text.Trim() == "")
            {
                throw new LQTUserException("Group name must not be empty.");
            }

            this._testingGroup.GroupName = this.txtAreaname.Text;

            if (_testingGroup.TestingArea == null)
            {
                TestingArea ta = LqtUtil.GetComboBoxValue <TestingArea>(comTestarea);
                this._testingGroup.TestingArea = ta;
            }
            //else if (_testingGroup.Id <= 0)
            //{
            //    _testingGroup.TestingArea.TestingGroups.Add(_testingGroup);
            //}

            DataRepository.SaveOrUpdateTestingGroup(_testingGroup);
            DataRepository.CloseSession();
            return(new LQTUserMessage("Testing Group was saved or updated successfully."));
        }
示例#26
0
        private void comCInstrument_SelectedIndexChanged(object sender, EventArgs e)
        {
            Instrument _cIns = LqtUtil.GetComboBoxValue <Instrument>(comCInstrument);

            if (_cIns != null)
            {
                if (_cIns.DailyCtrlTest > 0)
                {
                    lblCInstrumentControlP.Text = InstrumentControlPeriod.Daily.ToString() + ":" + _cIns.DailyCtrlTest.ToString();
                }
                else if (_cIns.WeeklyCtrlTest > 0)
                {
                    lblCInstrumentControlP.Text = InstrumentControlPeriod.Weekly.ToString() + ":" + _cIns.WeeklyCtrlTest.ToString();
                }
                else if (_cIns.MonthlyCtrlTest > 0)
                {
                    lblCInstrumentControlP.Text = InstrumentControlPeriod.Monthly.ToString() + ":" + _cIns.MonthlyCtrlTest.ToString();
                }
                else if (_cIns.QuarterlyCtrlTest > 0)
                {
                    lblCInstrumentControlP.Text = InstrumentControlPeriod.Quarterly.ToString() + ":" + _cIns.QuarterlyCtrlTest.ToString();
                }
                else if (_cIns.MaxTestBeforeCtrlTest > 0)
                {
                    lblCInstrumentControlP.Text = InstrumentControlPeriod.Per_Test.ToString().Replace('_', ' ') + ":" + _cIns.MaxTestBeforeCtrlTest.ToString();
                }
                else
                {
                    lblCInstrumentControlP.Text = "";
                }
            }
            else
            {
                lblCInstrumentControlP.Text = "";
            }
        }
示例#27
0
        public LQTUserMessage SaveOrUpdateObject()
        {
            if (txtName.Text.Trim() == string.Empty)
            {
                throw new LQTUserException("Instrument name can not be empty.");
            }
            else if (DataRepository.GetInstrumentByName(txtName.Text.Trim()) != null &&
                     _instrument.Id <= 0)
            {
                throw new LQTUserException("The Instrument Name already exists.");
            }

            if (comTestarea.SelectedIndex < 0)
            {
                throw new LQTUserException("Testing Area can not be empty.");
            }

            if (txtMaxput.Text.Trim() == string.Empty)
            {
                throw new LQTUserException("Max. Through Put can not be empty.");
            }

            if (int.Parse(this.txtMaxput.Text) <= 0)
            {
                throw new LQTUserException("Max. Through Put should be greater than 0.");
            }

            //TestingArea ta = DataRepository.GetTestingAreaByName(comTestarea.Text);// LqtUtil.GetComboBoxValue<TestingArea>(comTestarea);
            //this._instrument.TestingArea = ta;
            if (_instrument.TestingArea == null)
            {
                TestingArea ta = LqtUtil.GetComboBoxValue <TestingArea>(comTestarea);
                this._instrument.TestingArea = ta;
            }


            _instrument.InstrumentName = this.txtName.Text.Trim();
            _instrument.MaxThroughPut  = int.Parse(this.txtMaxput.Text);

            if (txtdailyctrltest.Text.Trim() == string.Empty)
            {
                _instrument.DailyCtrlTest = 0;
            }
            else
            {
                _instrument.DailyCtrlTest = int.Parse(this.txtdailyctrltest.Text);
            }



            if (txtnooftestBctrl.Text.Trim() == string.Empty)
            {
                _instrument.MaxTestBeforeCtrlTest = 0;
            }
            else
            {
                _instrument.MaxTestBeforeCtrlTest = int.Parse(this.txtnooftestBctrl.Text);
            }

            if (txtweekly.Text.Trim() == string.Empty)
            {
                _instrument.WeeklyCtrlTest = 0;
            }
            else
            {
                _instrument.WeeklyCtrlTest = int.Parse(this.txtweekly.Text);
            }

            if (txtmonthly.Text.Trim() == string.Empty)
            {
                _instrument.MonthlyCtrlTest = 0;
            }
            else
            {
                _instrument.MonthlyCtrlTest = int.Parse(this.txtmonthly.Text);
            }

            if (txtquarterly.Text.Trim() == string.Empty)
            {
                _instrument.QuarterlyCtrlTest = 0;
            }
            else
            {
                _instrument.QuarterlyCtrlTest = int.Parse(this.txtquarterly.Text);
            }


            DataRepository.SaveOrUpdateInstrument(_instrument);

            return(new LQTUserMessage("Instrument was saved or updated successfully."));
        }
示例#28
0
        private void button1_Click(object sender, EventArgs e)
        {
            #region screeining--------------------------------
            if (comSrapid1.Text != "---NONE---")
            {
                _scrtest[0].Product = LqtUtil.GetComboBoxValue <MasterProduct>(comSrapid1);
            }
            else
            {
                _scrtest[0].Product = null;
            }

            if (comSrapid2.Text != "---NONE---")
            {
                _scrtest[1].Product = LqtUtil.GetComboBoxValue <MasterProduct>(comSrapid2);
            }
            else
            {
                _scrtest[1].Product = null;
            }

            if (comSrapid3.Text != "---NONE---")
            {
                _scrtest[2].Product = LqtUtil.GetComboBoxValue <MasterProduct>(comSrapid3);
            }
            else
            {
                _scrtest[2].Product = null;
            }

            #endregion

            #region Confermatory------------------------
            if (comSCrapid1.Text != "---NONE---")
            {
                _contest[0].Product = LqtUtil.GetComboBoxValue <MasterProduct>(comSCrapid1);
            }
            else
            {
                _contest[0].Product = null;
            }

            if (comSCrapid2.Text != "---NONE---")
            {
                _contest[1].Product = LqtUtil.GetComboBoxValue <MasterProduct>(comSCrapid2);
            }
            else
            {
                _contest[1].Product = null;
            }

            if (comSCrapid3.Text != "---NONE---")
            {
                _contest[2].Product = LqtUtil.GetComboBoxValue <MasterProduct>(comSCrapid3);
            }
            else
            {
                _contest[2].Product = null;
            }
            #endregion

            #region tie-breaker--------------------------------
            if (comSTrapid1.Text != "---NONE---")
            {
                _tietest[0].Product = LqtUtil.GetComboBoxValue <MasterProduct>(comSTrapid1);
            }
            else
            {
                _tietest[0].Product = null;
            }

            if (comSTrapid2.Text != "---NONE---")
            {
                _tietest[1].Product = LqtUtil.GetComboBoxValue <MasterProduct>(comSTrapid2);
            }
            else
            {
                _tietest[1].Product = null;
            }

            if (comSTrapid3.Text != "---NONE---")
            {
                _tietest[2].Product = LqtUtil.GetComboBoxValue <MasterProduct>(comSTrapid3);
            }
            else
            {
                _tietest[2].Product = null;
            }

            #endregion

            SaveRapidTests();

            BindSerialRapidTest();
            BindParallelRapidTest();
        }
示例#29
0
        private void _sListView_EditableListViewSubitemValueChanged(object sender, EXEditableListViewSubitemEventArgs e)
        {
            ImportedReagionOrCategory ta = (ImportedReagionOrCategory)e.ListVItem.Tag;

            ta.MCategory = LqtUtil.GetComboBoxValue <MorbidityCategory>(_comTestingArea);
        }
示例#30
0
        public LQTUserMessage SaveOrUpdateObject()
        {
            bool         refSite  = true;
            bool         testDays = true;
            ForlabRegion region   = LqtUtil.GetComboBoxValue <ForlabRegion>(comRegion);

            this.Focus();
            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.");
            }
            if (int.Parse(txtworkingdays.Text) > 31)
            {
                throw new LQTUserException("General Working Days Can not be greater than 31.");
            }

            if (comsitelevel.Text.Trim() == string.Empty)
            {
                throw new LQTUserException("Site Level Can not be empty.");
            }

            if (comCategory.Text.Trim() == string.Empty)
            {
                throw new LQTUserException("Site Category can not be empty. Please add site category first.");
            }

            string test     = "";
            string wDays    = "";
            bool   workDays = false;

            _site.SiteName = txtName.Text.Trim();
            if (txtCd4Td.Text == "")
            {
                txtCd4Td.Text = "0";
            }

            if (int.Parse(txtCd4Td.Text) > int.Parse(txtworkingdays.Text))
            {
                testDays = false;
                test     = test + "CD4, ";
            }
            else
            {
                _site.CD4TestingDaysPerMonth = int.Parse(txtCd4Td.Text);
            }
            if (txtChemTd.Text == "")
            {
                txtChemTd.Text = "0";
            }
            if (int.Parse(txtChemTd.Text) > int.Parse(txtworkingdays.Text))
            {
                testDays = false;
                test     = test + "Chemistry, ";
            }
            else
            {
                _site.ChemistryTestingDaysPerMonth = int.Parse(txtChemTd.Text);
            }

            if (txthemaTd.Text == "")
            {
                txthemaTd.Text = "0";
            }
            if (int.Parse(txthemaTd.Text) > int.Parse(txtworkingdays.Text))
            {
                testDays = false;
                test     = test + "Hematology, ";
            }
            else
            {
                _site.HematologyTestingDaysPerMonth = int.Parse(txthemaTd.Text);
            }
            if (txtViralTd.Text == "")
            {
                txtViralTd.Text = "0";
            }
            if (int.Parse(txtViralTd.Text) > int.Parse(txtworkingdays.Text))
            {
                testDays = false;
                test     = test + "Viral Load, ";
            }
            else
            {
                _site.ViralLoadTestingDaysPerMonth = int.Parse(txtViralTd.Text);
            }
            if (txtOtherTd.Text == "")
            {
                txtOtherTd.Text = "0";
            }
            if (int.Parse(txtOtherTd.Text) > int.Parse(txtworkingdays.Text))
            {
                testDays = false;
                test     = test + "Other: ";
            }
            else
            {
                _site.OtherTestingDaysPerMonth = int.Parse(txtOtherTd.Text);
            }
            _site.SiteLevel = comsitelevel.Text;


            //if (int.Parse(comCD4RefSite.Tag.ToString()) > 0 && int.Parse(txtCd4Td.Text) <= 0)//jul 5
            //{
            //    wDays = wDays + "CD4, ";
            //    workDays = true;
            //}
            //if (int.Parse(comChemistryRefSite.Tag.ToString()) > 0 && int.Parse(txtChemTd.Text) <= 0)
            //{
            //    wDays = wDays + "Chemistry, ";
            //    workDays = true;
            //}
            //if (int.Parse(comHematologyRefSite.Tag.ToString()) > 0 && int.Parse(txthemaTd.Text) <= 0)
            //{
            //    wDays = wDays + "Hematology, ";
            //    workDays = true;
            //}
            //if (int.Parse(comViralLoadRefSite.Tag.ToString()) > 0 && int.Parse(txtViralTd.Text) <= 0)
            //{
            //    wDays = wDays + "Viral Load, ";
            //    workDays = true;
            //}
            //if (int.Parse(comOtheRefSite.Tag.ToString()) > 0 && int.Parse(txtOtherTd.Text) <= 0)
            //{
            //    wDays = wDays + "Other: ";
            //    workDays = true;
            //}
            _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 (workDays)
            //{
            //    throw new LQTUserException(wDays + " Testing days has to be greater than 0.");
            //}
            if (testDays == false)
            {
                throw new LQTUserException(test + " Testing Days Can't be Greater Than Working Days.");
            }
            if (refSite == false)
            {
                throw new LQTUserException("A Site Can't be Referral Site for Itself.");
            }
            if (_site.Region == null)
            {
                _site.Region = LqtUtil.GetComboBoxValue <ForlabRegion>(comRegion);
            }
            _site.SiteCategory = LqtUtil.GetComboBoxValue <SiteCategory>(comCategory);

            string       siteCategory = _site.SiteCategory.CategoryName; //b
            SiteCategory sCatagory;                                      //b

            if (!string.IsNullOrEmpty(siteCategory))                     //b
            {
                sCatagory = DataRepository.GetSiteCategoryByName(siteCategory);
                if (siteCategory == null)
                {
                    sCatagory = new SiteCategory();
                    sCatagory.CategoryName = siteCategory;
                    DataRepository.SaveOrUpdateSiteCategory(sCatagory);
                }
            }
            if (lsvInstrument.Items.Count > 0)//b
            {
                if (TestDaysCount() != "")
                {
                    throw new LQTUserException(TestDaysCount() + " Testing days has to be greater than 0");
                }
                //if (WorkingDaysCount() != "")//dec19
                //{
                //    throw new LQTUserException(WorkingDaysCount() + " Testing days has to be 0");
                //}
                if (TestInstrumentPercentage() == "")//b
                {
                    AddDefaultStatus();
                    DataRepository.SaveOrUpdateSite(_site);
                    return(new LQTUserMessage("Site was saved or updated successfully."));
                }
                else//b
                    //  return new LQTUserMessage("Site can not be  saved or updated");
                {
                    throw new LQTUserException("The sum of % Tests Run for the " + TestInstrumentPercentage() + " must add up to 100%");
                }
            }
            else
            {
                string workingtestDays = "";
                if (int.Parse(txtCd4Td.Text) > 0) //&& comCD4RefSite.Tag.ToString() == "0")//add jul 5
                {
                    workingtestDays = workingtestDays + "CD4, ";
                }
                if (int.Parse(txtChemTd.Text) > 0)// && comChemistryRefSite.Tag.ToString() == "0")
                {
                    workingtestDays = workingtestDays + "Chemistry, ";
                }
                if (int.Parse(txthemaTd.Text) > 0)// && comHematologyRefSite.Tag.ToString() == "0")
                {
                    workingtestDays = workingtestDays + "Hematology, ";
                }
                if (int.Parse(txtViralTd.Text) > 0)// && comViralLoadRefSite.Tag.ToString() == "0")
                {
                    workingtestDays = workingtestDays + "Viral Load, ";
                }
                if (int.Parse(txtOtherTd.Text) > 0)// && comOtheRefSite.Tag.ToString() == "0")
                {
                    workingtestDays = workingtestDays + "Other ";
                }
                //if(workingtestDays!="")//dec 19
                //throw new LQTUserException(workingtestDays + " Testing days has to be 0");
                AddDefaultStatus();
                DataRepository.SaveOrUpdateSite(_site);

                return(new LQTUserMessage("Site was saved or updated successfully."));
            }
        }