Exemplo n.º 1
0
        /// <summary>
        /// Occurs when a user chooses items in the grid and clicks send, to mail
        /// checked records to physicians.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SendEmailNotificationsClick(object sender, CommandEventArgs e)
        {
            Dictionary <string, List <int> > emailHash = new Dictionary <string, List <int> >();
            DataTable dataSource = new AppointmentDa().GetSurgeryAppointments(SearchDate, false);

            foreach (GridViewRow row in SendNotificationGrid.Rows)
            {
                CheckBox box = row.FindControl("EmailUserCheckBox") as CheckBox;
                if (box.Checked)
                {
                    int     apptId       = int.Parse(SendNotificationGrid.DataKeys[row.RowIndex].Value.ToString());
                    DataRow record       = dataSource.Select(SurgeryAppointment.SurgeryAppointmentId + " = " + apptId)[0];
                    string  emailAddress = record[SurgeryAppointment.ApptSurgeonEmail].ToString();
                    if (!string.IsNullOrEmpty(emailAddress))
                    {
                        AddEmailAppointmentToDictionary(emailHash, emailAddress, apptId);
                    }
                }
            }
            SendEmails(emailHash, dataSource);
            GridPanel.Visible            = false;
            SearchResultsMessage.Visible = true;
            int    emailCount = emailHash.Count;
            string total      = emailCount == 1 ? " email" : " emails";

            SearchResultsMessage.InnerText = "You have successfully sent " + emailCount + total + ".";
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        private void PopulatePhysicians()
        {
            AppointmentDa aptDa = new AppointmentDa();

            FindPatientClinic.DataSource = aptDa.GetDistinctAppointmentPhysicians().Tables[0].DefaultView;
            FindPatientClinic.DataBind();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Sends emails to physicians for a sepcific date
        /// </summary>
        /// <param name="date">the appointment date</param>
        /// <param name="excludeLastSentItems">if to exclude previously sent emails</param>
        /// <returns>the number of emails sent</returns>
        protected int BulkSendEmailsForDate(DateTime date, bool excludeLastSentItems)
        {
            DataTable dt = new AppointmentDa().GetSurgeryAppointments(date, excludeLastSentItems);
            Dictionary <string, List <int> > distinctEmailsAndKeys = GetDistinctEmailAppointments(dt);

            SendEmails(distinctEmailsAndKeys, dt);
            return(distinctEmailsAndKeys.Count);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Binds the Grid to the the results from the current date
        /// </summary>
        private void SetAppointmentGrid()
        {
            AppointmentDa da = new AppointmentDa();
            DataTable     dt = da.GetSurgeryAppointments(SearchDate, false);

            SendNotificationGrid.DataSource = dt;
            SendNotificationGrid.DataBind();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Sends emails to those emails, where each email contains those users email addresses.
        /// </summary>
        /// <param name="hashedList"></param>
        /// <param name="dataSource"></param>
        private void SendEmails(Dictionary <string, List <int> > hashedList, DataTable dataSource)
        {
            MailManager m          = new MailManager();
            List <int>  updateKeys = new List <int>();

            foreach (string emailAddress in hashedList.Keys)
            {
                XmlDocument xDoc = new XmlDocument();
                xDoc.AppendChild(xDoc.CreateXmlDeclaration("1.0", System.Text.Encoding.UTF8.WebName, "yes"));
                XmlElement eForms = xDoc.CreateElement("eforms");
                xDoc.AppendChild(eForms);

                List <int> emailPriKeys = hashedList[emailAddress];
                updateKeys.AddRange(emailPriKeys);
                string toName    = "";
                string toAddress = emailAddress;
                foreach (int priKey in emailPriKeys)
                {
                    DataRow record = dataSource.Select(SurgeryAppointment.SurgeryAppointmentId + " = " + priKey)[0];
                    toName = record[SurgeryAppointment.ApptCaseSurgeon].ToString();
                    XmlElement eFormNode = CreateEFromNode(xDoc, record);
                    eForms.AppendChild(eFormNode);
                }

                // Prepare the message
                MailMessage message = new MailMessage();
                message.From = m.AdminMailAddress;
                message.To.Add(new MailAddress(emailAddress, toName));
                message.Subject = "Here are the surgeries for " + toName + " on " + SearchDateText;

                // Generate HTML output based on EForm XML
                XslTransform     transformer = new XslTransform();
                XsltArgumentList argList     = new XsltArgumentList();
                argList.AddParam("surgeonName", string.Empty, toName);
                argList.AddParam("surgeonEmail", string.Empty, emailAddress);
                argList.AddParam("surgeryDate", string.Empty, SearchDateText);
                argList.AddParam("urlBase", string.Empty, PageUtil.GetAbsoluteUrl(this.Page, "~/"));
                transformer.Load(Server.MapPath(XSLTPath));
                System.IO.StringWriter messageWriter = new System.IO.StringWriter();
                transformer.Transform(xDoc, argList, messageWriter);
                message.Body       = messageWriter.ToString();
                message.IsBodyHtml = true;
                m.SendEmail(message);
            }
            // Update Last Notification Date
            AppointmentDa da = new AppointmentDa();

            da.UpdateLastNotificationDate(updateKeys, DateTime.Now);
        }
Exemplo n.º 6
0
        override protected void Page_Load(object sender, System.EventArgs e)
        {
            AppointmentDa aptDa = new AppointmentDa();

            //populate clinic list Physicians from look up codes
            //rptClinicPhysicians.DataSource = CacheManager.GetLookupCodeList("apptPhysician");
            //updated 9/22 fs
            rptClinicPhysicians.DataSource = aptDa.GetDistinctAppointmentPhysicians().Tables[0].DefaultView;
            rptClinicPhysicians.DataBind();


            //append inpatient services to the bottom of the clinic list drop down
            //added 12/06/04 to allow form printing of inpatients
            InPatientDa ipda = new InPatientDa();

            rptInPatientServices.DataSource = ipda.GetInPatientServices();
            rptInPatientServices.DataBind();

            //populate contact status from distinct values- status also present in look up codes
            PatientDa patDa = new PatientDa();
            //count of patients in each contact status should be based on dataset user is logged into
            string  datasetSql      = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]);
            DataSet contactStatusDs = patDa.GetDistinctContactStatus(datasetSql);

            rptStatus.DataSource = contactStatusDs;
            rptStatus.DataBind();

            //populate categories from distinct values, takes username to display private
            SecurityController ct       = new SecurityController();
            string             userName = ct.GetUserName();

            CategoryDa catDa = new CategoryDa();
            DataSet    catDs = catDa.GetDistinctCategories(userName);

            rptCategories.DataSource = catDs;
            rptCategories.DataBind();

            //v5.1: count of patients by action items
            ActionDa  actionDa = new ActionDa();
            DataTable actionDt = actionDa.GetDistinctPatientActions(datasetSql);

            rptActions.DataSource = actionDt;
            rptActions.DataBind();
        }
        protected void BindNotificationGrid(DateTime date)
        {
            AppointmentDa da = new AppointmentDa();
            DataTable     dt = da.GetEformsSurgeryAppointmentsSentByDate(date);

            dt.DefaultView.Sort = SurgeryAppointment.ApptSurgeonEmail;

            // Bind grid to sorted view
            NotificationLogGrid.DataSource = dt.DefaultView;
            NotificationLogGrid.DataBind();

            if (dt.Rows.Count == 0)
            {
                SearchMessage.InnerText = "There were no emails sent on " + date.ToShortDateString();
            }
            else
            {
                SearchMessage.InnerText = "Here is a list of emails sent on " + date.ToShortDateString();
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Builds a list of Clinic Physicians
        /// </summary>
        private bool ListClinicPhysicians()
        {
            bool physiciansListed = false;

            AppointmentDa aptDa = new AppointmentDa();
            DataTable     dt    = aptDa.GetDistinctAppointmentPhysicians().Tables[0];

            if (dt.Rows.Count > 0)
            {
                ClinicPhysiciansList.DataSource = dt;
                ClinicPhysiciansList.DataBind();
                physiciansListed = true;
            }
            else
            {
                ClinicPhysiciansList.Visible   = false;
                ClinicPhysiciansListLabel.Text = "No clinics have been scheduled.";
                SetUserMessage("NO PHYSICIANS");
            }

            return(physiciansListed);
        }
Exemplo n.º 9
0
        protected void SetReferralMDList()
        {
            XmlNode configNode = CaisisConfiguration.GetEFormNode(this.EFormName);

            if (configNode != null)
            {
                XmlAttribute att = configNode.Attributes["enableReferrals"];
                if (att != null)
                {
                    bool doEnable = bool.Parse(att.Value);
                    if (doEnable)
                    {
                        referToPanelContainer.Visible = true;

                        //UserDa uDa = new UserDa();
                        //DataTable uDt = uDa.GetUsersByAttributeValue("EForm Referee", "true");
                        //DataView uDv = uDt.DefaultView;
                        //uDv.Sort = BOL.User.UserLastName + " ASC";

                        //AppointmentDa da = new AppointmentDa();
                        //DataTable dt = da.GetUsersWithAppointments();
                        //DataView uDv = dt.DefaultView;

                        AppointmentDa da = new AppointmentDa();
                        DataTable     dt = da.GetUsersWithAppointments();
                        List <string> UsersWithAppointments = (from row in dt.AsEnumerable()
                                                               select row.Field <string>(BOL.User.UserName)).ToList <string>();

                        // add referral recipients
                        DataTable     uDt = ReferralRecipientsToGetLimitedData();
                        List <string> RECIPIENTS_TO_GET_LIMITED_DATA = (from row in uDt.AsEnumerable()
                                                                        select row.Field <string>(BOL.User.UserName)).ToList <string>();

                        UserDa userDa = new UserDa();

                        foreach (string refUserName in RECIPIENTS_TO_GET_LIMITED_DATA)
                        {
                            // check if user is already in list
                            if (!UsersWithAppointments.Contains(refUserName))
                            {
                                // include the "additional" users in list even if they don't have appointments
                                DataTable userDt = userDa.GetByUserName(refUserName).Tables[0];
                                if (userDt.Rows.Count > 0)
                                {
                                    dt.Rows.Add(userDt.Rows[0].ItemArray);
                                }
                            }
                        }


                        DataView uDv = dt.DefaultView;
                        uDv.Sort = "UserLastName ASC";


                        if (uDv.Count > 0)
                        {
                            NoEFormReferees.Visible = false;
                            ReferToRptr.DataSource  = uDv;
                            ReferToRptr.DataBind();
                        }
                    }
                }
            }
        }