示例#1
0
        public ActionResult Change(AccountChangeModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(model));
            }
            if (model.newPassword != model.confirmPassword)
            {
                this.ModelState.AddModelError(string.Empty, "The New Password and Confirm Password do not match. Please try again.");
                return(this.View(model));
            }

            try
            {
                if (Membership.ValidateUser(model.UserID, model.Password))
                {
                    HubSecurity.ChangePassword(model);
                    model.success = true;
                    return(this.View(model));
                }
                else
                {
                    this.ModelState.AddModelError(string.Empty, "The username or password is incorrect. Please try again.");
                    return(this.View(model));
                }
            }
            catch (Exception ex)
            {
                this.ModelState.AddModelError(string.Empty, ex.Message);
                return(View(model));
                //return Content(ex.Message);
            }
        }
示例#2
0
        public static void SavePreferences(PatientLogModel db, string controller, string viewModel, Dictionary <string, string> values)
        {
            if (values.Count > 0)
            {
                string userID = HubSecurity.getLoggedInUserID();
                foreach (KeyValuePair <string, string> entry in values)
                {
                    UserPreference preference = (from u in db.UserPreferences where u.Controller == controller && u.ViewModel == viewModel && u.FilterName == entry.Key && u.UserID == userID select u).FirstOrDefault();

                    //If user preference query returns a value, update it. If not, create a new entry in the db
                    if (preference != null)
                    {
                        preference.FilterValue     = entry.Value;
                        db.Entry(preference).State = EntityState.Modified;
                    }
                    else
                    {
                        preference             = new UserPreference();
                        preference.Controller  = controller;
                        preference.ViewModel   = viewModel;
                        preference.FilterName  = entry.Key;
                        preference.FilterValue = entry.Value;
                        preference.UserID      = userID;
                        db.UserPreferences.Add(preference);
                    }
                }
                db.SaveChanges();
            }
        }
示例#3
0
        //private static string getController()
        //{
        //    try
        //    {
        //        return HttpContext.Current.Request.FilePath.Substring(1, HttpContext.Current.Request.FilePath.LastIndexOf("/") - 1);
        //    }
        //    catch (Exception ex)
        //    {
        //        return "getControllerErrored";
        //    }

        //}

        //private static string getPage()
        //{
        //    try
        //    {
        //        return HttpContext.Current.Request.FilePath.Substring(HttpContext.Current.Request.FilePath.LastIndexOf("/") + 1);
        //    }
        //    catch (Exception ex)
        //    {
        //        return "getPageErrored";
        //    }
        //}
        public static int CreateFavorite(PatientLogModel db, string users, string hospitals, string types, string name, bool isDefault)
        {
            ScheduleFavorite fave = new ScheduleFavorite();

            fave.Users    = users;
            fave.Hospital = hospitals;
            fave.Types    = types;
            fave.Name     = name;
            fave.Default  = isDefault;
            fave.UserID   = HubSecurity.getLoggedInUserID();
            //If this entry is set to be default, make sure all current ones get default put to false
            if (isDefault)
            {
                List <int> ids = (from f in db.ScheduleFavorites where f.UserID == fave.UserID select f.ID).ToList();
                foreach (int id in ids)
                {
                    ScheduleFavorite f = db.ScheduleFavorites.Find(id);
                    f.Default         = false;
                    db.Entry(f).State = EntityState.Modified;
                }
            }
            db.ScheduleFavorites.Add(fave);
            db.SaveChanges();
            return(fave.ID);
        }
示例#4
0
        public static Dictionary <string, string> LoadPreferences(PatientLogModel db, string controller, string viewModel)
        {
            Dictionary <string, string> preferences = new Dictionary <string, string>();
            string userID = HubSecurity.getLoggedInUserID();

            preferences = (from u in db.UserPreferences where u.UserID == userID && u.Controller == controller && u.ViewModel == viewModel select new { Key = u.FilterName, Value = u.FilterValue }).ToDictionary(t => t.Key, t => t.Value);
            return(preferences);
        }
