Пример #1
0
        // GET: /Scheduler/id
        public ActionResult PartialScheduler(string Id)
        {
            string name = Id;

            if (name == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            AppointmentDBContext db       = new AppointmentDBContext();
            Resources            Resource = db.Resources.Find(name);

            ApplicationDbContext db2 = new ApplicationDbContext();
            ApplicationUser      usr = db2.Users
                                       .Where(y => y.UserName.Equals(name))
                                       .ToList()
                                       .FirstOrDefault();

            var RoleName = db2.UsersArch
                           .Where(y => y.UserName.Equals(name) && y.TypeOfChange.Equals("INSERTED"))
                           .Select(y => y.RId)
                           .FirstOrDefault();

            usr = db2.Users.Find(usr.Id);
            ViewBag.RoleName = RoleName.ToLower();

            if (Resource == null || usr == null)
            {
                return(HttpNotFound());
            }

            Session["ID"] = name;
            return(View(usr));
        }
Пример #2
0
        static async Task Main(string[] args)
        {
            string baseDir    = AppDomain.CurrentDomain.BaseDirectory;
            string configPath = AppDomain.CurrentDomain.BaseDirectory + "settings.json";

            if (args.Length > 0)
            {
                configPath = args[0];
            }


            Console.WriteLine("Using settings path: " + configPath);
            if (!File.Exists(configPath))
            {
                Console.WriteLine("Error: Config file cannot be found in the specified path.");
                Console.ReadLine();
                return;
            }

            //setup
            var config = JsonConvert.DeserializeObject <AppSettings>(File.ReadAllText(configPath));

            //check/create logs folder
            if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + Logs.LogFolderName))
            {
                Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + Logs.LogFolderName);
            }

            //services
#if DEBUG
            var logs = Console.Out; //TODO: move to file
#else
            var logs = File.CreateText(baseDir + Logs.LogFolderName + '/' + DateTime.Now.ToString(Logs.LogNameFormat) + Logs.LogFileExtension);
#endif
            var cap   = new AppointmentDBContext(config.CAPDBPath);
            var zoom  = new ZoomService(config.ZoomAPIKey, config.ZoomAPISecret);
            var cache = new MeetingCache(config.CacheFilePath);
            PhoneService.Init(config.TwilioAccountSID, config.TwilioAuthToken);

            //main functionality
            var sync = new MeetingSync(cap, zoom, cache, logs, config);


#if DEBUG
            //test date
            var syncDate = new DateTime(2021, 5, 31);

            //sync appointments
            await sync.SyncAppointments(syncDate, DateTime.MaxValue);
#else
            var syncDate = DateTime.Now.Subtract(DateTime.Now.TimeOfDay);

            //sync appointments
            await sync.SyncAppointments(syncDate, DateTime.MaxValue);
#endif
            //save cache
            cache.RemoveBefore(syncDate.AddDays(-7));
            cache.Dispose();
        }
Пример #3
0
 public MeetingSync(AppointmentDBContext CAP, ZoomService Zoom, MeetingCache Cache, TextWriter Logger, AppSettings config)
 {
     this.log        = Logger;
     this.db         = CAP;
     this.zoom       = Zoom;
     this.cache      = Cache;
     this.employees  = config.Employees;
     this.createdMsg = config.MeetingCreatedMsg;
     this.updatedMsg = config.MeetingUpdateMsg;
     this.deletedMsg = config.MeetingDeletedMsg;
     this.fromPhone  = config.TwilioFromPhone;
 }
Пример #4
0
        public JsonResult DeleteEvent(int id)
        {
            var status = false;

            using (AppointmentDBContext dc = new AppointmentDBContext())
            {
                Appointment deletedEvent = dc.Appointment.Where(x => x.AppointmentID == id).FirstOrDefault();
                if (deletedEvent != null)
                {
                    dc.Appointment.Remove(deletedEvent);
                    dc.SaveChanges();
                    status = true;
                }
            }
            return new JsonResult { Data = new { status = status } };
        }
Пример #5
0
        public ActionResult Edit(ApplicationUser user)
        {
            ApplicationDbContext context = new ApplicationDbContext();
            AppointmentDBContext Appdb   = new AppointmentDBContext();

            if (ModelState.IsValid)
            {
                double time = -1;
                context.Entry(user).State = EntityState.Modified;

                try
                {
                    context.SaveChanges();
                }
                catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
                {
                    Exception raise = dbEx;
                    foreach (var validationErrors in dbEx.EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            string message = string.Format("{0}:{1}",
                                                           validationErrors.Entry.Entity.ToString(),
                                                           validationError.ErrorMessage);
                            // raise a new exception nesting
                            // the current instance as InnerException
                            raise = new InvalidOperationException(message, raise);
                        }
                    }
                    throw raise;
                }

                // Dodanie do archiwum użytkownika, który zmienił dane pacjenta:
                string query = "UPDATE [dbo].[UsersArch] SET RId = (SELECT RId FROM [dbo].[UsersArch] WHERE TypeOfChange = 'INSERTED' AND UserName = "******"), DBUSer = '******' WHERE TypeOfChange = 'UPDATED-INSERTED' AND UserName = "******" AND DateOfChange >= '" + DateTime.Now.AddSeconds(time) + "'";;
                context.Database.ExecuteSqlCommand(query);

                query = "UPDATE [dbo].[UsersArch] SET RId = (SELECT RId FROM [dbo].[UsersArch] WHERE TypeOfChange = 'INSERTED' AND UserName = "******"), DBUSer = '******' WHERE TypeOfChange = 'UPDATED-DELETED' AND UserName = "******" AND DateOfChange >= '" + DateTime.Now.AddSeconds(time) + "'";
                context.Database.ExecuteSqlCommand(query);

                query = "UPDATE [dbo].[Resources] SET fsname = '" + user.Name + " " + user.Surname + "' WHERE name = '" + user.UserName + "'";
                Appdb.Database.ExecuteSqlCommand(query);

                return(RedirectToAction("WorkerSearch", "Search"));
            }

            return(View(user));
        }
Пример #6
0
        public ActionResult AppointmentSearch(string searching, string sortOrder)
        {
            ViewBag.DateSortParm       = String.IsNullOrEmpty(sortOrder) ? "date_desc" : "";
            ViewBag.NameSortParm       = sortOrder == "name" ? "name_desc" : "name";
            ViewBag.PriceSortParm      = sortOrder == "price" ? "price_desc" : "price";
            ViewBag.AddPriceSortParm   = sortOrder == "addPrice" ? "addPrice_desc" : "addPrice";
            ViewBag.TotalPriceSortParm = sortOrder == "totalPrice" ? "totalPrice_desc" : "totalPrice";

            AppointmentDBContext context = new AppointmentDBContext();
            DateTime             dateTime;

            DateTime.TryParse(searching, out dateTime);
            var appointmentsList = context.Appointments.Where(x => x.service_name.Contains(searching) ||
                                                              (x.appoint_date.Year == dateTime.Year && x.appoint_date.Month == dateTime.Month &&
                                                               x.appoint_date.Day == dateTime.Day) ||
                                                              (x.service_price.ToString() == searching) ||
                                                              (x.supplies_price.ToString() == searching) ||
                                                              ((x.supplies_price + x.service_price).ToString() == searching) ||
                                                              searching == null || searching == "\0");

            switch (sortOrder)
            {
            case "name": appointmentsList = appointmentsList.OrderBy(s => s.service_name); break;

            case "name_desc": appointmentsList = appointmentsList.OrderByDescending(s => s.service_name); break;

            case "price": appointmentsList = appointmentsList.OrderBy(s => s.service_price); break;

            case "price_desc": appointmentsList = appointmentsList.OrderByDescending(s => s.service_price); break;

            case "addPrice": appointmentsList = appointmentsList.OrderBy(s => s.supplies_price); break;

            case "addPrice_desc": appointmentsList = appointmentsList.OrderByDescending(s => s.supplies_price); break;

            case "date_desc": appointmentsList = appointmentsList.OrderByDescending(s => s.appoint_date); break;

            case "totalPrice": appointmentsList = appointmentsList.OrderBy(x => (x.supplies_price + x.service_price)); break;

            case "totalPrice_desc": appointmentsList = appointmentsList.OrderByDescending(x => (x.supplies_price + x.service_price)); break;

            default: appointmentsList = appointmentsList.OrderBy(s => s.appoint_date); break;
            }

            return(View(appointmentsList.ToList()));
        }
Пример #7
0
        public ActionResult DeleteConfirmed(string id)
        {
            ApplicationDbContext context = new ApplicationDbContext();
            AppointmentDBContext Appdb   = new AppointmentDBContext();
            ApplicationUser      user    = context.Users.Find(id);

            context.Users.Remove(user);
            context.SaveChanges();

            string query = "UPDATE [dbo].[UsersArch] SET RId = (SELECT RId FROM [dbo].[UsersArch] WHERE TypeOfChange = 'INSERTED' AND UserName = '******'), DBUSer = '******' WHERE TypeOfChange = 'DELETED' AND UserName = '******'";

            context.Database.ExecuteSqlCommand(query);

            query = "DELETE FROM [dbo].[WorkingTime] WHERE resource = (SELECT id FROM [dbo].[Resources] WHERE name = '" + user.UserName + "')";
            Appdb.Database.ExecuteSqlCommand(query);

            query = "DELETE FROM [dbo].[Resources] WHERE name = '" + user.UserName + "'";
            Appdb.Database.ExecuteSqlCommand(query);

            return(RedirectToAction("WorkerSearch", "Search"));
        }
Пример #8
0
        public ActionResult ListExpertInfos()
        {
            using (AppointmentDBContext ctx = new AppointmentDBContext())
            {
                var ExpertInfos = (from c in ctx.Expert
                                   join co in ctx.Contact on c.ExpertID equals co.ExpertID
                                   where c.ExpertID != 1 && co.IsActive == true && c.CompanyID==AccountController._compID

                                   select new ExpertInfosDTO
                                   {
                                       ID = c.ExpertID,
                                       Uzmanlik = c.Profession,
                                       AdSoyad = c.Name+" "+c.Surname ,
                                       //Soyad = c.Surname,
                                       Telno = co.PhoneNumber1,
                                       Not = c.Note
                                   }).OrderBy(x => x.AdSoyad).ToList();
                return View(ExpertInfos);
            }


        }
Пример #9
0
        public ActionResult Edit([Bind(Include = "ID, patients_pesel, estim_disease, real_disease, dis_descript, appoint_date, specialization, docs_pesel, service_type, service_name, service_price, is_paid, supplies_price")] Appointment appointment)
        {
            AppointmentDBContext context = new AppointmentDBContext();

            if (ModelState.IsValid)
            {
                double time = -1;

                context.Entry(appointment).State = EntityState.Modified;
                context.SaveChanges();

                string query = "UPDATE [dbo].[AppointmentsArch] SET DBUSer = '******' WHERE Idd = '" + appointment.ID + "' AND TypeOfChange = 'UPDATED-INSERTED' AND DateOfChange >= '" + DateTime.Now.AddSeconds(time) + "'";
                db.Database.ExecuteSqlCommand(query);

                query = "UPDATE [dbo].[AppointmentsArch] SET DBUSer = '******' WHERE Idd = '" + appointment.ID + "' AND TypeOfChange = 'UPDATED-DELETED' AND DateOfChange >= '" + DateTime.Now.AddSeconds(time) + "'";
                db.Database.ExecuteSqlCommand(query);

                return(RedirectToAction("Index"));
            }

            return(View(appointment));
        }
Пример #10
0
        public ActionResult ListClientInfos()
        {
            using (AppointmentDBContext ctx = new AppointmentDBContext())
            {
                var ClientInfos = (from c in ctx.Client
                                   join co in ctx.Contact on c.ClientID equals co.ClientID
                                   where c.ClientID != 8 && co.IsActive == true && c.CompanyID==AccountController._compID
                                   select new ClientInfosDTO
                                   {
                                       ID = c.ClientID,
                                       DanisanTuru = (DateTime.Now.Year - c.BirthDate.Year) > 18 ? "Yetişkin" : "Çocuk",
                                       TCKimlik = c.TcKimlik,
                                       AdSoyad = c.Name+" "+c.Surname,
                                       //Soyad = c.Surname,
                                       Telno = co.PhoneNumber1,
                                       Adres = co.Address,
                                       DevamDurumu = c.Continuity,
                                   }).OrderBy(x=>x.AdSoyad).ToList();
                return View(ClientInfos);
            }


        }
 public DoctorsController(AppointmentDBContext context)
 {
     this.context = context;
 }
 public AppointmentsController(AppointmentDBContext context, UserDBContext userContext)
 {
     _context     = context;
     _userContext = userContext;
 }
Пример #13
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.UserRoles != "Lekarz")
                {
                    model.Specialization = null;
                }

                var user = new ApplicationUser
                {
                    Name           = model.Name,
                    Surname        = model.Surname,
                    Seniority      = model.Seniority,
                    Experience     = model.Experience,
                    UserName       = model.UserName,
                    Email          = model.Email,
                    Specialization = model.Specialization
                };

                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    // Wyłączenie automatycznego logowania po rejestracji:
                    // await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);

                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    // Dodanie roli dla nowego użytkownika.
                    // Rola dodawania jest później, stąd dwa wpisy w archiwum przy tworzeniu nowego konta.
                    await this.UserManager.AddToRoleAsync(user.Id, model.UserRoles);

                    // Dodanie do archiwum ID osoby, która stworzyła nowe konto użytkownika, a także dodanie roli dodanego użytkownika:
                    string query = "UPDATE [dbo].[UsersArch] SET RId = '" + model.UserRoles + "', DBUSer = '******' WHERE TypeOfChange = 'INSERTED' AND UserName = "******"DELETE FROM [dbo].[UsersArch] WHERE TypeOfChange = 'UPDATED-DELETED' AND UserName = "******"DELETE FROM [dbo].[UsersArch] WHERE TypeOfChange = 'UPDATED-INSERTED' AND UserName = "******"INSERT INTO [dbo].[Resources] (name, fsname) VALUES ('" + model.UserName + "', '" + model.Name + " " + model.Surname + "')";
                    Appdb.Database.ExecuteSqlCommand(query);

                    return(RedirectToAction("ConfirmRegistration", "Account"));
                }

                AddErrors(result);
            }

            if (User.IsInRole("Administrator"))
            {
                ViewBag.UserRoles = new SelectList(context.Roles.Where(u => !u.Name.Contains("Administrator"))
                                                   .ToList(), "Name", "Name");
            }
            else if (User.IsInRole("Manager"))
            {
                ViewBag.UserRoles = new SelectList(context.Roles.Where(u => !u.Name.Contains("Administrator") && !u.Name.Contains("Manager"))
                                                   .ToList(), "Name", "Name");
            }

            List <SelectListItem> Specializations = new List <SelectListItem>()
            {
                new SelectListItem {
                    Text = "Alergologia"
                },
                new SelectListItem {
                    Text = "Alergologia"
                },
                new SelectListItem {
                    Text = "Anestezjologia i intensywna terapia"
                },
                new SelectListItem {
                    Text = "Angiologia"
                },
                new SelectListItem {
                    Text = "Audiologia i foniatria"
                },
                new SelectListItem {
                    Text = "Balneologia i medycyna fizykalna"
                },
                new SelectListItem {
                    Text = "Chirurgia dziecięca"
                },
                new SelectListItem {
                    Text = "Chirurgia klatki piersiowej"
                },
                new SelectListItem {
                    Text = "Chirurgia naczyniowa"
                },
                new SelectListItem {
                    Text = "Chirurgia ogólna"
                },
                new SelectListItem {
                    Text = "Chirurgia onkologiczna"
                },
                new SelectListItem {
                    Text = "Chirurgia plastyczna"
                },
                new SelectListItem {
                    Text = "Chirurgia stomatologiczna"
                },
                new SelectListItem {
                    Text = "Chirurgia szczękowo-twarzowa"
                },
                new SelectListItem {
                    Text = "Chirurgia płuc"
                },
                new SelectListItem {
                    Text = "Chirurgia płuc dzieci"
                },
                new SelectListItem {
                    Text = "Choroby płuc"
                },
                new SelectListItem {
                    Text = "Choroby płuc dzieci"
                },
                new SelectListItem {
                    Text = "Choroby wewnętrzne"
                },
                new SelectListItem {
                    Text = "Choroby zakaźne"
                },
                new SelectListItem {
                    Text = "Dermatologia i wenerologia"
                },
                new SelectListItem {
                    Text = "Diabetologia"
                },
                new SelectListItem {
                    Text = "Endokrynologia"
                },
                new SelectListItem {
                    Text = "Endokrynologia ginekologiczna i rozrodczość"
                },
                new SelectListItem {
                    Text = "Endokrynologia i diabetologia dziecięca"
                },
                new SelectListItem {
                    Text = "Epidemiologia"
                },
                new SelectListItem {
                    Text = "Farmakologia kliniczna"
                },
                new SelectListItem {
                    Text = "Gastroenterologia"
                },
                new SelectListItem {
                    Text = "Gastroenterologia dziecięca"
                },
                new SelectListItem {
                    Text = "Genetyka kliniczna"
                },
                new SelectListItem {
                    Text = "Geriatria"
                },
                new SelectListItem {
                    Text = "Ginekologia onkologiczna"
                },
                new SelectListItem {
                    Text = "Hematologia"
                },
                new SelectListItem {
                    Text = "Hipertensjologia"
                },
                new SelectListItem {
                    Text = "Immunologia kliniczna"
                },
                new SelectListItem {
                    Text = "Intensywna terapia"
                },
                new SelectListItem {
                    Text = "Kardiochirurgia"
                },
                new SelectListItem {
                    Text = "Kardiologia"
                },
                new SelectListItem {
                    Text = "Kardiologia dziecięca"
                },
                new SelectListItem {
                    Text = "Medycyna lotnicza"
                },
                new SelectListItem {
                    Text = "Medycyna morska i tropikalna"
                },
                new SelectListItem {
                    Text = "Medycyna nuklearna"
                },
                new SelectListItem {
                    Text = "Medycyna paliatywna"
                },
                new SelectListItem {
                    Text = "Medycyna pracy"
                },
                new SelectListItem {
                    Text = "Medycyna ratunkowa"
                },
                new SelectListItem {
                    Text = "Medycyna rodzinna"
                },
                new SelectListItem {
                    Text = "Medycyna sądowa"
                },
                new SelectListItem {
                    Text = "Medycyna sportowa"
                },
                new SelectListItem {
                    Text = "Mikrobiologia lekarska"
                },
                new SelectListItem {
                    Text = "Nefrologia"
                },
                new SelectListItem {
                    Text = "Nefrologia dziecięca"
                },
                new SelectListItem {
                    Text = "Neonatologia"
                },
                new SelectListItem {
                    Text = "Neurochirurgia"
                },
                new SelectListItem {
                    Text = "Neurologia"
                },
                new SelectListItem {
                    Text = "Neurologia dziecięca"
                },
                new SelectListItem {
                    Text = "Neuropatologia"
                },
                new SelectListItem {
                    Text = "Okulistyka"
                },
                new SelectListItem {
                    Text = "Onkologia i hematologia dziecięca"
                },
                new SelectListItem {
                    Text = "Onkologia kliniczna "
                },
                new SelectListItem {
                    Text = "Ortodoncja"
                },
                new SelectListItem {
                    Text = "Ortopedia i traumatologia narządu ruchu"
                },
                new SelectListItem {
                    Text = "Otorynolaryngologia"
                },
                new SelectListItem {
                    Text = "Otorynolaryngologia dziecięca"
                },
                new SelectListItem {
                    Text = "Patomorfologia"
                },
                new SelectListItem {
                    Text = "Pediatria"
                },
                new SelectListItem {
                    Text = "Pediatria metaboliczna"
                },
                new SelectListItem {
                    Text = "Perinatologia"
                },
                new SelectListItem {
                    Text = "Periodontologia"
                },
                new SelectListItem {
                    Text = "Położnictwo i ginekologia"
                },
                new SelectListItem {
                    Text = "Protetyka stomatologiczna"
                },
                new SelectListItem {
                    Text = "Psychiatria"
                },
                new SelectListItem {
                    Text = "Psychiatria dzieci i młodzieży"
                },
                new SelectListItem {
                    Text = "Radiologia i diagnostyka obrazowa"
                },
                new SelectListItem {
                    Text = "Radioterapia onkologiczna"
                },
                new SelectListItem {
                    Text = "Rehabilitacja medyczna"
                },
                new SelectListItem {
                    Text = "Reumatologia"
                },
                new SelectListItem {
                    Text = "Seksuologia"
                },
                new SelectListItem {
                    Text = "Stomatologia dziecięca"
                },
                new SelectListItem {
                    Text = "Stomatologia zachowawcza z endodoncją"
                },
                new SelectListItem {
                    Text = "Toksykologia kliniczna"
                },
                new SelectListItem {
                    Text = "Transfuzjologia kliniczna"
                },
                new SelectListItem {
                    Text = "Transplantologia kliniczna"
                },
                new SelectListItem {
                    Text = "Urologia"
                },
                new SelectListItem {
                    Text = "Urologia dziecięca"
                },
                new SelectListItem {
                    Text = "Zdrowie publiczne "
                },
            };

            ViewBag.Spec = Specializations;

            return(View(model));
        }
Пример #14
0
 public RBookAppointment(AppointmentDBContext context)
 {
     this.context = context;
 }
Пример #15
0
 public AppointmentStatusController(AppointmentDBContext context)
 {
     _context = context;
 }
 public BenchesController(AppointmentDBContext context)
 {
     _context = context;
 }
 public BaseRepository()
 {
     _context = new AppointmentDBContext();
     _dbSet   = _context.Set <TEntity>();
 }
Пример #18
0
 public HomeController(AppointmentDBContext cxt)
 {
     context = cxt;
 }