private void lbtRemove_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { QuantificationMetric qmetric = GetSelectedGeneralQM(); if (qmetric != null) { if (MessageBox.Show("Are you sure you want to delete this Quantification Metric?", "Delete Quantification Metric", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { QuantifyMenu qm = qmetric.QuantifyMenu; qm.QuantificationMetrics.Remove(qmetric); DataRepository.SaveOrUpdateQuantifyMenu(qm); PopGeneralQM(); lbtRemove.Enabled = false; MdiParentForm.ShowStatusBarInfo("Quantification Metric was deleted successfully."); } catch (Exception ex) { new FrmShowError(new ExceptionStatus() { ex = ex, message = "Sorry, there are an error to delete this Quantification Metric." }).ShowDialog(); } } } }
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(); }
private void lbtRemoveReagent_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (listView1.SelectedItems.Count > 0) { QuantificationMetric qm = listView1.SelectedItems[0].Tag as QuantificationMetric; _qMenu.QuantificationMetrics.Remove(qm); PopListView(); } }
public void Save(QuantificationMetric qm, SqlTransaction tr) { string sql = "INSERT INTO QuantificationMetric(ProductId, QuantifyMenu, UsageRate) VALUES (@ProductId, @QuantifyMenu, @UsageRate) SELECT @@identity"; using (SqlCommand cm = new SqlCommand(sql, DefaultConnection, tr)) { SetQuantificationMetric(cm, qm); qm.Id = int.Parse(cm.ExecuteScalar().ToString()); } }
public void Update(QuantificationMetric qm, SqlTransaction tr) { string sql = "Update QuantificationMetric SET ProductId = @ProductId, QuantifyMenu = @QuantifyMenu, UsageRate = @UsageRate where Id = @Id"; using (SqlCommand cm = new SqlCommand(sql, DefaultConnection, tr)) { DatabaseHelper.InsertInt32Param("@Id", cm, qm.Id); SetQuantificationMetric(cm, qm); cm.ExecuteNonQuery(); } }
private void lbtRemoveReagent_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if ((_sListView.SelectedItems.Count > 0) && MessageBox.Show("Are you sure, do you want to remove it?", "ART-Test Reagent", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { QuantificationMetric metric = _sListView.SelectedItems[0].Tag as QuantificationMetric; QuantifyMenu qm = _morbidityTest.GetQuantifyMenuById(metric.QuantifyMenu.Id); qm.QuantificationMetrics.Remove(metric); DataRepository.SaveOrUpdateMorbidityTest(_morbidityTest); PopListView(); } }
private QuantificationMetric FetchQuantificationMetric(SqlDataReader dr) { QuantificationMetric t = new QuantificationMetric() { Id = DatabaseHelper.GetInt32("Id", dr), ProductId = DatabaseHelper.GetInt32("ProductId", dr), QuantifyMenu = (GeneralQuantifyMenu)Enum.Parse(typeof(GeneralQuantifyMenu), DatabaseHelper.GetString("QuantifyMenu", dr)), UsageRate = DatabaseHelper.GetDouble("UsageRate", dr), ProductName = DatabaseHelper.GetString("ProductName", dr), BasicUnit = DatabaseHelper.GetString("BasicUnit", dr), PackSize = DatabaseHelper.GetInt32("PackSize", dr) }; return t; }
private void butOk_Click(object sender, EventArgs e) { if (_morbidityTest == null) { foreach (ListViewItem li in lstSelectedPro.Items) { QuantificationMetric qm = (QuantificationMetric)li.Tag; if (!IsQMSelectedToSave(qm.QuantifyMenu)) { _qmtosave.Add(qm.QuantifyMenu); } //DataRepository.SaveOrUpdateQuantificationMetric(qm); } SaveQMenum(); } this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
private void _sListView_EditableListViewSubitemValueChanged(object sender, EXEditableListViewSubitemEventArgs e) { QuantificationMetric qm = (QuantificationMetric)e.ListVItem.Tag; if (e.SubItem.ColumnName.ToString() == "U.Rate") { try { qm.UsageRate = Convert.ToDouble(e.SubItem.Text); } catch { e.SubItem.Text = qm.UsageRate.ToString(); } } else { qm.CollectionSupplieAppliedTo = e.SubItem.Text; } }
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(); } }
private void SetQuantificationMetric(SqlCommand cm, QuantificationMetric q) { DatabaseHelper.InsertInt32Param("@ProductId", cm, q.ProductId); DatabaseHelper.InsertStringNVarCharParam("@QuantifyMenu", cm, q.QuantifyMenu.ToString()); DatabaseHelper.InsertDoubleParam("@UsageRate", cm, q.UsageRate); }
public static void DeleteQuantificationMetric(QuantificationMetric mtest) { DaoFactory.GetDaoFactory().CreateQuantificationMetricDao().Delete(mtest); }
public static void SaveOrUpdateQuantificationMetric(QuantificationMetric mtest) { DaoFactory.GetDaoFactory().CreateQuantificationMetricDao().SaveOrUpdate(mtest); }
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); }