Example #1
0
        public ActionResult AcceptAppointment(int?id, int?serviceId)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Record record = db.Records.Find(id);

            record.TypeOfServiceId = serviceId;
            TypeOfService   typeOfService = db.TypeOfServices.Where(u => u.Id == serviceId).FirstOrDefault();
            ApplicationUser Patient       = db.Users.Find(User.Identity.GetUserId());
            Payment         payment       = new Payment()
            {
                RecordId  = record.Id,
                PatientId = Patient.Id,
                amount    = typeOfService.Price,
                order_id  = Guid.NewGuid().ToString()
            };

            ViewBag.Patient = Patient;
            ViewBag.Payment = payment;
            ViewBag.Record  = record;
            db.Payments.Add(payment);
            db.SaveChanges();
            return(View("Payment", LiqPayHelper.GetLiqPayModel(payment, typeOfService, Patient)));
        }
        public TypeOfService Create(TypeOfService typeOfService)
        {
            ETypeOfService eTypeOfService = ETypeOfService(typeOfService);

            eTypeOfService = _iDTypeOfService.Create(eTypeOfService);
            return(TypeOfService(eTypeOfService));
        }
Example #3
0
 public Log(string first_name, string last_name, TypeOfService service_given, string appointment_details)
 {
     this.first_name          = first_name ?? throw new ArgumentNullException(nameof(first_name));
     this.last_name           = last_name ?? throw new ArgumentNullException(nameof(last_name));
     this.service_given       = service_given;
     this.time_of_appointment = DateTime.Now;
     this.appointment_details = appointment_details ?? throw new ArgumentNullException(nameof(appointment_details));
 }
Example #4
0
        public ActionResult DeleteConfirmed(string id)
        {
            TypeOfService typeOfService = GM.FindBy(x => x.typeOfService == id).FirstOrDefault();

            GM.Delete(typeOfService);
            GM.Save();
            return(RedirectToAction("Index"));
        }
Example #5
0
 public ActionResult Edit([Bind(Include = "typeOfService")] TypeOfService itemtypeOfService)
 {
     if (ModelState.IsValid)
     {
         GM.Add(itemtypeOfService);
         GM.Save();
         return(RedirectToAction("Index"));
     }
     return(View(itemtypeOfService));
 }
        private TypeOfService TypeOfService(ETypeOfService eTypeOfService)
        {
            TypeOfService returnTypeOfService = new TypeOfService
            {
                TypeOfServiceId = eTypeOfService.TypeOfServiceId,
                Description     = eTypeOfService.Description,
                Name            = eTypeOfService.Name
            };

            return(returnTypeOfService);
        }
Example #7
0
        public async Task DeleteTypeOfService(Guid id)
        {
            using (MUEContext db = new MUEContext())
            {
                TypeOfService typeOfService = await GetTypeOfServiceEntity(id);

                db.Entry(typeOfService).State = EntityState.Deleted;
                db.TypeOfServices.Remove(typeOfService);
                await db.SaveChangesAsync();
            }
        }
        private ETypeOfService ETypeOfService(TypeOfService typeOfService)
        {
            ETypeOfService returnETypeOfService = new ETypeOfService
            {
                TypeOfServiceId = typeOfService.TypeOfServiceId,
                Description     = typeOfService.Description,
                Name            = typeOfService.Name
            };

            return(returnETypeOfService);
        }
        private ETypeOfService ETypeOfService(TypeOfService typeOfService)
        {
            ETypeOfService returnETypeOfService = new ETypeOfService
            {
                TypeOfServiceId    = typeOfService.TypeOfServiceId,
                NameOfService      = typeOfService.NameOfService,
                Rate               = typeOfService.Rate,
                ServiceDescription = typeOfService.ServiceDescription,
                WhTax              = typeOfService.WhTax,
            };

            return(returnETypeOfService);
        }
        private TypeOfService TypeOfService(ETypeOfService eTypeOfService)
        {
            TypeOfService returnTypeOfService = new TypeOfService
            {
                TypeOfServiceId    = eTypeOfService.TypeOfServiceId,
                NameOfService      = eTypeOfService.NameOfService,
                Rate               = eTypeOfService.Rate,
                ServiceDescription = eTypeOfService.ServiceDescription,
                WhTax              = eTypeOfService.WhTax,
            };

            return(returnTypeOfService);
        }
Example #11
0
        // GET: TypeOfService/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TypeOfService typeOfService = GM.FindBy(x => x.typeOfService == id).FirstOrDefault();

            if (typeOfService == null)
            {
                return(HttpNotFound());
            }
            return(View(typeOfService));
        }