示例#5
0
        //public static List<string> getArcturusPCPs(PatientLogModel db)
        //{
        //    var returnList = from u in db.Users
        //                     join ud in db.UserDetails on u.UserID equals ud.UserID
        //                     where (ud.UserType == "RefPhy") && (from rp in db.RefPractUser join prac in db.ReferringPractices on rp.PracID equals prac.PracID where prac.LegacyShortName.StartsWith("ARCH") select rp.RefPracUser).Contains(ud.UserID)
        //                     orderby u.LastName
        //                     select new { Value = (u.LastName + ", " + u.FirstName) };

        //    return returnList.ToList();
        //}
        //Returns JSON list of PCPs that match the specified site
        //public static IQueryable< jsonPCP(string site)
        //{
        //    var query = from u in db.Users
        //                join ud in db.UserDetails on u.UserID equals ud.UserID
        //                where (ud.UserType == "RefPhy") && (ud.DefaultHospital == site)
        //                orderby u.LastName
        //                select new { Value = (u.LastName + ", " + u.FirstName) };

        //    return Json(query, JsonRequestBehavior.AllowGet);
        //}

        ////Returns JSON list of AIMS Physicians that match the specified site
        //public ActionResult jsonAIMSPhy(string site)
        //{
        //    var query = from u in db.Users
        //                join ud in db.UserDetails on u.UserID equals ud.UserID
        //                where (ud.UserType == "AIMSPhy" && ud.Active == true) && (ud.DefaultHospital == site)
        //                orderby u.LastName
        //                select new { Text = (u.LastName + ", " + u.FirstName), Value = u.UserID };

        //    return Json(query, JsonRequestBehavior.AllowGet);
        //}

        public static string LoadPreference(PatientLogModel db, string controller, string viewModel, string filterName)
        {
            //Code already operates on null values so no casting is needed from this call
            string userID = HubSecurity.getLoggedInUserID();
            string result = (from u in db.UserPreferences where u.UserID == userID && u.Controller == controller && u.ViewModel == viewModel && u.FilterName == filterName select u.FilterValue).FirstOrDefault();

            return(result);
        }
示例#6
0
 public ActionResult Create(PatientLogCreateViewModel viewM)
 {
     if (ModelState.IsValid)
     {
         viewM.Patient.Physician = HubSecurity.getLoggedInUserID();
         DataSubmissions.CreatePatient(db, viewM.Patient);
         return(RedirectToAction("Index"));
     }
     return(View(viewM.Patient));
 }
示例#7
0
        public static string getFavoriteDefault(PatientLogModel db)
        {
            string userID = HubSecurity.getLoggedInUserID();
            var    fav    = (from f in db.ScheduleFavorites where f.UserID == userID && f.Default == true select f.Name).FirstOrDefault();

            if (fav == null)
            {
                return("[none]");
            }
            else
            {
                return(fav.ToString());
            }
        }
示例#8
0
        //private IEnumerable<PCPCommunicationManagePatient> pcpManageQueryGenerator(DateTime fromDate, DateTime toDate, List<string> selectedHosp, List<string> selectedPCP, PCPCommunicationManageViewModel.BasedOn basedOn)
        //{
        //    IEnumerable<PatientLog> query = from p in db.PatientLogs
        //                                    where (p.ServiceType == "DC - STD" || p.ServiceType == "DC - EXT") &&
        //                                    (p.ServiceDate >= fromDate && p.ServiceDate <= toDate)
        //                                    select p;

        //    if (selectedHosp.Any())
        //    {
        //        query = query.Where(h => selectedHosp.Contains(h.Hospital));
        //    }
        //    if (selectedPCP.Any())
        //    {
        //        query = query.Where(s => selectedPCP.Contains(s.ServiceType));
        //    }

        //    List<int> idList = query.Select(p => p.ID).ToList();

        //    IEnumerable<PCPCommunicationManagePatient> ret;

        //}

        private IEnumerable <PatientLog> pcpCommunicationQueryGenerator(DateTime fromDate, DateTime toDate)
        {
            string user = HubSecurity.getLoggedInUserID(); //LINQ doesn't like the function to be in the query
            IEnumerable <PatientLog> query = from d in db.PatientLogs
                                             where (d.ServiceDate >= fromDate && d.ServiceDate <= toDate) && d.Physician == user && (d.PCP_Practice != "No PCP" && d.PCP_Practice != null)
                                             select d;

            //Only select entries that are not registered in PCPCommunication
            query = query.Where(c => !db.PCPCommunications.Select(b => b.PLRecord).Contains(c.ID));

            //Only select valid fax entries
            query = query.Where(c => db.FaxServiceTypes.Select(b => b.Service).Contains(c.ServiceType));

            return(query);
        }
