Exemplo n.º 1
0
        public void SetUp()
        {
            MapperDependencyResolver.Resolve();
            context = new DrugstoreDbContext(options);
            #region Data seed
            var stockMed = new MedicineOnStock
            {
                MedicineCategory = MedicineCategory.Special,
                PricePerOne      = 30,
                Quantity         = 50,
                Refundation      = 0.20,
                Name             = "Lek testowy"
            };
            var doctor = new Doctor
            {
                FirstName  = "Testowy",
                SecondName = "Lekarz"
            };
            var patient = new Patient
            {
                FirstName  = "Testowy",
                SecondName = "Pacjent"
            };

            context.Doctors.Add(doctor);

            context.Patients.Add(patient);

            context.Medicines.Add(stockMed);

            context.SaveChanges();
            #endregion
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            MapperDependencyResolver.Resolve();
            context = new DrugstoreDbContext(options);
            #region Data seed
            var stockMed = new MedicineOnStock
            {
                MedicineCategory = MedicineCategory.Special,
                PricePerOne      = 30,
                Quantity         = 50,
                Refundation      = 0.20,
                Name             = "Lek testowy"
            };
            var doctor = new Doctor
            {
                FirstName  = "Testowy",
                SecondName = "Lekarz"
            };
            var patient = new Patient
            {
                FirstName  = "Testowy",
                SecondName = "Pacjent"
            };
            var prescription = new MedicalPrescription
            {
                CreationTime      = DateTime.Now,
                Doctor            = doctor,
                Patient           = patient,
                VerificationState = VerificationState.NotVerified,
                Medicines         = new List <AssignedMedicine> {
                    new AssignedMedicine {
                        StockMedicine    = stockMed,
                        PricePerOne      = stockMed.PricePerOne * (1 - stockMed.Refundation),
                        AssignedQuantity = 10
                    }
                }
            };

            context.Doctors.Add(doctor);

            context.Patients.Add(patient);

            context.Medicines.Add(stockMed);

            context.MedicalPrescriptions.Add(prescription);
            context.SaveChanges();
            #endregion
        }
Exemplo n.º 3
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <DrugstoreDbContext>(options =>
                                                       options.UseSqlServer(Configuration["Data:ConnectionStrings:WarehouseConnection"]));
            services.AddIdentity <SystemUser, IdentityRole>()
            .AddEntityFrameworkStores <DrugstoreDbContext>()
            .AddDefaultTokenProviders();

            services.AddTransient <ICopy, FileCopy>();
            services.AddTransient <ISerializer <MemoryStream, XmlMedicineSupplyModel>, XmlMedicineSerializer>();

            UseCaseDependencyResolver.Resolve(services);
            MapperDependencyResolver.Resolve();

            services.ConfigureApplicationCookie(opt =>
            {
                opt.LoginPath        = "/Account/Login";
                opt.AccessDeniedPath = "/Account/AccessDenied";
            });
            services.AddMvc();
        }
Exemplo n.º 4
0
        public void SetUp()
        {
            MapperDependencyResolver.Resolve();
            context = new DrugstoreDbContext(options);
            var med1 = new Core.MedicineOnStock
            {
                MedicineCategory = Core.MedicineCategory.Normal,
                Name             = "F;irst Medicine",
                PricePerOne      = 25.66,
                Quantity         = 100,
                Refundation      = 0.2
            };
            var med2 = new Core.MedicineOnStock
            {
                MedicineCategory = Core.MedicineCategory.Normal,
                Name             = "Second Medicine",
                PricePerOne      = 6.66,
                Quantity         = 100,
                Refundation      = 0.1
            };
            var med3 = new Core.MedicineOnStock
            {
                MedicineCategory = Core.MedicineCategory.Normal,
                Name             = "Third Medicine",
                PricePerOne      = 22.66,
                Quantity         = 100,
                Refundation      = 0.25
            };

            context.Medicines
            .AddRange(new Core.MedicineOnStock [] { med1, med2, med3 });
            context.SaveChanges();

            var exMed1 = new Core.ExternalDrugstoreMedicine
            {
                StockMedicine = med1,
                Name          = med1.Name,
                PricePerOne   = med1.PricePerOne,
                Quantity      = initialQuantity,
            };
            var exMed2 = new Core.ExternalDrugstoreMedicine
            {
                StockMedicine = med2,
                Name          = med2.Name,
                PricePerOne   = med2.PricePerOne,
                Quantity      = initialQuantity,
            };
            var exMed3 = new Core.ExternalDrugstoreMedicine
            {
                StockMedicine = med3,
                Name          = med3.Name,
                PricePerOne   = med3.PricePerOne,
                Quantity      = initialQuantity,
            };

            context.ExternalDrugstoreMedicines
            .AddRange(new Core.ExternalDrugstoreMedicine [] { exMed1, exMed2, exMed3 });
            context.SaveChanges();

            var sold1 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med1,
                PricePerOne   = med1.PricePerOne,
                Date          = DateTime.Now,
                SoldQuantity  = 10
            };
            var sold2 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med2,
                PricePerOne   = med2.PricePerOne,
                Date          = DateTime.Now,
                SoldQuantity  = 10
            };
            var sold3 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med3,
                PricePerOne   = med3.PricePerOne,
                Date          = DateTime.Now,
                SoldQuantity  = 10
            };

            context.ExternalDrugstoreSoldMedicines
            .AddRange(new ExternalDrugstoreSoldMedicine [] { sold1, sold2, sold3 });
            context.SaveChanges();

            supply = new XmlMedicineSupplyModel
            {
                Medicines = new List <XmlMedicineModel>
                {
                    new XmlMedicineModel
                    {
                        StockId  = med1.ID,
                        Quantity = 10,
                    },
                    new XmlMedicineModel
                    {
                        StockId  = med2.ID,
                        Quantity = 10,
                    },
                    new XmlMedicineModel
                    {
                        StockId  = med3.ID,
                        Quantity = 20,
                    }
                }
            };
        }
