Exemplo n.º 1
0
        public void GetAll()
        {
            var itemrepo = new MedicineRepository(itemcontextmock.Object);
            var itemlist = itemrepo.GetName("Keto");

            Assert.NotNull(itemlist);
        }
Exemplo n.º 2
0
 public frmExportDetail(int exportId)
 {
     repClinic      = new ClinicRepository();
     repDefine      = new DefineRepository();
     repMedicine    = new MedicineRepository();
     repwh          = new WareHouseRepository();
     repwhDetail    = new WareHouseDetailRepository();
     _repwhIo       = new WareHouseIORepository();
     _repwhIoDetail = new WareHouseIODetailRepository();
     whExport       = new WareHouseExportAllocateRepository();
     InitializeComponent();
     repClinic           = new ClinicRepository();
     cbClinic.DataSource = repClinic.GetAll();
     dateImport.Value    = DateTime.Now.Date;
     whPaperId           = exportId;
     try
     {
         InitGrid();
         LoadData(exportId);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Exemplo n.º 3
0
        public void Test1()
        {
            var medicineService = new MedicineRepository(medicinecontextmock.Object);
            var medicinelist    = medicineService.GetMedicine(655);

            Assert.AreEqual(1, medicinelist.Count());
        }
        public void AddMedicine()
        {
            Console.WriteLine("Podaj nazwę leku: ");
            string name = Console.ReadLine();

            Console.WriteLine("Podaj producenta leku:");
            string manufacturer = Console.ReadLine();

            Console.WriteLine("Podaj cenę leku:");
            decimal price = Decimal.Parse(Console.ReadLine());

            Console.WriteLine("Podaj ilość leku:");
            int amount = Int32.Parse(Console.ReadLine());                                          // todo: catch

            Console.WriteLine("Podaj czy lek jest na receptę. Wciśnij klawisz: [t]-tak [n]-nie:"); // todo: catch
            bool withPrescription = false;
            char key = char.Parse(Console.ReadLine());

            if (key == 't')
            {
                withPrescription = true;
            }
            Medicine newMedicine        = new Medicine(name, manufacturer, price, withPrescription);
            var      medicineRepository = new MedicineRepository();

            medicineRepository.AddToDB(newMedicine);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            MedicineRepository medicineRepository = new MedicineRepository();
            Menu   menu    = new Menu();
            string command = "";

            do
            {
                menu.ShowMainMenu();
                command = Console.ReadLine();

                switch (command)
                {
                case "4":
                    var list = medicineRepository.GetMedicines();
                    foreach (var row in list)
                    {
                        Console.WriteLine(row.Name);
                    }
                    Console.ReadKey();
                    break;
                }
            }while
            (command != "0");
        }
Exemplo n.º 6
0
        public void Test2()
        {
            var medicineService = new MedicineRepository(medicinecontextmock.Object);
            var x = medicineService.DeleteMedicine(653);

            Assert.IsNotNull(x);
        }
Exemplo n.º 7
0
        public void MapToEntity(Operation operation, OperationEntity operationEntity)
        {
            if (operation != null && operationEntity != null)
            {
                operationEntity.Id          = operation.Id;
                operationEntity.TreatmentId = operation.TreatmentId;

                if (operation.CurrentTypeOperation != null)
                {
                    var typeOperationEntity = new TypeOperationEntity();
                    typeOperationMapper.MapToEntity(operation.CurrentTypeOperation, typeOperationEntity);
                    operationEntity.TypeOperationId = typeOperationEntity.Id;
                }

                if (operation.Medicines.Any())
                {
                    var medcicineRepository = MedicineRepository.GetInstance();

                    foreach (var medicine in operation.Medicines)
                    {
                        var medicineEntity = medcicineRepository.GetItemById(medicine.Id);
                        operationEntity.Medicines.Add(medicineEntity);
                    }
                }
            }
        }
Exemplo n.º 8
0
        public frmImport()
        {
            repClinic      = new ClinicRepository();
            repDefine      = new DefineRepository();
            repMedicine    = new MedicineRepository();
            repwh          = new WareHouseRepository();
            repwhDetail    = new WareHouseDetailRepository();
            _repwhIo       = new WareHouseIORepository();
            _repwhIoDetail = new WareHouseIODetailRepository();

            InitializeComponent();
            repClinic = new ClinicRepository();
            FillToComboboxClinic(0);
            dateImport.Value = DateTime.Now.Date;


            try
            {
                InitGrid();
                //bindingSource3.DataSource = repMedicine.GetAll();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 9
0
        public void MapToEntity(TreatmentReport treatmentReport, TreatmentReportEntity treatmentReportEntity)
        {
            if (treatmentReportEntity != null && treatmentReport != null)
            {
                treatmentReportEntity.Id         = treatmentReport.Id;
                treatmentReportEntity.Conclusion = treatmentReport.Conclusion;
                treatmentReportEntity.Comment    = treatmentReport.Comment;

                if (treatmentReport.CurrentTreatment != null)
                {
                    var treatmentEntity = new TreatmentEntity();
                    treatmentMapper.MapToEntity(treatmentReport.CurrentTreatment, treatmentEntity);
                    treatmentReportEntity.TreatmentId = treatmentEntity.Id;
                }

                if (treatmentReport.Medicines != null && treatmentReport.Medicines.Any())
                {
                    var medicineRepository = MedicineRepository.GetInstance();

                    foreach (var medicine in treatmentReport.Medicines)
                    {
                        var medicineEntity = medicineRepository.GetItemById(medicine.Id);
                        treatmentReportEntity.Medicines.Add(medicineEntity);
                    }
                }
            }
        }
Exemplo n.º 10
0
 private void attachProperties(int medicineId)
 {
     m                   = MedicineRepository.getMedicineById(medicineId);
     NameBox.Text        = m.Name;
     DescriptionBox.Text = m.Description;
     PriceBox.Text       = m.Price.ToString();
     StockBox.Text       = m.Stock.ToString();
 }
Exemplo n.º 11
0
        public HttpResponseMessage SaveMedicines(Medicines medicineToAdd)
        {
            MedicineRepository medicineRepository = new MedicineRepository();

            bool sucess = medicineRepository.updateDeleteMedicine(medicineToAdd);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, "OK");

            return(response);
        }
 public MedicineStoreUnitOfWork(string connectionString, string migrationAssemblyName)
     : base(connectionString, migrationAssemblyName)
 {
     MedicineRepository         = new MedicineRepository(_dbContext);
     CategoryRepository         = new CategoryRepository(_dbContext);
     MedicineCategoryRepository = new MedicineCategoryRepository(_dbContext);
     StockRepository            = new StockRepository(_dbContext);
     OrderRepository            = new OrderRepository(_dbContext);
 }
Exemplo n.º 13
0
 public AptekaNetUnitOfWork()
 {
     Context = new AptekaNETDbContext();
     OrderRepository = new OrderRepository(Context);
     EmployeeRepository = new EmployeeRepository(Context);
     CustomerRepository = new CustomerRepository(Context);
     MedicineRepository = new MedicineRepository(Context);
     ProductRepository = new ProductRepository(Context);
     PharmacyRepository = new PharmacyRepository(Context);
 }
Exemplo n.º 14
0
 public IHttpActionResult GetMedicineByName(string medicineName_)
 {
     try
     {
         var medicines = MedicineRepository.GetMedicineByName(medicineName_);
         return(Ok(medicines));
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Exemplo n.º 15
0
 public IHttpActionResult GetAllMedicine()
 {
     try
     {
         var medicines = MedicineRepository.GetAllMedicines();
         return(Ok(medicines));
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Exemplo n.º 16
0
        private void btadd_Click(object sender, EventArgs e)
        {
            Medicine medicine = new Medicine();

            medicine.Name = txtMName.Text;
            medicine.ConcentrationOfTheDrug = Convert.ToInt32(txtMConceration.Text);
            medicine.FinishDate             = txtMEnd.Text;
            medicine.Quantity    = Convert.ToInt32(txtMQuantity.Text);
            medicine.TimesPerDay = Convert.ToInt32(txtMTimesPerDay.Text);
            MedicineRepository medicineRepository = new MedicineRepository();

            medicineRepository.Add(medicine);
            medicineRepository.save();
            FillDataGridView();
        }
Exemplo n.º 17
0
 public UnitOfWork(PatientManagementDbContext context)
 {
     _context            = context;
     Accounts            = new AccountRepository(_context);
     Categories          = new CategoryRepository(_context);
     DetailPrescriptions = new DetailPrescriptionRepository(_context);
     Items             = new ItemRepository(_context);
     DetailRecords     = new DetailRecordRepository(_context);
     Medicines         = new MedicineRepository(_context);
     Patients          = new PatientRepository(_context);
     MedicalSupplies   = new MedicalSupplyRepository(_context);
     Prescriptions     = new PrescriptionRepository(_context);
     Records           = new RecordRepository(_context);
     AttachmentAssigns = new AttachmentAssignRepository(_context);
     Attachments       = new AttachmentRepository(_context);
     Doctors           = new DoctorRepository(_context);
     Faculties         = new FacultyRepository(_context);
 }
Exemplo n.º 18
0
        public MedicineRepositoryTest()
        {
            string[] dateTimeFormats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d-M-yyyy", "dd-M-yyyy"
                                         ,           "d-MM-yyyy", "dd-MM-yyyy" };
            _stubMedicineList = new List <medicine> {
                new medicine {
                    id                     = 1, medicine_name = "thuoc 1", entry_unit = "Hop",
                    entry_price            = 20000, expiry_day = DateTime.ParseExact("20-10-2020", dateTimeFormats, 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
                },
                new medicine {
                    id                     = 2, medicine_name = "thuoc 2", entry_unit = "Hop",
                    entry_price            = 50000, expiry_day = DateTime.ParseExact("20-10-2020", dateTimeFormats, CultureInfo.InvariantCulture, DateTimeStyles.None),
                    quantity_in_entry_unit = 200, unit_exchange_ratio = 100, quantity_in_sale_unit = 200 * 100,
                    entry_day              = DateTime.Now, sale_unit = "Vien", sale_price_per_unit = 500, is_active = true
                },
                new medicine {
                    id                     = 3, medicine_name = "thuoc 3", entry_unit = "Hop",
                    entry_price            = 50000, expiry_day = DateTime.ParseExact("20-11-2021", dateTimeFormats, CultureInfo.InvariantCulture, DateTimeStyles.None),
                    quantity_in_entry_unit = 100, unit_exchange_ratio = 50, quantity_in_sale_unit = 50 * 100,
                    entry_day              = DateTime.Now, sale_unit = "Vien", sale_price_per_unit = 500, is_active = true
                }
            };

            var stubDbSet = new Mock <DbSet <medicine> >();

            stubDbSet.As <IQueryable <medicine> >().Setup(m => m.Provider).Returns(_stubMedicineList.AsQueryable().Provider);
            stubDbSet.As <IQueryable <medicine> >().Setup(m => m.Expression).Returns(_stubMedicineList.AsQueryable().Expression);
            stubDbSet.As <IQueryable <medicine> >().Setup(m => m.ElementType).Returns(_stubMedicineList.AsQueryable().ElementType);
            stubDbSet.As <IQueryable <medicine> >().Setup(m => m.GetEnumerator())
            .Returns(() => _stubMedicineList.AsQueryable().GetEnumerator());

            stubDbSet.Setup(m => m.Find(It.IsAny <object[]>()))
            .Returns <object[]>(ids => _stubMedicineList.FirstOrDefault(d => d.id == (int)ids[0]));

            _stubContext = new Mock <clinicEntities>();
            _stubContext.Setup(c => c.medicines).Returns(stubDbSet.Object);
            _stubContext.Setup(c => c.Set <medicine>()).Returns(stubDbSet.Object);
            _sut = new MedicineRepository(_stubContext.Object);
        }
Exemplo n.º 19
0
        private void btadd_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtMedcineName.Text) || txtMedcineName.Text.Length < 3)
            {
                return;
            }

            Medicine medicine = new Medicine();

            medicine.Name = txtMedcineName.Text;
            medicine.ConcentrationOfTheDrug = Convert.ToInt32(txtMedcineConceration.Text);
            medicine.Quantity    = 3;
            medicine.TimesPerDay = 4;
            MedicineRepository medicineRepository = new MedicineRepository();

            medicineRepository.Add(medicine);
            medicineRepository.save();
            FillDataGridView();
            txtMedcineName.Clear();
            txtMedcineConceration.Clear();
        }
Exemplo n.º 20
0
        public static void addMedicine(string name, string desc, int price, int stock)
        {
            Medicine m = MedicineRepository.createMedicine(name, desc, price, stock);

            MedicineRepository.addMedicine(m);
        }
Exemplo n.º 21
0
 public static Medicine getMedicineById(int id)
 {
     return(MedicineRepository.getMedicineById(id));
 }
Exemplo n.º 22
0
 public static List <Medicine> getAllMedicine()
 {
     return(MedicineRepository.getAllMedicines());
 }
Exemplo n.º 23
0
 public static void updateMedicine(int id, string name, string desc, int price, int stock)
 {
     MedicineRepository.updateMedicine(id, name, desc, price, stock);
 }
Exemplo n.º 24
0
 public static List <Medicine> getMedicineListByQuery(string query)
 {
     return(MedicineRepository.getMedicineListByQuery(query));
 }
Exemplo n.º 25
0
 public RoomService()
 {
     roomRepository      = new RoomRepository(path);
     medicineRepository  = new MedicineRepository(path2);
     equipmentRepository = new EquipmentRepository(path3);
 }
Exemplo n.º 26
0
 public frmMedicineSearch()
 {
     reposioryMedicine = new MedicineRepository();
     InitializeComponent();
 }
Exemplo n.º 27
0
 public MedicineService()
 {
     this.MedicineRepository = new MedicineRepository();
 }
Exemplo n.º 28
0
 public static void deleteMedicine(int id)
 {
     MedicineRepository.deleteMedicine(id);
 }
Exemplo n.º 29
0
 public MedicineService(MedicineRepository medicineRepository)
 {
     _medicineRepository = medicineRepository;
 }
Exemplo n.º 30
0
 public static List <Medicine> getRandomMedicine()
 {
     return(MedicineRepository.getRandomMedicine());
 }
Exemplo n.º 31
0
 public MedicineReportGenerator(string path, MedicineRepository medicineRepository)
 {
     app   = App.Current as App;
     _path = path;
     _medicineRepository = medicineRepository;
 }