示例#9
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));
        }
示例#10
0
        //Returns SelectList containing practice friendly name and practice ID for value with provided practice selected
        public static SelectList getFavorites(PatientLogModel db)
        {
            string userID = HubSecurity.getLoggedInUserID();
            IQueryable <SelectListItem> practices = from f in db.ScheduleFavorites
                                                    where f.UserID == userID
                                                    select new SelectListItem {
                Value = f.ID.ToString(), Text = f.Name
            };

            List <SelectListItem> list = practices.ToList();

            //if (list.Count == 0)
            //{
            //    list.Add(new SelectListItem { Text = "", Value = "" });
            //}
            return(new SelectList(list, "Value", "Text"));
        }
示例#11
0
        public ActionResult Index(AccountModel model, string returnURL)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(model));
            }

            try
            {
                if (Membership.ValidateUser(model.UserID, model.Password))
                {
                    FormsAuthentication.SetAuthCookie(model.UserID, false);
                    HubSecurity.loadUserAD(model.UserID);
                    if (HubSecurity.isExpired)
                    {
                        return(this.RedirectToAction("Change", "Login"));
                    }
                    else
                    {
                        if (HubSecurity.isPracAdmin)
                        {
                            return(this.RedirectToAction("Index", "PracticeAdmin"));
                        }
                        else
                        {
                            return(this.RedirectToAction("Index", "Home"));
                        }
                    }
                }
                else
                {
                    this.ModelState.AddModelError(string.Empty, "The username or password is incorrect. Please try again.");
                    return(this.View(model));
                }
            }
            catch (Exception ex)
            {
                var test = ex.Message;
                this.ModelState.AddModelError(string.Empty, "Something went wrong trying to reach the login server. Please contact IT.");
                return(this.View(model));
            }
        }
示例#12
0
        //public static void SetDailyRepeatSchedule(PatientLogModel db, string user, string hospital, string type, DateTime start, DateTime end, int interval, DateTime repeatTo)
        //{

        //}

        public static string SetDefaultFavorite(PatientLogModel db, string id)
        {
            string userid = HubSecurity.getLoggedInUserID();
            string ret;
            int    newID = Convert.ToInt32(id);
            List <ScheduleFavorite> query = (from f in db.ScheduleFavorites where f.UserID == userid select f).ToList();

            foreach (ScheduleFavorite f in query)
            {
                f.Default         = false;
                db.Entry(f).State = EntityState.Modified;
            }
            ScheduleFavorite newD = db.ScheduleFavorites.Find(newID);

            ret                  = newD.Name;
            newD.Default         = true;
            db.Entry(newD).State = EntityState.Modified;
            db.SaveChanges();
            return(ret);
        }
示例#13
0
        public static void SavePreference(PatientLogModel db, string controller, string viewModel, string filterName, string filterValue)
        {
            string         userID     = HubSecurity.getLoggedInUserID();
            UserPreference preference = (from u in db.UserPreferences where u.Controller == controller && u.ViewModel == viewModel && u.FilterName == filterName && u.UserID == userID select u).FirstOrDefault();

            //If user preference query returns a value, update it. If not, create a new entry in the db
            if (preference != null)
            {
                preference.FilterValue     = filterValue;
                db.Entry(preference).State = EntityState.Modified;
            }
            else
            {
                preference.Controller  = controller;
                preference.ViewModel   = viewModel;
                preference.FilterName  = filterName;
                preference.FilterValue = filterValue;
                preference.UserID      = userID;
                db.UserPreferences.Add(preference);
            }
            //Decided to leave this outside of the function so that it is only called once, supposed to be more efficient
            //db.SaveChanges();
        }