Exemplo n.º 5
0
 public void SetUp()
 {
     MapperDependencyResolver.Resolve();
 }
Exemplo n.º 6
0
        public void SetUp()
        {
            //dateProvider.AddDays(-1);
            MapperDependencyResolver.Resolve();
            context = new DrugstoreDbContext(options);
            var med1 = new Core.MedicineOnStock
            {
                MedicineCategory = Core.MedicineCategory.Normal,
                Name             = "First Medicine",
                PricePerOne      = 25.66,
                Quantity         = 100,
                Refundation      = 0.2
            };
            var med2 = new Core.MedicineOnStock
            {
                MedicineCategory = Core.MedicineCategory.Normal,
                Name             = "Second Medicine",
                PricePerOne      = 6.66,
                Quantity         = 100,
                Refundation      = 0.1
            };
            var med3 = new Core.MedicineOnStock
            {
                MedicineCategory = Core.MedicineCategory.Normal,
                Name             = "Third Medicine",
                PricePerOne      = 22.66,
                Quantity         = 100,
                Refundation      = 0.25
            };
            var med4 = new Core.MedicineOnStock
            {
                MedicineCategory = Core.MedicineCategory.Normal,
                Name             = "fourth Medicine",
                PricePerOne      = 25.66,
                Quantity         = 40,
                Refundation      = 0.2
            };
            var med5 = new Core.MedicineOnStock
            {
                MedicineCategory = Core.MedicineCategory.Normal,
                Name             = "fifth Medicine",
                PricePerOne      = 26.66,
                Quantity         = 10,
                Refundation      = 0.1
            };
            var med6 = new Core.MedicineOnStock
            {
                MedicineCategory = Core.MedicineCategory.Normal,
                Name             = "sixth Medicine",
                PricePerOne      = 24.66,
                Quantity         = 100,
                Refundation      = 0.25
            };

            context.Medicines
            .AddRange(new Core.MedicineOnStock [] { med1, med2, med3, med4, med5, med6 });
            context.SaveChanges();

            var exMed1 = new Core.ExternalDrugstoreMedicine
            {
                StockMedicine = med1,
                Name          = med1.Name,
                PricePerOne   = med1.PricePerOne,
                Quantity      = 50,
            };
            var exMed2 = new Core.ExternalDrugstoreMedicine
            {
                StockMedicine = med2,
                Name          = med2.Name,
                PricePerOne   = med2.PricePerOne,
                Quantity      = 50,
            };
            var exMed3 = new Core.ExternalDrugstoreMedicine
            {
                StockMedicine = med3,
                Name          = med3.Name,
                PricePerOne   = med3.PricePerOne,
                Quantity      = 50,
            };
            var exMed4 = new Core.ExternalDrugstoreMedicine
            {
                StockMedicine = med4,
                Name          = med4.Name,
                PricePerOne   = med4.PricePerOne,
                Quantity      = 50,
            };
            var exMed5 = new Core.ExternalDrugstoreMedicine
            {
                StockMedicine = med5,
                Name          = med5.Name,
                PricePerOne   = med5.PricePerOne,
                Quantity      = 50,
            };
            var exMed6 = new Core.ExternalDrugstoreMedicine
            {
                StockMedicine = med6,
                Name          = med6.Name,
                PricePerOne   = med6.PricePerOne,
                Quantity      = 50,
            };

            context.ExternalDrugstoreMedicines
            .AddRange(new Core.ExternalDrugstoreMedicine [] { exMed1, exMed2, exMed3, exMed4, exMed5, exMed6 });
            context.SaveChanges();
            //dodane dzisiaj
            var sold1 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med1,
                PricePerOne   = med1.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 5
            };
            var sold2 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med2,
                PricePerOne   = med2.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 20
            };
            var sold3 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med3,
                PricePerOne   = med3.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 1
            };

            dateProvider = DateTime.Today.AddDays(-1); //wczoraj
            var sold4 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med1,
                PricePerOne   = med1.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 2
            };
            var sold5 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med2,
                PricePerOne   = med2.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 24
            };
            var sold6 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med3,
                PricePerOne   = med3.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 36
            };

            dateProvider = DateTime.Today.AddDays(-2); // te nizej beda sprzed 2 dni
            var sold7 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med1,
                PricePerOne   = med1.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 3
            };
            var sold8 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med2,
                PricePerOne   = med2.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 11
            };
            var sold9 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med3,
                PricePerOne   = med3.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 12
            };

            dateProvider = DateTime.Today.AddDays(-7); // te nizej beda sprzed 7 dni, powinny byc
            var sold17 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med1,
                PricePerOne   = med1.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 30
            };
            var sold18 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med2,
                PricePerOne   = med2.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 5
            };
            var sold19 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med3,
                PricePerOne   = med3.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 47
            };

            dateProvider = DateTime.Today.AddDays(-8); //daaawno temu, nie powinno byc tego na liscie
            var sold10 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med1,
                PricePerOne   = med1.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 10
            };
            var sold11 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med2,
                PricePerOne   = med2.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 10
            };
            var sold12 = new ExternalDrugstoreSoldMedicine
            {
                StockMedicine = med3,
                PricePerOne   = med3.PricePerOne,
                Date          = dateProvider,
                SoldQuantity  = 10
            };

            context.ExternalDrugstoreSoldMedicines
            .AddRange(new ExternalDrugstoreSoldMedicine [] { sold1, sold2, sold3, sold4, sold5, sold6, sold7, sold8, sold9, sold10, sold11, sold12, sold17, sold18, sold19 });
            context.SaveChanges();
        }
