Ejemplo n.º 1
0
 private string[] GenerateGridRowFromMedicine(Medicine medicine)
 {
     string[] gridRow = new string[5];
     gridRow[0] = medicine.CommercialName;
     gridRow[1] = medicine.Form;
     gridRow[2] = medicine.Packaging;
     gridRow[3] = medicine.PaymentType;
     gridRow[4] = medicine.Id.ToString();
     return gridRow;
 }
Ejemplo n.º 2
0
        public bool IsMatch(Medicine medicine)
        {
            //Puste wyszukiwanie
            if (!ById.HasValue && string.IsNullOrEmpty(ByCommercialName))
                return true;

            if (ById.HasValue && medicine.Id == ById.Value ||
                !string.IsNullOrEmpty(ByCommercialName) && medicine.CommercialName.ToLower().Contains(ByCommercialName.ToLower()))
                return true;

            return false;
        }
Ejemplo n.º 3
0
        public MedicineDto ToDto(Medicine medicine)
        {
            return new MedicineDto()
            {
                MedicineId = medicine.Id,
                CommercialName = medicine.CommercialName,
                InternationalName = medicine.InternationalName,
                Packaging = medicine.Packaging,
                Form = medicine.Form,
                MedicineProducer = medicine.MedicineProducer,
                PaymentType = medicine.PaymentType,
                ActiveSubstance = medicine.ActiveSubstance,
                OnPrescription = medicine.OnPrescription,
                ATCTypeCode = medicine.ATCType.Code

            };
        }
Ejemplo n.º 4
0
        public void Context_CanInsertToDB()
        {
            var transaction = new TransactionScope(
            TransactionScopeOption.RequiresNew,
            new TransactionOptions() { IsolationLevel = IsolationLevel.Serializable });

            using (transaction)
            {
                Debug.WriteLine(Directory.GetCurrentDirectory());
                var entity = new Medicine();
                _aptekaNETDbContext.Medicines.Add(entity);

                _aptekaNETDbContext.SaveChanges();
                Assert.AreNotEqual(0, entity.Id);

                //TODO: Poprawic ten test
                //var id = entity.Id;
                //_aptekaNETDbContext.Medicines.Remove(entity);
                //_aptekaNETDbContext.SaveChanges();
                //Assert.IsNotNull(_aptekaNETDbContext.Medicines.Find(id));
            }
        }
Ejemplo n.º 5
0
 private DataGridViewRow Zarzadzanie_StanMagazynu_FindRowWithMedicine(Medicine medicine)
 {
     foreach (DataGridViewRow row in zarzadzanieStanMagazynuDataGridView.Rows)
     {
         var product = row.Tag as Product;
         if (product.Medicine == medicine)
             return row;
     }
     return null;
 }
Ejemplo n.º 6
0
        private void Zarzadzanie_StanMagazynu_AddNewProduct(Medicine medicine)
        {
            try
            {
                Product newProduct = null;
                AsyncTaskRunner task = new AsyncTaskRunner(
                    new Task(
                        () =>
                        {
                            var activePharmacy =
                                UnitOfWork.PharmacyRepository.GetPharmacyById(AptekaGlobals.ActivePharmacyId);

                            newProduct = new Product()
                                {
                                    Pharmacy = activePharmacy,
                                    Medicine = medicine,
                                    OnStock = 1,
                                    Price = 10.00
                                };
                            activePharmacy.Products.Add(newProduct);
                            UnitOfWork.SaveChanges();
                        }),
                        () =>
                        {
                            Zarzadzanie_StanMagazynu_AddRow(newProduct);
                        });
                task.StartInTransaction();
            }
            catch (Exception xcp)
            {
                MessageBox.Show(xcp.Message);
            }
        }
Ejemplo n.º 7
0
 private void Menu_WiecejInfo(Medicine medicine)
 {
     Menu_LeksykonLekowAction();
     leksykonTabControl.SelectedTab = leksykonNHTabPage;
     Leksykon_NHFindMatching(medicine.CommercialName);
     Leksykon_UpdateGrid(UnitOfWork.MedicineRepository.GetMedicinesByCommercialName(medicine.CommercialName));
 }