示例#14
0
        public void SendFax(string strRepType, Microsoft.Reporting.WebForms.ReportViewer AIMSReportViewer, string strFaxFolder, string strFaxNumber, string strHospital,
                            string strUserID, string strPcpID, string strPcpName, int intPtLogRecord, string strPatientName,
                            string strComment, string strGeneralHeading, string strNotification, string strDOB, string password, string strSub, string strTo, string additonalComments)
        {
            string strReportPath;
            string strFileName;
            string strFilePath;
            string strCompleteFilePath;
            string sourceFile;

            string timeoffax = DateTime.Now.ToString().Substring(10, 7).Replace(":", "") + DateTime.Now.Millisecond;

            strFaxNumber        = strFaxNumber.Substring(0, 3) + strFaxNumber.Substring(4, 3) + strFaxNumber.Substring(8, 4);
            strReportPath       = "\\AdDisNotice\\" + strRepType + strHospital + ".rdlc";
            strFileName         = strRepType + strHospital + strUserID + "_" + intPtLogRecord.ToString() + "_" + timeoffax + ".pdf";
            strFilePath         = strFaxFolder + strRepType + "\\";
            strCompleteFilePath = strFilePath + strFileName;
            sourceFile          = strFilePath;

            CreatePDFDocument(strCompleteFilePath, AIMSReportViewer, strCompleteFilePath);

            if (strFilePath.Substring(1, 1) == ":")
            {
                strFilePath = MACHINE_PATH + strFilePath.Substring(2);
            }

            bool isFax   = false;
            bool isEmail = false;

            if (strNotification == "")
            {
                isFax = true;
            }
            else
            {
                string[] arrNotification = strNotification.Split(new char[] { ';' });

                if (arrNotification.Contains("Fax"))
                {
                    isFax = true;
                }
                if (arrNotification.Contains("Email"))
                {
                    isEmail = true;
                }
            }

            if (strDOB == "N/A")
            {
                strDOB = "";
            }

            PCPCommunication comm = new PCPCommunication();

            comm.AdditionalComments = additonalComments;
            comm.Comments           = strComment;
            comm.CommStatus         = "Created";
            //Try to convert DOB to DateTime, revert to default if fails
            try
            {
                comm.DOB = DateTime.Parse(strDOB);
            }
            catch
            {
                comm.DOB = DateTime.Parse("1/1/1900");
            }
            comm.DocumentName = strFileName;
            comm.DocumentPath = strFilePath;
            comm.DocumentType = strRepType;
            //comm.EmailID =
            comm.FaxCover      = FAX_COVER;
            comm.FaxNo         = strFaxNumber;
            comm.GenComHeading = strGeneralHeading;
            comm.Hospital      = strHospital;
            //comm.Pages =
            comm.PatientName = strPatientName;
            comm.PLRecord    = intPtLogRecord;
            comm.ToUserID    = strPcpID;
            comm.UserID      = strUserID;

            if (isFax)
            {
                comm.CommType = "Fax";
                UpdateCommTable(comm);
            }

            if (isEmail)
            {
                comm.CommType = "Email";
                if (strTo != "")
                {
                    if (password == "")
                    {
                        password = "******";
                    }
                }
                string[] ret        = CreateEncryptedPDF(sourceFile, strFileName, password);
                string   outputFile = ret[0];
                int      pages      = Convert.ToInt32(ret[1]);
                string   strMsg     = DateTime.Now.ToString();
                UpdateCommTable(comm);

                try
                {
                    if (HubSecurity.Debug() == true)
                    {
                        strTo = "*****@*****.**";
                    }
                    SendMail("*****@*****.**", strTo, strSub, strMsg, outputFile, "fax", "aimsfx2345", null);
                    UpdateStatus(comm, "Mail Forwarded");
                    strMsg = "<html><body><b>" + strSub + "</b> has been sent to <br/><br/><table><tr><td> <b>PCP</b>: </td><td>" + strPcpName + "</td></tr>" +
                             "<tr><td><b>Mail Id: </b></td><td>" + strTo + "</td></tr>" +
                             "<tr><td><b>Time: </b></td><td>" + DateTime.Now.ToString() + "</td></tr></table><br/><br/> Please access AIMS Hub to view details.</body></html>";

                    string strToCC = AimsHub.Security.HubSecurity.getLoggedInUserID() + "@aims.us.com";
                    SendMail("*****@*****.**", strToCC, strSub, strMsg, null, "fax", "aimsfx2345", null);
                }
                catch
                {
                    UpdateStatus(comm, "Send Failed");
                }
                File.Delete(outputFile);
            }
        }