Exemplo n.º 7
0
        public void SetUp()
        {
            MapperDependencyResolver.Resolve();
            context = new DrugstoreDbContext(options);
            #region Data seed
            var stockMedOne = new MedicineOnStock
            {
                MedicineCategory = MedicineCategory.Special,
                PricePerOne      = 30,
                Quantity         = 50,
                Refundation      = 0.20,
                Name             = "Lek testowy"
            };
            var stockMedTwo = new MedicineOnStock
            {
                MedicineCategory = MedicineCategory.Normal,
                PricePerOne      = 20,
                Quantity         = 100,
                Refundation      = 0.60,
                Name             = "Voltaren"
            };

            var doctor = new Doctor
            {
                FirstName  = "Testowy",
                SecondName = "Lekarz"
            };

            var patientOne = new Patient
            {
                FirstName  = "Pacjentka",
                SecondName = "One"
            };

            var patientTwo = new Patient
            {
                FirstName  = "Pacjent",
                SecondName = "Two"
            };
            var prescriptions = new MedicalPrescription []
            {
                new MedicalPrescription {
                    CreationTime      = DateTime.Parse("2019/01/20"),
                    Doctor            = doctor,
                    Patient           = patientOne,
                    VerificationState = VerificationState.NotVerified,
                    Medicines         = new List <AssignedMedicine> {
                        new AssignedMedicine {
                            StockMedicine    = stockMedOne,
                            PricePerOne      = stockMedOne.PricePerOne * (1 - stockMedOne.Refundation),
                            AssignedQuantity = 10
                        }
                    }
                },
                new MedicalPrescription
                {
                    CreationTime      = DateTime.Parse("2019/01/22"),
                    Doctor            = doctor,
                    Patient           = patientOne,
                    VerificationState = VerificationState.NotVerified,
                    Medicines         = new List <AssignedMedicine> {
                        new AssignedMedicine {
                            StockMedicine    = stockMedTwo,
                            PricePerOne      = stockMedTwo.PricePerOne * (1 - stockMedTwo.Refundation),
                            AssignedQuantity = 10
                        }
                    }
                },

                new MedicalPrescription
                {
                    CreationTime      = DateTime.Parse("2019/01/28"),
                    Doctor            = doctor,
                    Patient           = patientTwo,
                    VerificationState = VerificationState.Accepted,
                    Medicines         = new List <AssignedMedicine> {
                        new AssignedMedicine {
                            StockMedicine    = stockMedOne,
                            PricePerOne      = stockMedOne.PricePerOne * (1 - stockMedOne.Refundation),
                            AssignedQuantity = 10
                        }
                    }
                },
                new MedicalPrescription
                {
                    CreationTime      = DateTime.Parse("2019/01/30"),
                    Doctor            = doctor,
                    Patient           = patientTwo,
                    VerificationState = VerificationState.Accepted,
                    Medicines         = new List <AssignedMedicine> {
                        new AssignedMedicine {
                            StockMedicine    = stockMedTwo,
                            PricePerOne      = stockMedTwo.PricePerOne * (1 - stockMedTwo.Refundation),
                            AssignedQuantity = 10
                        }
                    }
                }
            };

            context.Doctors.Add(doctor);

            context.Patients.Add(patientTwo);

            context.Medicines.Add(stockMedOne);
            context.Medicines.Add(stockMedTwo);

            context.MedicalPrescriptions.AddRange(prescriptions);

            context.SaveChanges();
            #endregion
        }