public void Remove(Medicine medicine) { List <Medicine> listOfMedicines = medicineRepository.GetAll(); foreach (Medicine medicineObject in listOfMedicines) { deleteIfMedicinesAreEqual(medicineObject, medicine); } removeMedicineFromAllRoom(medicine); }
public WareHouseExport() { InitializeComponent(); // init medicine list var medicineList = _repMedicine.GetAll(); medicineList.Insert(0, new Medicine() { Id = 0, Name = "" }); bdsMedicine.DataSource = medicineList; bdsUnit.DataSource = _repDefine.GetUnit(); var column = (DataGridViewTextBoxDropDownColumn)grd.Columns["LotNo"]; if (column != null) { column.ButtonCustomClick += ColumnButtonCustomClick; } //bdsMedicine.DataSource = repwh.GetByClinicId(AppContext.CurrentClinic.Id); //txtClinic.Text = AppContext.CurrentClinic.Name; //txtDate.Value = DateTime.Now; Initialize(); this.txtDate.ForeColor = Color.Black; }
public void removeRoomFromAllMedicines(Room room) { List <Medicine> listOfMedicines = new List <Medicine>(); listOfMedicines = medicineRepository.GetAll(); foreach (Medicine medicine in listOfMedicines) { removeRoomFromMedicine(medicine, room); } }
public FrmFigureEdit() { InitializeComponent(); if (IdFigureEdit <= 0) { CleanItems(); ReadOnlyItems(false); var medicines = _medicineRepo.GetAll(); medicines.Insert(0, new Medicine() { Id = 0, Name = "..." }); this.bdsMedicine.DataSource = medicines; this._figure = new Figure { Id = 0, Name = "", ClinicId = AppContext.CurrentClinic.Id, LastUpdatedDate = DateTime.Now.Date, Description = "", LastUpdatedUser = AppContext.LoggedInUser.Id, Version = 0 }; this._figureDetailList = new List <FigureDetail>(); this._figure.FigureDetail = this._figureDetailList; } else { _figure = figureRepository.GetById(IdFigureEdit); FillToItemByID(); ReadOnlyItems(false); } Initialize(_figure); }
private void FillToGrid() { List <Medicine> lstMedicines = medicineRepository.GetAll(); this.grd.DataSource = lstMedicines; this.grd.Refresh(); this.grd.Parent.Refresh(); if (grd.Rows.Count == 0) { } else { grd.Rows[0].Selected = true; lblID.Text = grd.Rows[0].Cells["idDataGridViewTextBoxColumn"].Value.ToString(); } }
private void LoadMedicine() { var list = medicineRepository.GetAll(); var listTmp = whRepository.GetByClinicId(ClinicID); if (MedicineID > 0) { foreach (var item in listTmp) { if (item.MedicineId != MedicineID) { var deleteItem = list.Find(c => c.Id == item.MedicineId); list.Remove(deleteItem); } } cboMedicine.DataSource = list; cboMedicine.DisplayMember = "Name"; cboMedicine.ValueMember = "Id"; cboMedicine.SelectedIndex = GetComboIndex(cboMedicine, MedicineID); cboMedicine.Enabled = false; txtMinAllowed.Text = MinAllowed.ToString(); } else { foreach (var item in listTmp) { var deleteItem = list.Find(c => c.Id == item.MedicineId); list.Remove(deleteItem); } cboMedicine.DataSource = list; cboMedicine.DisplayMember = "Name"; cboMedicine.ValueMember = "Id"; } }
private void InitGrid() { // add column thuoc var cbMed = new DataGridViewComboBoxColumn { DataSource = repMedicine.GetAll(), DisplayMember = "Name", ValueMember = "Id", DataPropertyName = "MedicineId", HeaderText = "Thuốc", Name = "MedicineId" }; grd.Columns.Add(cbMed); var txtLotno = new DataGridViewTextBoxColumn { HeaderText = "Số lô", DataPropertyName = "LotNo", Name = "LotNo" }; grd.Columns.Add(txtLotno); var txtSoLuong = new DataGridViewTextBoxColumn { HeaderText = "Số lượng", DataPropertyName = "Volumn", Name = "Volumn" }; grd.Columns.Add(txtSoLuong); var clmUnit = new DataGridViewTextBoxColumn { HeaderText = "UnitID", DataPropertyName = "Unit", Name = "Unit" }; clmUnit.Visible = false; grd.Columns.Add(clmUnit); var clmUnitName = new DataGridViewTextBoxColumn { HeaderText = "Đơn vị", DataPropertyName = "UnitName", Name = "UnitName" }; clmUnitName.ReadOnly = true; grd.Columns.Add(clmUnitName); var txtDonGia = new DataGridViewTextBoxColumn { HeaderText = "Đơn giá", DataPropertyName = "UnitPrice", Name = "UnitPrice" }; grd.Columns.Add(txtDonGia); var txtThanhTien = new DataGridViewTextBoxColumn { HeaderText = "Thành tiền", DataPropertyName = "Amount", Name = "Amount" }; txtThanhTien.ReadOnly = true; grd.Columns.Add(txtThanhTien); var dtExpireDate = new DataGridViewDateTimeInputColumn { HeaderText = "Ngày hết hạn", DataPropertyName = "ExpireDate", Name = "ExpireDate" }; grd.Columns.Add(dtExpireDate); var txtGhiChu = new DataGridViewTextBoxColumn { HeaderText = "Ghi chú", DataPropertyName = "Note", Name = "Note" }; txtGhiChu.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; grd.Columns.Add(txtGhiChu); }
public void FillDataGridView() { dgvMedicin.AutoGenerateColumns = false; dgvMedicin.DataSource = medicineRepository.GetAll(); }
private void InitGrid() { // add column thuoc var cbMed = new DataGridViewComboBoxColumn { DataSource = repMedicine.GetAll(), DisplayMember = "Name", ValueMember = "Id", DataPropertyName = "MedicineId", HeaderText = "Thuốc" }; grd.Columns.Add(cbMed); var txtLotno = new DataGridViewTextBoxColumn { HeaderText = "Số lô", DataPropertyName = "LotNo" }; grd.Columns.Add(txtLotno); var txtSoLuong = new DataGridViewTextBoxColumn { HeaderText = "Số lượng", DataPropertyName = "TotalVolumn" }; grd.Columns.Add(txtSoLuong); var txtSoLuongHong = new DataGridViewTextBoxColumn { HeaderText = "Số lượng hỏng", DataPropertyName = "BadVolumn" }; grd.Columns.Add(txtSoLuongHong); var txtSoLuongThuc = new DataGridViewTextBoxColumn { HeaderText = "Số lượng thực", DataPropertyName = "RealityVolumn" }; grd.Columns.Add(txtSoLuongThuc); var cbDonVi = new DataGridViewComboBoxColumn { //DataSource = repMedicine.GetAll(), DisplayMember = "Name", ValueMember = "Id", DataPropertyName = "Id", HeaderText = "Đơn vị" }; grd.Columns.Add(cbDonVi); var txtDonGia = new DataGridViewTextBoxColumn { HeaderText = "Đơn giá", DataPropertyName = "UnitPrice" }; grd.Columns.Add(txtDonGia); var txtThanhTien = new DataGridViewTextBoxColumn { HeaderText = "Đơn giá", DataPropertyName = "Amount" }; grd.Columns.Add(txtThanhTien); var txtGhiChu = new DataGridViewTextBoxColumn { HeaderText = "Ghi chú", DataPropertyName = "Note" }; grd.Columns.Add(txtGhiChu); }
public Report Generate(TimeInterval time) { DateTime CurrentTime = DateTime.Now; DirectorDTO Director = app.director; Document doc = new Document(iTextSharp.text.PageSize.A4, 10, 10, 40, 35); PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream("C:\\Users\\Lenovo_NB\\Desktop\\IzvestajLekovi.pdf", FileMode.Create)); List <Medicine> medicines = (List <Medicine>)_medicineRepository.GetAll(); doc.Open(); doc.Add(new iTextSharp.text.Paragraph($"Bolnica: {Director.Hospital}")); doc.Add(new iTextSharp.text.Paragraph($"Datum: {CurrentTime.Day}/{CurrentTime.Month}/{CurrentTime.Year} ")); iTextSharp.text.Paragraph paragraph = new iTextSharp.text.Paragraph("IZVESTAJ O RASPOLOZIVIM LEKOVIMA \n"); paragraph.Alignment = 1; doc.Add(paragraph); doc.Add(new iTextSharp.text.Paragraph($"Na zahtevu upravnika: {Director.FirstName} {Director.LastName} iz {Director.Address.City} " + $"formiran je sledeci izvestaj o raspolozivim lekovima za dan {CurrentTime.Day}.{CurrentTime.Month}.{CurrentTime.Year}. \n " + $"Lekovi koji su registrovani u bolnici {Director.Hospital} su sledeci: \n")); for (int i = 0; i < medicines.Count; i++) { doc.Add(new iTextSharp.text.Paragraph($"{medicines[i].Name}")); } doc.Add(new iTextSharp.text.Paragraph($"\n Detaljno: \n \n")); PdfPTable table = new PdfPTable(8); table.WidthPercentage = 100; table.AddCell(new Phrase("Red. br")); table.AddCell(new Phrase("Naziv")); table.AddCell(new Phrase("Opis")); table.AddCell(new Phrase("Tip")); table.AddCell(new Phrase("Namena")); table.AddCell(new Phrase("Nacin upotrebe")); table.AddCell(new Phrase("Kolicina")); table.AddCell(new Phrase("Stanje")); for (int i = 0; i < medicines.Count; i++) { table.AddCell(new Phrase($"{i + 1}.")); table.AddCell(new Phrase($"{medicines[i].Name}")); table.AddCell(new Phrase($"{medicines[i].Description}")); table.AddCell(new Phrase($"{medicines[i].Type}")); table.AddCell(new Phrase($"{medicines[i].Purpose}")); table.AddCell(new Phrase($"{medicines[i].Administration}")); table.AddCell(new Phrase($"{medicines[i].Quantity}")); if (medicines[i].Approved) { table.AddCell(new Phrase($"Odobren")); } else { table.AddCell(new Phrase($"Nije odobren")); } } doc.Add(table); doc.Close(); return(new Report(_path, CurrentTime, "Upravnik-Zauzetost lekara")); }
public List <Medicine> GetMeds() { return(medRepo.GetAll()); }
public void GetMedicinesFromDatabase_WhenCalled_ReturnsMedicineList() { var actual = _sut.GetAll(); CollectionAssert.AreEqual(_stubMedicineList.ToList(), actual); }