Example #12
0
        public async Task <ActionResult> AppointmentResultTest(int?id, int?serviceId)
        {
            ApplicationUser user = db.Users.Find(User.Identity.GetUserId());

            if (id != null && user != null)
            {
                Record        record        = db.Records.Find(id);
                TypeOfService typeOfService = db.TypeOfServices.Find(serviceId);
                record.TypeOfServiceId = serviceId;
                record.PatientId       = user.Id;
                db.SaveChanges();
                // настройка логина, пароля отправителя
                var from = "*****@*****.**";
                var pass = "******";

                // создаем письмо: message.Destination - адрес получателя
                var emailMessage = new MimeMessage()
                {
                    Subject = "eLife підтвердження запису",
                    Body    = new TextPart(MimeKit.Text.TextFormat.Html)
                    {
                        Text = "<h2> " + record.Patient.Name + " , ви успішно записались на прийом" + " </h2> <br>"
                               + "<h3> Лікар:" + record.AttendingDoctor.Name + " </h3><br>" +
                               "< h3 > Клініка:" + record.AttendingDoctor.DoctorInform.Clinic.Name + " </ h3 >< br > " +
                               "< h3 > Дата та час:" + record.Date + " </ h3 >< br > " +
                               "< h3 > Вид прийому:" + record.TypeOfService.Name + " </ h3 >< br > "
                    }
                };
                emailMessage.From.Add(new MailboxAddress("Администрация сайта", from));
                emailMessage.To.Add(new MailboxAddress("", record.Patient.Email));

                // адрес и порт smtp-сервера, с которого мы и будем отправлять письмо
                using (var client = new SmtpClient())
                {
                    await client.ConnectAsync("smtp.gmail.com", 465);

                    await client.AuthenticateAsync(from, pass);

                    await client.SendAsync(emailMessage);

                    await client.DisconnectAsync(true);
                }
                ViewBag.Type = record.TypeOfService.Name;
                return(View("AppointmentResult", record));
            }
            return(View("~/Views/Shared/_Error.cshtml"));
        }
Example #13
0
        public bool WriteEntry()
        {
            Console.WriteLine("Patients First Name: ");
            string fName = Console.ReadLine();

            if (!Log.CheckName(fName))
            {
                return(false);
            }

            Console.WriteLine("Patients Last Name: ");
            string lName = Console.ReadLine();

            if (!Log.CheckName(lName))
            {
                return(false);
            }

            Console.WriteLine("Procedure Performed: ");
            string procedure = Console.ReadLine();

            if (procedure.Equals(""))
            {
                return(false);
            }
            TypeOfService service = Log.ParseService(procedure);

            Console.WriteLine("Appointment details (Type 'END' on its own line and hit enter when finished): ");
            string        line          = "";
            StringBuilder stringBuilder = new StringBuilder();

            while (true)
            {
                line = Console.ReadLine();
                if (line.Equals("END"))
                {
                    break;
                }
                stringBuilder.Append(line);
            }

            logs.Add(new Log(fName, lName, service, stringBuilder.ToString()));
            this.Save();
            Console.WriteLine("Entry saved successfully!");
            return(true);
        }
        private void SetDueDate()
        {
            switch (TypeOfService.ToLower())
            {
            case "oil service":
                DueDate = BookedDate.AddDays(2);
                break;

            case "water service":
                DueDate = BookedDate.AddDays(1);
                break;

            default:
                DueDate = BookedDate.AddDays(3);
                break;
            }
        }
Example #15
0
        public async Task CreateTypeOfService(TypeOfServiceDTO dto)
        {
            Guid id = Guid.NewGuid();

            using (MUEContext db = new MUEContext())
            {
                TypeOfService typeOfService = new TypeOfService
                {
                    Name             = dto.Name,
                    Description      = dto.Description,
                    IsMeter          = dto.IsMeter,
                    UnitOfMeasurment = dto.UnitOfMeasurment,
                    TypeOfServiceId  = id
                };
                db.TypeOfServices.Add(typeOfService);
                await db.SaveChangesAsync();
            }
        }
        public void AddRevenue_Test()
        {
            TypeOfService tos = new TypeOfService()
            {
                Id   = 1,
                Name = "TestServ",
            };

            var mockContext = new Mock <IDbContext>();
            var mockSet     = new Mock <IDbSet <TypeOfService> >();

            mockContext.Setup(m => m.Set <TypeOfService>()).Returns(mockSet.Object);

            TypeOfServiceAddViewModel cavm = new TypeOfServiceAddViewModel(mockContext.Object);

            cavm.Operation(tos);

            mockSet.Verify(m => m.Add(It.IsAny <TypeOfService>()), Times.Once());
            mockContext.Verify(m => m.SaveChanges(), Times.Once());
        }