示例#15
0
        //This function returns results from PatientLog table for all PatientLog Views aside from PatientSort
        private IQueryable <PatientLog> patientLogQueryGenerator(DateTime fromDate, DateTime toDate, List <string> selectedHosp, List <string> selectedServ,
                                                                 GridFilter.SortDirections direction, string sortColumn, bool assigned)
        {
            //Query PatientLog by physicians and date/time range
            string user = HubSecurity.getLoggedInUserID();
            IQueryable <PatientLog> query;

            //Alter query to show all Assigned entries if selected to do so
            if (!assigned)
            {
                if (sortColumn == null)
                {
                    query = from d in db.PatientLogs
                            where d.ServiceDate >= fromDate &&
                            d.ServiceDate <= toDate &&
                            d.Physician == user
                            orderby d.PatientName, d.ServiceDate
                    select d;
                }
                else
                {
                    query = from d in db.PatientLogs
                            where d.ServiceDate >= fromDate &&
                            d.ServiceDate <= toDate &&
                            d.Physician == user
                            select d;
                }
            }
            else
            {
                if (sortColumn == null)
                {
                    query = from d in db.PatientLogs
                            where d.Physician == user && d.ServiceType == "Assigned"
                            orderby d.PatientName, d.ServiceDate
                    select d;
                }
                else
                {
                    query = from d in db.PatientLogs
                            where d.Physician == user && d.ServiceType == "Assigned"
                            select d;
                }
            }

            //Apply hospital filters if any are provided
            if (selectedHosp.Any())
            {
                query = query.Where(h => selectedHosp.Contains(h.Hospital));
            }

            //Apply service type filters only if not showing assigned view
            if (!assigned)
            {
                if (selectedServ.Any())
                {
                    query = query.Where(s => selectedServ.Contains(s.ServiceType));
                }
            }

            //Apply sorting
            if (direction == GridFilter.SortDirections.Ascending)
            {
                if (sortColumn == "PatientName")
                {
                    query = query.OrderBy(sortColumn + ", ServiceDate");
                }
                else
                {
                    query = query.OrderBy(sortColumn);
                }
            }
            else
            {
                query = query.OrderBy(sortColumn + " DESC");
            }

            List <int> idList = query.Select(p => p.ID).ToList();

            Session["patientLogListOfID"] = idList;

            //Update user preferences if Assigned is not selected
            if (!assigned)
            {
                Dictionary <string, string> filters = new Dictionary <string, string>();
                string hospPref = null;
                foreach (string hosp in selectedHosp)
                {
                    hospPref += hosp + ",";
                }
                if (hospPref != null)
                {
                    hospPref = hospPref.Substring(0, hospPref.Length - 1);
                }
                filters.Add("Hospital", hospPref);

                string servPref = null;
                foreach (string serv in selectedServ)
                {
                    servPref += serv + ",";
                }
                if (servPref != null)
                {
                    servPref = servPref.Substring(0, servPref.Length - 1);
                }
                filters.Add("ServiceType", servPref);

                if (direction == GridFilter.SortDirections.Ascending)
                {
                    filters.Add("SortDirection", "Ascending");
                }
                else
                {
                    filters.Add("SortDirection", "Descending");
                }
                filters.Add("SortColumn", sortColumn);

                DataSubmissions.SavePreferences(db, "PatientLog", "PatientLogIndex", filters);
            }

            return(query);
        }
