Example #1
0
        public InstrumentForm(Instrument inst, Form mdiparent)
        {
            this._instrument = inst;
            this._mdiparent = mdiparent;

            InitializeComponent();

            lqtToolStrip1.SaveAndCloseClick += new EventHandler(lqtToolStrip1_SaveAndCloseClick);
            lqtToolStrip1.SaveAndNewClick += new EventHandler(lqtToolStrip1_SaveAndNewClick);

            LoadInstrumentCtr();
        }
Example #2
0
 public static void SaveOrUpdateInstrument(Instrument inst)
 {
     DaoFactory.GetDaoFactory().CreateInstrumentDao().SaveOrUpdate(inst);
 }
Example #3
0
 public static void DeleteInstrument(Instrument t)
 {
     DaoFactory.GetDaoFactory().CreateInstrumentDao().Delete(t);
 }
Example #4
0
        private void butSave_Click(object sender, EventArgs e)
        {
            int count = 0;
            int error = 0;
            try
            {
                foreach (ImportInsData rd in _rdata)
                {
                    if (!rd.IsExist)
                    {
                        Instrument ins = new Instrument();

                        ins.InstrumentName = rd.InsName;
                        ins.MaxThroughPut = rd.Rate;
                       // ins.MonthMaxTPut = (rd.Rate * 5) * 22;
                        ins.TestingArea = rd.TestingArea;
                        ins.DailyCtrlTest = rd.DailyCtrTest;
                        ins.WeeklyCtrlTest = rd.WeeklyCtrTest;
                        ins.MonthlyCtrlTest = rd.MonthlyCtrTest;
                        ins.QuarterlyCtrlTest = rd.QuarterlyCtrTest;
                        ins.MaxTestBeforeCtrlTest = rd.PerTestCtr;
                        count++;
                        DataRepository.SaveOrUpdateInstrument(ins);

                        if (rd.TestingArea.UseInDemography)
                        {
                            if (rd.TestingArea.ClassOfTestToEnum == ClassOfMorbidityTestEnum.CD4 ||
                                rd.TestingArea.ClassOfTestToEnum == ClassOfMorbidityTestEnum.Chemistry ||
                                rd.TestingArea.ClassOfTestToEnum == ClassOfMorbidityTestEnum.Hematology ||
                                rd.TestingArea.ClassOfTestToEnum == ClassOfMorbidityTestEnum.ViralLoad)
                            {
                                MorbidityTest mtest = new MorbidityTest();
                                mtest.Instrument = ins;
                                mtest.ClassOfTest = rd.TestingArea.Category;
                                mtest.TestName = ManageQuantificationMenus.BuildTestName(ins.InstrumentName, mtest.ClassOfTestEnum);
                                ManageQuantificationMenus.CreateQuantifyMenus(mtest);

                                DataRepository.SaveOrUpdateMorbidityTest(mtest);
                            }
                        }
                    }
                    else { error++; }

                }

                MessageBox.Show(count + " Instruments are imported and saved successfully." + Environment.NewLine + error + " Instruments Failed.", "Importing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();

            }
            catch
            {
                MessageBox.Show("Error: Unable to import and save Instrument data.", "Importing", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                DataRepository.CloseSession();
            }
        }
Example #5
0
        private void BindDataToChart()
        {
            IList<Instrument> _instList = new List<Instrument>();
            GetChartData();

            chart2.Series["Contribution"].Points.Clear();
            chart2.Series["Utilization"].Points.Clear();
            chart2.Series["Coverage"].Points.Clear();
            chart2.Titles[0].Text = "";

            if (_finfo.DatausageEnum == DataUsageEnum.DATA_USAGE1 || _finfo.DatausageEnum == DataUsageEnum.DATA_USAGE2)
            {
                if (_finfo.FMethodologeyEnum == MethodologyEnum.SERVICE_STATISTIC)
                {
                    DataView dv = new DataView(_dataSet.Tables[0]);
                    //coverage
                    int totalsum = 0;
                    List<InstrumentPerTA> listofITA = new List<InstrumentPerTA>();
                    bool isinthelist = false;
                    foreach (DataRow dr in _dataSet.Tables[0].Rows)
                    {
                        foreach (TestingArea ta in DataRepository.GetAllTestingArea())
                        {
                            if (ta.AreaName == Convert.ToString(dr["TestingArea"]))
                            {
                                //add instruments
                                Instrument ins = DataRepository.GetInstrumentByName(Convert.ToString(dr["InstrumentName"]));
                                _instList.Add(ins);

                                foreach (InstrumentPerTA a in listofITA)
                                {
                                    if (a.TestingArea == ta)
                                    {
                                        isinthelist = true;
                                        break;
                                    }
                                    else
                                    {
                                        isinthelist = false;
                                        break;
                                    }
                                }
                                if (!isinthelist)
                                {
                                    InstrumentPerTA IPTA = new InstrumentPerTA();
                                    IPTA.TestingArea = ta;
                                    IPTA.TotalTestDone = 0;//added jan 17
                                    listofITA.Add(IPTA);

                                }
                                foreach (InstrumentPerTA ia in listofITA)
                                {
                                    if (ia.TestingArea.AreaName == Convert.ToString(dr["TestingArea"]))
                                    {
                                        ia.Quantity = ia.Quantity + Convert.ToInt32(dr["Qty"]);
                                        ia.TotalTestDone = ia.TotalTestDone + Convert.ToDecimal(dr["TestsDone"]); //added jan 17
                                    }
                                }
                            }
                            //totalsum = totalsum + Convert.ToInt32(dr["Qty"]);
                        }
                    }

                    //bind instrument to list box
                    Instrument instrument = new Instrument();
                    instrument.Id = 0;
                    instrument.InstrumentName = "--All--";
                    _instList.Insert(0,instrument);
                    lstInstrument.DataSource = _instList;
                    lstInstrument.DisplayMember = "InstrumentName";
                    lstInstrument.ValueMember = "Id";

                    foreach (DataRow dr in _dataSet.Tables[0].Rows)
                    {
                        if(isSelectedInstrument(dr["InstrumentName"].ToString()))
                        {
                        decimal c = 0;
                        foreach (InstrumentPerTA a in listofITA)
                        {
                            if (a.TestingArea.AreaName == Convert.ToString(dr["TestingArea"]))
                            {
                                totalsum = a.Quantity;
                                c = (Convert.ToDecimal(Convert.ToDecimal(dr["TestsDone"]))) * 100 / a.TotalTestDone;
                                break;
                            }
                        }
                        decimal coverage = 0;
                        if (totalsum != 0)
                            coverage = Convert.ToDecimal(dr["Qty"]) / totalsum;

                        chart2.Series["Contribution"].Points.AddXY(dr["InstrumentName"].ToString(), c / 100);
                        // chart2.Series["Contribution"].LegendText = "Dx Contribution";

                        chart2.Series["Coverage"].Points.AddXY(dr["InstrumentName"].ToString(), coverage);
                        chart2.Series["Coverage"].LegendText = "Instrument Distribution";
                        }
                    }
                    //end coverage
                    // chart2.Series["Contribution"].Points.DataBindXY(dv, "InstrumentName", dv, "Contribution");
                    chart2.Series["Utilization"].Points.DataBindXY(dv, "InstrumentName", dv, "Utilization");
                    chart2.Series["Contribution"].LegendText = "Dx Contribution";
                    chart2.Series["Utilization"].LegendText = "Instrument Utilization";
                }
            }

            chart2.Titles[0].Text = _title;
            chart2.Invalidate();
        }
Example #6
0
 public void RebindInstrument(Instrument inst)
 {
     this._instrument = inst;
     BindInstrument();
 }
Example #7
0
        void lqtToolStrip1_SaveAndNewClick(object sender, EventArgs e)
        {
            try
            {
                LQTUserMessage msg = SaveOrUpdateObject();
                ((LqtMainWindowForm)_mdiparent).ShowStatusBarInfo(msg.Message, true);
                DataRepository.CloseSession();

                TestingArea ta = _instrument.TestingArea;
                _instrument = new Instrument();
                _instrument.TestingArea = ta;

                LoadInstrumentCtr();
                //if (_instrument.TestingArea != null)//b
                //{
                //    comTestarea.SelectedValue = _instrument.TestingArea.Id;
                //}
                comTestarea.SelectedIndex = -1;
            }
            catch (Exception ex)
            {
                new FrmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }