コード例 #1
0
        public ActionResult PastOperations(ViewModel3 viewModel)
        {
            var testTable = from ap in db.Appointment
                            join dapp in db.DAppDate on ap.DId equals dapp.Id
                            join d in db.Doctor on dapp.Doctor_id equals d.Id
                            join dep in db.Department on d.DId equals dep.Id
                            join hosp in db.Hospital on dep.HId equals hosp.Id
                            select new ViewModel
            {
                appointment = ap,
                dApp        = dapp,
                doctor      = d,
                department  = dep,
                hospital    = hosp,
            };

            ViewData["TestTable"] = testTable;
            var findIllnessId = db.Illness.OrderByDescending(x => x.Id).FirstOrDefault(x => x.Name == viewModel.IllnessName);
            List <Appointment> appointmentList = db.Appointment.Where(x => x.PatientId == PatientHelper.id).ToList();
            List <Patient>     patientList     = db.Patient.Where(x => x.Id == PatientHelper.id).ToList();

            ViewModel2 viewModel2 = new ViewModel2();

            viewModel2.appointments = appointmentList;
            viewModel2.patientss    = patientList;
            viewModel2.PID          = PatientHelper.id;


            return(View(viewModel2));
        }
コード例 #2
0
 private void Add_OnClick(object sender, RoutedEventArgs e)
 {
     Button btn = (Button)sender;
     var nmb = int.Parse(Regex.Replace(btn.Name, "[^0-9.]", ""));
     object ob = null;
     switch (nmb)
     {
         case 1:
             ob = new ViewModel1(App.EventAgrigator);
             break;
         case 2:
             ob = new ViewModel2(App.EventAgrigator);
             break;
         case 3:
             ob = new ViewModel3(App.EventAgrigator);
             break;
         case 4:
             ob = new ViewModel4(App.EventAgrigator);
             break;
         case 5:
             ob = new ViewModel5(App.EventAgrigator);
             break;
     }
     if (ob != null)
         _objectList.Add(ob);
 }
コード例 #3
0
     public MainWindowViewModel()
     {
     ViewModel1 = new ViewModel1();
     ViewModel2 = new ViewModel2();
     ViewModel3 = new ViewModel3();
     ViewModel1.PropertyChanged += (s,e) => 
     {
         if(e.PropertyName == "IsBusy") 
         { 
           // set the MainWindowViewModel.IsBusy property here
         }
     }
     //IsBusy = true; - its working
 }
コード例 #4
0
        private void UserLists_Tapped(object sender, TappedRoutedEventArgs e)
        {
            try
            {
                item_user = this.userSearchView.SelectedItem as Models.UserInfo;
                ViewModel3.UserIdSet(item_user.UserId);
            }
            catch (Exception ex)
            {
                data.toast(ex.Message);
            }

            //itemStock();
            FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender);
        }
コード例 #5
0
 public MainViewModel()
 {
     Add1Command = new Command(() => AddItems(ViewModel1.Items));
     Add2Command = new Command(() => AddItems(ViewModel2.Items));
     Add3Command = new Command(() => AddItems(ViewModel3.Items));
     Add4Command = new Command(() =>
     {
         ViewModel1.ReloadData();
         ViewModel2.ReloadData();
         ViewModel3.ReloadData();
     });
     Add5Command = new Command(() =>
     {
         ViewModel1.ChangeListViewVisability();
         ViewModel2.ChangeListViewVisability();
         ViewModel3.ReloadData();
     });
 }
コード例 #6
0
  // this will be handled by IoC container
  public MainViewModel(ViewModel1 viewModel1, ViewModel2 viewModel2, ViewModel3 viewModel3)
 {
     ViewModel1 = viewModel1;
     ViewModel2 = viewModel2;
     ViewModel3 = viewModel3;
 }