Example #17
0
 public void AddTypeservice(object obj)
 {
     if (TypeOfService != string.Empty)
     {
         using (var db = new MeiMeiContext())
         {
             var typeService = new TypeOfService
             {
                 TypeService = TypeOfService
             };
             db.TypeOfServices.Add(typeService);
             db.SaveChanges();
         }
         OnPropertyChanged("TypeServiceCollection");
     }
     else
     {
         MessageBox.Show(Properties.Resources.FirstFill_message, "", MessageBoxButton.OK,
                         MessageBoxImage.Information);
     }
 }
Example #18
0
 public ActionResult Create(TypeOfService typeOfService)
 {
     typeOfService = _iFTypeOfService.Create(typeOfService);
     return(RedirectToAction("Index"));
     //, new { id = typeOfService.ClientId }
 }
Example #19
0
 public JsonResult Delete(TypeOfService typeOfService)
 {
     _iFTypeOfService.Delete(typeOfService);
     return(Json(string.Empty));
 }
 public void Delete(TypeOfService typeOfService)
 {
     _iDTypeOfService.Delete(ETypeOfService(typeOfService));
 }
        public TypeOfService Update(TypeOfService typeOfService)
        {
            var eTypeOfService = _iDTypeOfService.Update(ETypeOfService(typeOfService));

            return(TypeOfService(eTypeOfService));
        }
Example #22
0
 public ActionResult Update(TypeOfService typeOfService)
 {
     typeOfService = _iFTypeOfService.Update(typeOfService);
     return(RedirectToAction("Index"));
 }
