예제 #1
0
        public CalendarVm(ICompanyQueries companyQueries, string userId, Guid?professionalIdOfUser, string professionalIdOfCalendar)
        {
            _companyQueries = companyQueries;
            ProfessionalsAccessableEmployees = _companyQueries.GetAccessibleEmployeesForProfessional(userId, true, 0);

            if (!String.IsNullOrWhiteSpace(professionalIdOfCalendar))
            {
                CurrentProfessionalId = GuidHelper.GetGuid(professionalIdOfCalendar);
            }
            else if (professionalIdOfUser != null)
            {
                CurrentProfessionalId = (Guid)professionalIdOfUser;
            }

            if (ProfessionalsAccessableEmployees != null)
            {
                List <SelectListItem> sliList = new List <SelectListItem>();
                foreach (var row in ProfessionalsAccessableEmployees)
                {
                    SelectListItem itm = new SelectListItem();
                    itm.Selected = row.IsDefault;
                    itm.Text     = row.Forename + " " + row.Surname;
                    itm.Value    = row.Id.ToString();
                    sliList.Add(itm);
                }
                ProfessionalsAccessableEmployeesDropDown = sliList.AsEnumerable();
            }
        }
        public AppointmentModalVm(ICompanyQueries companyQueries, string userId, string professionalIdForAppointment, AppointmentForProUiDto appointment)
        {
            Guid proIdForAppt = GuidHelper.GetGuid(professionalIdForAppointment);

            _companyQueries = companyQueries;
            ProfessionalsAccessableEmployees = _companyQueries.GetAccessibleEmployeesForProfessional(userId, true, 0);
            Appointment = appointment;
            Appointment.ProfessionalId = proIdForAppt;

            if (ProfessionalsAccessableEmployees != null)
            {
                List <SelectListItem> sliList = new List <SelectListItem>();
                foreach (var row in ProfessionalsAccessableEmployees)
                {
                    SelectListItem itm = new SelectListItem();
                    itm.Selected = row.Id == proIdForAppt;
                    itm.Text     = row.Forename + " " + row.Surname;
                    itm.Value    = row.Id.ToString();
                    sliList.Add(itm);
                }
                ProfessionalsAccessableEmployeesDropDownModal = sliList.AsEnumerable();


                //ProfessionalsAccessableEmployeesDropDown = ProfessionalsAccessableEmployees.Select(i => new SelectListItem()
                //{
                //    Selected = (Appointment.ProfessionalId.ToString() == i.Id.ToString()),
                //    Text = i.Forename + " " + i.Surname,
                //    Value = i.Id.ToString()
                //});
            }
        }