示例#16
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));
        }
示例#17
0
        public JsonResult jsonSubmitSpecialtiesAll(List <RefPracSpecialty> specialties)
        {
            DataSubmissions.SaveSpecialties(db, specialties, HubSecurity.getLoggedInUserID());

            return(Json("Specialties Saved"));
        }
示例#18
0
        private void sendCommunications(string ids)
        {
            List <int> listofID = new List <int>();

            string[] splitList;
            splitList = ids.Split(new char[] { ',' });

            foreach (string i in splitList)
            {
                int theID = Convert.ToInt32(i);

                //Query patient record
                PatientLog pat = db.PatientLogs.Find(theID);

                //Determine fax type from table
                string faxType = (from f in db.FaxServiceTypes
                                  where f.Service == pat.ServiceType
                                  select f.FaxType).Single() + "Notice";

                //Break apart PCP name
                string[] splitName;
                splitName = pat.PCP_Practice.Split(new char[] { ',' });
                string pcpName   = splitName[1] + " " + splitName[0];
                string firstname = splitName[1].Trim(); //LINQ doesn't like arrays, throws error
                string lastname  = splitName[0].Trim();
                string pcpID     = (from u in db.Users where u.FirstName == firstname && u.LastName == lastname select u.UserID).Single();

                //Get practice info of PCP, default to AIMS otherwise
                ReferringPractice prac = new ReferringPractice();
                try
                {
                    prac = (from p in db.ReferringPractices
                            join r in db.RefPracUsers on p.PracID equals r.PracID
                            where r.UserID == pcpID
                            select p).Single();
                }
                catch
                {
                    prac.Fax             = "248-354-4807";
                    prac.FaxNotification = true;
                }

                //Create new reportviewer object and set parameters
                ReportViewer report = new ReportViewer();
                report.ProcessingMode         = ProcessingMode.Local;
                report.LocalReport.ReportPath = Server.MapPath("~") + "AdDisNotice\\" + faxType + pat.Hospital + ".rdlc";

                //Cannot perform ToShortDateString on pat.ServiceDate because of DateTime? type
                DateTime thed = new DateTime();
                thed = Convert.ToDateTime(pat.ServiceDate);
                DateTime birth = new DateTime();

                //Null values will cause the reportviewer control to error out
                try
                {
                    birth = Convert.ToDateTime(pat.DOB);
                }
                catch
                {
                    birth = DateTime.Parse("1/1/1900");
                }
                if (pat.PatientName == null)
                {
                    pat.PatientName = "";
                }
                if (pat.Comments == null)
                {
                    pat.Comments = "";
                }
                if (pat.MRN_FIN == null)
                {
                    pat.MRN_FIN = "";
                }

                ReportParameter dateparam      = new ReportParameter("Date", thed.ToShortDateString());
                ReportParameter faxparam       = new ReportParameter("Fax", prac.Fax);
                ReportParameter faxtoparam     = new ReportParameter("FaxTo", pcpName);
                ReportParameter dischargeparam = new ReportParameter("DischargeDate", thed.ToShortDateString());
                ReportParameter patientparam   = new ReportParameter("Patient", pat.PatientName);
                ReportParameter treatmentparam = new ReportParameter("Treatment", pat.Comments);
                ReportParameter mrnparam       = new ReportParameter("MRN", pat.MRN_FIN);
                ReportParameter physicianparam = new ReportParameter("Physician", HubSecurity.getLoggedInDisplayName());
                ReportParameter dobparam       = new ReportParameter("DOB", birth.ToShortDateString());

                ReportParameterCollection theparams = new ReportParameterCollection()
                {
                    dateparam, faxparam, faxtoparam, dischargeparam, patientparam, treatmentparam, mrnparam, physicianparam, dobparam
                };
                report.LocalReport.SetParameters(theparams);
                report.LocalReport.Refresh();

                string notificationTypes = "";
                if (prac.FaxNotification == true)
                {
                    notificationTypes += "Fax;";
                }
                if (prac.EmailNotification == true)
                {
                    notificationTypes += "Email;";
                }

                GenerateComms gcomm = new GenerateComms();
                gcomm.SendFax(faxType, report, FAX_FOLDER, prac.Fax, pat.Hospital, HubSecurity.getLoggedInUserID(), pcpID, pcpName,
                              pat.ID, pat.PatientName, pat.Comments, "", notificationTypes, birth.ToShortDateString(),
                              prac.PDFPassword, pat.Hospital + faxType, prac.Email, "");
            }
        }