Example #23
0
        protected override void Seed(DataContext context)
        {
            //------------роли----------------
            Role r1 = new Role {
                Name = "Пользователь"
            };

            context.Roles.Add(r1);
            Role r2 = new Role {
                Name = "Доктор"
            };

            context.Roles.Add(r2);

            //---------------пользователи--------
            User u1 = new User
            {
                FirstName   = "Иван",
                MiddleName  = "Юрьевич",
                LastName    = "Михайлушкин",
                Email       = "*****@*****.**",
                Login       = "******",
                PhoneNumber = "89008008080",
                Password    = "******",
                Role        = r1
            };

            context.Users.Add(u1);
            User u2 = new User
            {
                FirstName   = "Кирилл",
                MiddleName  = "Геннадьевич",
                LastName    = "Виноградов",
                Email       = "*****@*****.**",
                Login       = "******",
                PhoneNumber = "88005553535",
                Password    = "******",
                Role        = r1
            };

            context.Users.Add(u2);
            User u3 = new User
            {
                FirstName   = "Олег",
                MiddleName  = "Петрович",
                LastName    = "Шумилин",
                Email       = "*****@*****.**",
                Login       = "******",
                PhoneNumber = "89008008888",
                Password    = "******",
                Role        = r2
            };

            context.Users.Add(u3);

            //-------------виды животных--------
            Kind k1 = new Kind {
                Name = "Птица"
            };

            context.Kinds.Add(k1);
            Kind k2 = new Kind {
                Name = "Собака"
            };

            context.Kinds.Add(k2);
            Kind k3 = new Kind {
                Name = "Кот"
            };

            context.Kinds.Add(k3);

            //-------------породы животных------------
            Breed b1 = new Breed {
                Name = "Петух"
            };

            context.Breeds.Add(b1);
            Breed b2 = new Breed {
                Name = "Бигль"
            };

            context.Breeds.Add(b2);
            Breed b3 = new Breed {
                Name = "Сфинкс"
            };

            //-------------окрас животных-----------
            Color c1 = new Color {
                Name = "Черный"
            };

            context.Colors.Add(c1);
            Color c2 = new Color {
                Name = "Бело-рыже-черный"
            };

            context.Colors.Add(c2);
            Color c3 = new Color {
                Name = "Серый"
            };

            context.Colors.Add(c3);

            //--------------интервалы времени----------
            Time t1 = new Time {
                Interval = "8:00 - 9:00"
            };

            context.Times.Add(t1);
            Time t2 = new Time {
                Interval = "9:00 - 10:00"
            };

            context.Times.Add(t2);
            Time t3 = new Time {
                Interval = "10:00 - 11:00"
            };

            context.Times.Add(t3);
            Time t4 = new Time {
                Interval = "11:00 - 12:00"
            };

            context.Times.Add(t4);
            Time t5 = new Time {
                Interval = "12:00 - 13:00"
            };

            context.Times.Add(t5);
            Time t6 = new Time {
                Interval = "13:00 - 14:00"
            };

            context.Times.Add(t6);
            Time t7 = new Time {
                Interval = "14:00 - 15:00"
            };

            context.Times.Add(t7);
            Time t8 = new Time {
                Interval = "15:00 - 16:00"
            };

            context.Times.Add(t8);
            Time t9 = new Time {
                Interval = "16:00 - 17:00"
            };

            context.Times.Add(t9);
            Time t10 = new Time {
                Interval = "17:00 - 18:00"
            };

            context.Times.Add(t10);

            //--------------типы услуг-----------------------
            TypeOfService ts1 = new TypeOfService {
                Name = "Клинический осмотр"
            };

            context.TypesOfServices.Add(ts1);
            TypeOfService ts2 = new TypeOfService {
                Name = "Вакцинация"
            };

            context.TypesOfServices.Add(ts2);
            TypeOfService ts3 = new TypeOfService {
                Name = "Блокада"
            };

            context.TypesOfServices.Add(ts3);
            TypeOfService ts4 = new TypeOfService {
                Name = "Купирование"
            };

            context.TypesOfServices.Add(ts4);
            TypeOfService ts5 = new TypeOfService {
                Name = "Обрезка"
            };

            context.TypesOfServices.Add(ts5);

            //---------------------услуги-----------------------------
            Service ser1 = new Service {
                Name = "Обрезка рогов", TypeOfService = ts5, Price = 500
            };

            context.Services.Add(ser1);
            Service ser2 = new Service {
                Name = "Обрезка когтей", TypeOfService = ts5, Price = 500
            };

            context.Services.Add(ser2);
            Service ser3 = new Service {
                Name = "Обрезка клюва", TypeOfService = ts5, Price = 500
            };

            context.Services.Add(ser3);
            Service ser4 = new Service {
                Name = "Вакцинация от бешенства", TypeOfService = ts2, Price = 300
            };

            context.Services.Add(ser4);
            Service ser5 = new Service {
                Name = "Вакцинация от чумы", TypeOfService = ts2, Price = 400
            };

            context.Services.Add(ser5);
            Service ser6 = new Service {
                Name = "Простой осмотр", TypeOfService = ts1, Price = 150
            };

            context.Services.Add(ser6);
            Service ser7 = new Service {
                Name = "Углубленный осмотр", TypeOfService = ts1, Price = 220
            };

            context.Services.Add(ser7);
            Service ser8 = new Service {
                Name = "Стандартная блокада пятки", TypeOfService = ts3, Price = 350
            };

            context.Services.Add(ser8);
            Service ser9 = new Service {
                Name = "Купирование ушей", TypeOfService = ts4, Price = 650
            };

            context.Services.Add(ser9);


            //-----------------животные------------------
            Pet p1 = new Pet {
                Name = "Шарик", Birthday = new DateTime(2015, 01, 30), User = u1, Kind = k3, Breed = b3, Color = c3
            };

            context.Pets.Add(p1);
            Pet p2 = new Pet {
                Name = "Бобик", Birthday = new DateTime(2016, 11, 10), User = u2, Kind = k1, Breed = b1, Color = c1
            };

            context.Pets.Add(p2);
            Pet p3 = new Pet {
                Name = "Василий", Birthday = new DateTime(2014, 05, 04), User = u2, Kind = k2, Breed = b2, Color = c2
            };

            context.Pets.Add(p3);

            //---------------карточки животных-------------------------
            Card card1 = new Card {
                Pet = p1, Height = 20, Weight = 10
            };

            context.Cards.Add(card1);
            Card card2 = new Card {
                Pet = p2, Height = 25, Weight = 15
            };

            context.Cards.Add(card2);

            //---------------------заявки-------------------
            Application app1 = new Application
            {
                Date    = new DateTime(2017, 03, 16),
                User    = u1,
                Pet     = p1,
                Time    = t6,
                Service = ser5
            };

            context.Applications.Add(app1);
            Application app2 = new Application
            {
                Date    = new DateTime(2017, 03, 18),
                User    = u2,
                Pet     = p2,
                Time    = t5,
                Service = ser1
            };

            context.Applications.Add(app2);

            //------------записи-----------------
            Record rec1 = new Record
            {
                Date    = new DateTime(2017, 03, 16),
                User    = u3,
                Time    = t6,
                Service = ser5,
                Card    = card1
            };

            context.Records.Add(rec1);

            base.Seed(context);
        }