コード例 #7
0
        public ActionResult AppointmentIndex(ViewModel3 viewModel)
        {
            var findPatientId = db.Patient.FirstOrDefault(x => x.Email == viewModel.PatientEmail);
            var findDappId2   = db.DAppDate.FirstOrDefault(x => x.Time == viewModel.DappTime);


            if (ModelState.IsValid && viewModel.AppDate >= DateTime.Now)
            {
                var checkValidAppointment = db.Appointment.FirstOrDefault(x => x.Date == viewModel.AppDate && x.DId == findDappId2.Id);
                var findDoctorId          = db.Doctor.FirstOrDefault(x => x.Name + " " + x.Surname == viewModel.DoctorName);
                var findIllnessId         = db.Illness.OrderByDescending(x => x.Id).FirstOrDefault(x => x.Name == viewModel.IllnessName && x.PId == findPatientId.Id);
                var findDappId            = db.DAppDate.FirstOrDefault(x => x.Time == viewModel.DappTime && x.Doctor_id == findDoctorId.Id);
                if (checkValidAppointment == null && findDappId != null && findDoctorId != null)
                {
                    Illness ıllness = new Illness();
                    ıllness.Name = viewModel.IllnessName;
                    ıllness.PId  = findPatientId.Id;
                    db.Illness.Add(ıllness);
                    db.SaveChanges();


                    Hospital hospital = new Hospital();
                    hospital.Name = viewModel.HospitalName;

                    Appointment appointment = new Appointment();
                    appointment.IllId     = findIllnessId.Id;
                    appointment.DId       = findDappId.Id;
                    appointment.Name      = viewModel.IllnessName;
                    appointment.Date      = viewModel.AppDate;
                    appointment.PatientId = PatientHelper.id;
                    db.Appointment.Add(appointment);
                    db.SaveChanges();
                    TempData["success"] = "Your appointment is succesfully created!";

                    if (viewModel.PatientEmail.Contains("hotmail"))
                    {
                        MailMessage message = new MailMessage();
                        SmtpClient  client  = new SmtpClient();
                        client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "caglacopurkaya1999");
                        client.Port        = 587;
                        client.Host        = "smtp.live.com";
                        client.EnableSsl   = true;
                        message.To.Add(viewModel.PatientEmail);
                        message.From    = new MailAddress("*****@*****.**");
                        message.Subject = "Appointment";
                        message.Body    = "Dear" + " " + viewModel.PatientName + " " + viewModel.PatientSurname + " " + "your appointment has been succesfully set up on " +
                                          viewModel.AppDate.ToLongDateString() + " " + "at " + viewModel.HospitalName + " hospital from the department of " + viewModel.DepartmentName + " to " + viewModel.DoctorName + " " +
                                          " doctor at " + viewModel.DappTime + ". We wish you a healty day!";
                        client.Send(message);
                    }
                    else if (viewModel.PatientEmail.Contains("gmail"))
                    {
                        var          fromAddress  = new MailAddress("*****@*****.**");
                        var          toAddress    = new MailAddress(viewModel.PatientEmail);
                        const string fromPassword = "******";
                        const string subject      = "Appointment";
                        string       body         = "Dear" + " " + viewModel.PatientName + " " + viewModel.PatientSurname + " " + "your appointment has been succesfully set up on " +
                                                    viewModel.AppDate.ToLongDateString() + " " + "at " + viewModel.HospitalName + " hospital from the department of " + viewModel.DepartmentName + " to " + viewModel.DoctorName + " " +
                                                    " doctor at " + viewModel.DappTime + ". We wish you a healty day!";

                        var smtp = new SmtpClient
                        {
                            Host                  = "smtp.gmail.com",
                            Port                  = 587,
                            EnableSsl             = true,
                            DeliveryMethod        = SmtpDeliveryMethod.Network,
                            UseDefaultCredentials = false,
                            Credentials           = new NetworkCredential(fromAddress.Address, fromPassword)
                        };
                        using (var message = new MailMessage(fromAddress, toAddress)
                        {
                            Subject = subject,
                            Body = body
                        })
                        {
                            smtp.Send(message);
                        }
                    }
                    viewModel.PatientId = PatientHelper.id;
                    return(RedirectToAction("PastOperations", "Profile", viewModel));
                }
                else
                {
                    TempData["fail"] = "The appointment time may have been taken or the data you selected may be incompatible!";
                    return(RedirectToAction("AppointmentIndex", findPatientId.Id));
                }
            }
            else
            {
                TempData["failed"] = "Please fill all blanks or select proper date!";
                return(RedirectToAction("AppointmentIndex", findPatientId.Id));
            }
        }