示例#19
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                string faxType = drpFaxTypes.SelectedValue;
                drpFaxTypes.Visible = false;
                string std = Request.QueryString["patid"];
                int    id  = Convert.ToInt32(std);
                AimsHub.Models.PatientLog pat = new AimsHub.Models.PatientLog();
                pat = db.PatientLogs.Find(id);

                ReportViewer1.Visible = true;
                ReportViewer1.Reset();
                ReportViewer1.ProcessingMode = ProcessingMode.Local;
                btnEdit.Visible    = true;
                btnSend.Visible    = true;
                lblMessage.Visible = false;
                if (faxType.Contains("Notice"))
                {
                    ReportViewer1.LocalReport.ReportPath = "AdDisNotice/" + faxType + pat.Hospital + ".rdlc";
                }
                else if (faxType == "DischargeSummary")
                {
                    ReportViewer1.LocalReport.ReportPath = "AdDisNotice/DischargeSummary.rdlc";
                }
                else if (faxType == "GeneralCommunication")
                {
                    ReportViewer1.LocalReport.ReportPath = "AdDisNotice/GeneralCommunication.rdlc";
                }
                else
                {
                    ReportViewer1.Visible = false;
                    btnEdit.Visible       = false;
                    btnSend.Visible       = false;
                    lblMessage.Visible    = true;
                    return;
                }

                //Break apart PCP name
                string[] splitName;
                splitName = pat.PCP_Practice.Split(new char[] { ',' });
                string pcpName   = splitName[1] + " " + splitName[0];
                string firstname = splitName[1].Trim();
                string lastname  = splitName[0].Trim();
                string pcpID     = (from u in db.Users where (u.FirstName == firstname && u.LastName == lastname) select u.UserID).Single();


                //Get practice info of PCP
                //ReferringPractice prac = new ReferringPractice();
                //prac = (from p in db.ReferringPractices
                //        join r in db.RefPracUsers on p.PracID equals r.PracID
                //        where r.UserID == pcpID
                //        select p).Single();

                //Cannot perform ToShortDateString on pat.ServiceDate because of DateTime? type
                DateTime thed = new DateTime();
                thed = Convert.ToDateTime(pat.ServiceDate);
                DateTime birth = new DateTime();
                birth = Convert.ToDateTime(pat.DOB);

                ReportParameter dateparam = new ReportParameter("Date", thed.ToShortDateString());
                //ReportParameter faxparam = new ReportParameter("Fax", prac.Fax);
                ReportParameter faxparam       = new ReportParameter("Fax", "313-867-5309");
                ReportParameter faxtoparam     = new ReportParameter("FaxTo", pcpName);
                ReportParameter dischargeparam = new ReportParameter("DischargeDate", thed.ToShortDateString());
                ReportParameter patientparam   = new ReportParameter("Fax", pat.PatientName);
                ReportParameter treatmentparam = new ReportParameter("Treatment", pat.Comments);
                ReportParameter mrnparam       = new ReportParameter("MRN", pat.MRN_FIN);
                ReportParameter physicianparam = new ReportParameter("Physician", HubSecurity.getLoggedInDisplayName());
                ReportParameter dobparam       = new ReportParameter("DOB", birth.ToShortDateString());

                ReportParameterCollection theparams = new ReportParameterCollection()
                {
                    dateparam, faxparam, faxtoparam, dischargeparam, patientparam, treatmentparam, mrnparam, physicianparam, dobparam
                };
                ReportViewer1.LocalReport.SetParameters(theparams);
            }
        }