Ejemplo n.º 1
0
        public ActionResult EditPreferences()
        {
            PracticeAdminEditPreferencesViewModel viewM = new PracticeAdminEditPreferencesViewModel();

            viewM.practices = DataCollections.getPractices(db, HubSecurity.getLoggedInUserID());
            if (viewM.practices.Count() > 1)
            {
                viewM.selectedPrac = DataCollections.getPractice(db, viewM.practices.Skip(1).First().Value);
            }
            else
            {
                viewM.selectedPrac = DataCollections.getPractice(db, viewM.practices.First().Value);
            }
            viewM.hidPrac     = viewM.selectedPrac.PracID.ToString();
            viewM.specialties = DataCollections.getSpecialties(db, viewM.selectedPrac.PracID);
            return(View(viewM));
        }
Ejemplo n.º 2
0
        public ActionResult EditPreferences(PracticeAdminEditPreferencesViewModel viewM)
        {
            PracticeAdminEditPreferencesViewModel returnM = new PracticeAdminEditPreferencesViewModel();
            ReferringPractice oldPrac;

            returnM.practices = DataCollections.getPractices(db, HubSecurity.getLoggedInUserID());
            int id;

            if (viewM.UpdatePracticeInformation != null)
            {
                if (viewM.hidAll == "true")
                {
                    foreach (SelectListItem prac in returnM.practices)
                    {
                        if (prac.Value == "ALL")
                        {
                            continue;
                        }
                        id                    = Convert.ToInt32(prac.Value);
                        oldPrac               = (from r in db.ReferringPractices where r.PracID == id select r).Single();
                        oldPrac.Address1      = viewM.selectedPrac.Address1;
                        oldPrac.Address2      = viewM.selectedPrac.Address2;
                        oldPrac.Address3      = viewM.selectedPrac.Address3;
                        oldPrac.City          = viewM.selectedPrac.City;
                        oldPrac.State         = viewM.selectedPrac.State;
                        oldPrac.Zip           = viewM.selectedPrac.Zip;
                        oldPrac.Phone         = viewM.selectedPrac.Phone;
                        oldPrac.Fax           = viewM.selectedPrac.Fax;
                        oldPrac.OfficeManager = viewM.selectedPrac.OfficeManager;
                        oldPrac.Other         = viewM.selectedPrac.Other;
                        oldPrac.PDFPassword   = viewM.selectedPrac.PDFPassword;
                        DataSubmissions.SavePractice(db, oldPrac);
                    }
                }
                else
                {
                    oldPrac               = (from r in db.ReferringPractices where r.PracID == viewM.selectedPrac.PracID select r).Single();
                    oldPrac.Address1      = viewM.selectedPrac.Address1;
                    oldPrac.Address2      = viewM.selectedPrac.Address2;
                    oldPrac.Address3      = viewM.selectedPrac.Address3;
                    oldPrac.City          = viewM.selectedPrac.City;
                    oldPrac.State         = viewM.selectedPrac.State;
                    oldPrac.Zip           = viewM.selectedPrac.Zip;
                    oldPrac.Phone         = viewM.selectedPrac.Phone;
                    oldPrac.Fax           = viewM.selectedPrac.Fax;
                    oldPrac.OfficeManager = viewM.selectedPrac.OfficeManager;
                    oldPrac.Other         = viewM.selectedPrac.Other;
                    oldPrac.PDFPassword   = viewM.selectedPrac.PDFPassword;
                    DataSubmissions.SavePractice(db, oldPrac);
                }
            }
            if (viewM.UpdateCommunicationMethod != null)
            {
                if (viewM.hidAll == "true")
                {
                    foreach (SelectListItem prac in returnM.practices)
                    {
                        if (prac.Value == "ALL")
                        {
                            continue;
                        }
                        id      = Convert.ToInt32(prac.Value);
                        oldPrac = (from r in db.ReferringPractices where r.PracID == id select r).Single();
                        oldPrac.EmailNotification = viewM.selectedPrac.EmailNotification;
                        oldPrac.FaxNotification   = viewM.selectedPrac.FaxNotification;
                        DataSubmissions.SavePractice(db, oldPrac);
                    }
                }
                else
                {
                    oldPrac = (from r in db.ReferringPractices where r.PracID == viewM.selectedPrac.PracID select r).Single();
                    oldPrac.EmailNotification = viewM.selectedPrac.EmailNotification;
                    oldPrac.FaxNotification   = viewM.selectedPrac.FaxNotification;
                    DataSubmissions.SavePractice(db, oldPrac);
                }
            }

            returnM.practices    = DataCollections.getPractices(db, HubSecurity.getLoggedInUserID());
            returnM.selectedPrac = DataCollections.getPractice(db, viewM.hidPrac);
            returnM.specialties  = DataCollections.getSpecialties(db, viewM.selectedPrac.PracID);
            returnM.hidPrac      = viewM.hidPrac;
            returnM.tabReturn    = viewM.tabReturn;
            returnM.hidAll       = viewM.hidAll;

            return(View(returnM));
        }