Example #1
0
        private void lbtAddReagent_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            FrmSelectPro frm = new FrmSelectPro(_qMenu.GetSelectedProductId(), _products);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                foreach (MasterProduct p in frm.SelectedProducts)
                {
                    QuantificationMetric q = new QuantificationMetric();
                    q.ClassOfTest = _qMenu.ClassOfTest;
                    q.CollectionSupplieAppliedTo = CollectionSupplieAppliedToEnum.Testing.ToString();
                    q.Product = p;
                    q.QuantifyMenu = _qMenu;
                    q.UsageRate = 1;
                    _qMenu.QuantificationMetrics.Add(q);
                }

                PopListView();
            }
        }
Example #2
0
 public static void DeleteQuantificationMetric(QuantificationMetric mtest)
 {
     DaoFactory.GetDaoFactory().CreateQuantificationMetricDao().Delete(mtest);
 }
Example #3
0
 public static void SaveOrUpdateQuantificationMetric(QuantificationMetric mtest)
 {
     DaoFactory.GetDaoFactory().CreateQuantificationMetricDao().SaveOrUpdate(mtest);
 }
Example #4
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();
        }
Example #5
0
        private IList<ImportQVariableData> GetDataRow(DataSet ds)
        {
            DataRepository.CloseSession();

            int rowno = 0;
            IList<ImportQVariableData> rdlist = new List<ImportQVariableData>();
            double usagerate;
            _modifiedQuantifyMenus = new Dictionary<int, QuantifyMenu>();
            _listofQmenus = null;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                rowno++;
                if (!DatarowValueToDouble(dr[1], out usagerate))
                    usagerate = 1;

                ImportQVariableData rd = new ImportQVariableData(Convert.ToString(dr[0]), usagerate, Convert.ToString(dr[2]), Convert.ToString(dr[3]), rowno);
                rdlist.Add(rd);
            }

            foreach (ImportQVariableData rd in rdlist)
            {
                if (!string.IsNullOrEmpty(rd.ProductName))
                {
                    rd.Product = DataRepository.GetProductByName(rd.ProductName);
                    if (rd.Product != null)
                    {
                        if (!string.IsNullOrEmpty(rd.QuantifyMenu))
                        {
                            QuantifyMenu qm = GetQuantifyMenuByTitle(rd.QuantifyMenu);
                            if (qm != null)
                            {
                                if (qm.IsProductSelected(rd.Product.Id))
                                {
                                    rd.IsExist = true;
                                    rd.ErrorDescription = "Already this quantification variable is existed";
                                }
                                else
                                {
                                    QuantificationMetric qmetric = new QuantificationMetric();
                                    qmetric.ClassOfTest = qm.ClassOfTest;
                                    qmetric.CollectionSupplieAppliedTo = rd.AppliedTo;
                                    qmetric.Product = rd.Product;
                                    qmetric.QuantifyMenu = qm;
                                    qmetric.UsageRate = rd.UsageRate;

                                    qm.QuantificationMetrics.Add(qmetric);
                                    AddModifiedQMenu(qm);
                                }
                            }
                            else
                            {
                                rd.HasError = true;
                                rd.ErrorDescription = "Error: unable to found Quantification variable";
                            }
                        }
                        else
                        {
                            rd.HasError = true;
                            rd.ErrorDescription = "Error: Quantify according to is empty";
                        }

                    }
                    else
                    {
                        rd.HasError = true; ;
                        rd.ErrorDescription = "Error: unable to found a Product";
                    }
                }
                else
                {
                    rd.HasError = true;
                    rd.ErrorDescription = "Error: Product name is empty";
                }
            }

            return rdlist;
        }