private void txtUnit_KeyPress(object sender, KeyPressEventArgs e) { DialogResult dr = MessageBox.Show("Bạn có muốn cập nhật không?", "Cập nhật", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { Medicine medicine = FillToEntity(); if (medicine.Id == 0) { medicineRepository.Insert(medicine); } else { medicineRepository.Update(medicine); } this.Close(); } }
private void btnSynch_Click(object sender, System.EventArgs e) { if (this.Clinic == null || this.Clinic.Id == 0) { return; } var dialogResult = Medical.Forms.UI.MessageDialog.Instance.ShowMessage(this, "Q009", this.Clinic.Name); if (dialogResult == DialogResult.No) { return; } // Update tu server List <TableChange> lstServer = tableChangeServerRep.GetByClinicId(1); Medicine _clientEntiy; Medicine _serverEntity; if (lstServer.Count > 0) { foreach (TableChange ent in lstServer) { switch (ent.TableName.ToString()) { case "Medicine": _serverEntity = medicineServerRep.GetById(ent.Id); if (ent.Action.Equals("I")) { if ((Medicine)medicineRep.GetById(ent.Id) == null) { _clientEntiy = new Medicine(); _clientEntiy = medicineRep.CopyEntity(_clientEntiy, _serverEntity); medicineRep.Insert(_clientEntiy); } } if (ent.Action.Equals("U")) { if ((Medicine)medicineRep.GetById(ent.Id) != null) { _clientEntiy = medicineRep.GetById(ent.Id); _clientEntiy = medicineRep.CopyEntity(_serverEntity, _clientEntiy); medicineRep.Update(_clientEntiy); } } break; case "Clinic": break; } } } }
private void removeRoomFromMedicine(Medicine medicine, Room room) { if (isMedicineInRoom(medicine, room)) { foreach (ModelRoom modelRoom in medicine.room) { if (modelRoom.Data.Equals(room.typeOfRoom)) { medicine.room.Remove(modelRoom); medicineRepository.Update(medicine); } } } }
public void UpdateMedicine_WithValidMedicine_UpdateMedicineInList() { var medicineUpdated = new medicine() { id = 1, medicine_name = "thuoc test 123", entry_unit = "Hop", entry_price = 10000, expiry_day = DateTime.ParseExact("20-10-2020", "dd-MM-yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None), quantity_in_entry_unit = 100, unit_exchange_ratio = 100, quantity_in_sale_unit = 100 * 100, entry_day = DateTime.Now, sale_unit = "Vien", sale_price_per_unit = 1000, is_active = true }; _sut.Update(medicineUpdated); _sut.GetAll().Should().Contain(medicineUpdated); }
public void Update(Medicine entity) { Validate(entity); _medicineRepository.Update(entity); }
public void Update(Medicine medicine) { medicineRepository.Update(medicine); }
public int UpdateMed(Medicine med) { return(medRepo.Update(med)); }
public bool Update(MedicineModels AMM) { var update2 = _medicineRepository.Update(AMM); return(update2); }