/// <summary> /// Handles the CellEndEdit event of the dataGridViewX1 control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Forms.DataGridViewCellEventArgs"/> instance containing the event data.</param> private void DataGridViewX1CellEndEdit(object sender, DataGridViewCellEventArgs e) { var prescriptionDetail = (PrescriptionDetail)this.bdsPrescriptionDetail.Current; if (prescriptionDetail == null) { return; } switch (e.ColumnIndex) { case 0: var medicine = _medicineRepo.GetById(prescriptionDetail.MedicineId); if (medicine == null) { prescriptionDetail.MedicineName = String.Empty; prescriptionDetail.TradeName = String.Empty; prescriptionDetail.UnitName = String.Empty; prescriptionDetail.InventoryVolumn = 0; break; } prescriptionDetail.MedicineName = medicine.Name; prescriptionDetail.TradeName = medicine.TradeName; prescriptionDetail.UnitName = medicine.Define.Name; prescriptionDetail.InventoryVolumn = _medicineRepo.GetInventoryVolumeWareHouseByMedicineId(AppContext.CurrentClinic.Id, prescriptionDetail.MedicineId); break; case 3: prescriptionDetail.Calculate(); break; case 4: prescriptionDetail.Calculate(); break; default: break; } // if (e.ColumnIndex == 2 || e.ColumnIndex == 3) prescriptionDetail.Calculate(); // prescriptionDetail.Validate(); // prescriptionDetail.InventoryVolumn = _medicineRepo.GetInventoryVolumeWareHouseByMedicineId(AppContext.CurrentClinic.Id, prescriptionDetail.MedicineId); if (!CheckDuplicate(prescriptionDetail.MedicineId)) { prescriptionDetail.AddError("MedicineId", "Thuốc đã tồn tại"); } }
public MedicineOutputChooser(int medicineId, DateTime date) { InitializeComponent(); this.date = date; // Get Medicine this.medicine = medicineRepo.GetById(medicineId); if (this.medicine == null) { throw new Exception("Medicine dose not exist"); } this.txtMedicine.Text = this.medicine.Name; this.txtTradeName.Text = this.medicine.TradeName; this.txtUnit.Text = this.medicine.Define == null ? String.Empty : this.medicine.Define.Name; // Get Warehouse this.warehouse = warehouseRepo.GetByIdMedicine(medicineId, AppContext.CurrentClinic.Id); this.txtInstock.Text = this.warehouse == null ? "0" : this.warehouse.Volumn.ToString(); var vwarehouseDetail = this.vwarehouseDetailRepo.GetWarehouseDetailForOutput(this.date, medicineId, AppContext.CurrentClinic.Id); this.bdsVWarehouseDetail.DataSource = vwarehouseDetail; }
public async Task <Medicine> GetById(int medicineId) { return(await _medicineRepo.GetById(medicineId)); }
public Medicine GetById(long id) => _medicineRepository.GetById(id);
// GET: Medicine/Edit/5 public ActionResult Edit(int id) { var medicine = _mapper.Map <MedicineViewModel>(_medicineRepository.GetById(id)); return(View(medicine)); }
private void Med_Product_Details_Click(object sender, EventArgs e) { medSecondForm = new MedicineProductForm(medRepos, medRepos.GetById((int)dataGridView1.CurrentCell.Value)); medSecondForm.Show(); }