Beispiel #1
0
        override protected void Page_Load(object sender, System.EventArgs e)
        {
            string userName = new SecurityController().GetUserName();

            UserDa  uda = new UserDa();
            DataSet uDs = uda.GetByUserName(userName);

            int userId = int.Parse(uDs.Tables[0].Rows[0]["UserId"].ToString());

            string msgType = "";

            if (Request.QueryString["msgStatus"] != null && Request.QueryString["msgStatus"].Length > 0)
            {
                msgType = "'" + Request.QueryString["msgStatus"] + "'";
            }
            else
            {
                msgType = "'" + EformStatusManager.Status_DataEntryInProgress
                          + "','" + EformStatusManager.Status_DataEntryComplete
                          + "','" + EformStatusManager.Status_Narrated
                          + "'";
            }

            PopulateInbox(userId, msgType);
        }
Beispiel #2
0
        private int GetAccountableUserId(string name)
        {
            //TODO: we don't care about userid anymore, need to replace with a "AccountableTo" which can be physician or other! Inbox is based on this ID

            // ARGGG.. TEMP FIX: we will use the userid of the current clinic's attending. how to get this? string match for now...

            string apptPhysician = name;
            int    userId        = 0;

            UserDa da = new UserDa();

            // we have the attending, is there a username that matches? Appt Physician is in format like SCARDINO, PETER (then sometime middle initial)
            string[] attending = apptPhysician.Trim().Split(new Char[] { ',' });
            if (attending.Length > 1)
            {
                string[] attendingFirstAndMiddle = attending[1].Trim().Split(new Char[] { ' ' });
                string   attendingLast           = attending[0].ToUpper();
                string   attendingFirst          = attendingFirstAndMiddle[0].ToUpper();
                DataSet  userDs = da.GetUserIdByFirstAndLastName(attendingFirst, attendingLast);

                if (userDs.Tables[0].Rows.Count == 1)
                {
                    userId = int.Parse(userDs.Tables[0].Rows[0]["UserId"].ToString());
                }
            }

            // if userid is 0, we could NOT find a matching attending, so insert the current userId
            if (userId == 0)
            {
                DataSet ds = da.GetByUserName(this.EFormUserName);
                userId = int.Parse(ds.Tables[0].Rows[0][0].ToString());
            }

            return(userId);
        }
Beispiel #3
0
        protected void SetClinicGroupTitles()
        {
            /* set name of clinic group: ie "Dr. Doe's Clinic"
             * if(Session[SessionKey.CurrentListType] != null && Session[SessionKey.CurrentListType].ToString() == "Clinic")
             * {
             *      string docClinicName = Session[SessionKey.CurrentListCrit].ToString();
             *
             *      // displays just doc last name
             *      //int commaIndex = docClinicName.IndexOf(",");
             *      //docClinicName = docClinicName.Remove(commaIndex, docClinicName.Length - commaIndex);
             *
             *      ClinicTitle.Text = "Dr. " + docClinicName + "'s Clinic";
             * }*/

            // get user name
            UserDa             da = new UserDa();
            SecurityController sc = new SecurityController();

            DataSet ds = da.GetByUserName(sc.GetUserName());

            if (ds.Tables[0].Rows.Count == 1)
            {
                CurrentClinicUser.Text = ds.Tables[0].Rows[0]["UserFirstName"].ToString() + " " + ds.Tables[0].Rows[0]["UserLastName"].ToString();
            }
        }
Beispiel #4
0
        /// <summary>
        /// Creates list of tabs names that should be available to user based on the user group(s)
        /// </summary>
        /// <param name="datasetIdVal">datasetId</param>
        public string SetGroupViewCode(int datasetId, string userName)
        {
            UserDa uda = new UserDa();

            DataSet uds    = uda.GetByUserName(userName); //TODO: replace this with call to GetUserId and set output variable UserId
            int     userId = int.Parse(uds.Tables[0].Rows[0][User.UserId].ToString());

            GroupDa da = new GroupDa();
            DataSet ds = da.GetGroupAccessCode(userId, datasetId);

            List <string> tabs = new List <string>();

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                foreach (string s in row[Group.GroupAccessCode].ToString().Split(','))
                {
                    if (!tabs.Contains(s))
                    {
                        tabs.Add(s);
                    }
                }
            }

            // TODO: merge tabs

            //StringBuilder sb = new StringBuilder();
            // TODO: this ALWAYS RETURNS ONE COMMA Deliminated ROW. Don't need all of the below
            // user may be part of many groups and access to tabs must be cumulative

            /*
             * foreach (DataRow dr in ds.Tables[0].Rows)
             * {
             *  sb.Append(dr[Group.GroupAccessCode].ToString());
             * }
             *
             * string[] tabNameList = sb.ToString().Split(new Char[] { ',' });
             *
             * string showTabs = "";
             *
             * // now remove duplicates from list
             *
             * foreach (string s in tabNameList)
             * {
             *  if (showTabs.IndexOf(s) == -1)
             *  {
             *      showTabs += s;
             *  }
             * }
             */
            // in v 4.1 this method moved to UserController for access by other pages. Session references removed.
            //Session[SessionKey.GroupViewCode] = showTabs;
            //string tabs = ds.Tables[0].Rows[0][Group.GroupAccessCode].ToString();

            return(string.Join(",", tabs.ToArray()));
        }
Beispiel #5
0
        private void SetPageTitles(bool IsEFormApproved)
        {
            if (IsEFormApproved)
            {
                NavTitle.Text = "Print Narrative";

                string approvedBy   = "";
                string approvedTime = "";
                string userRealName = "";

                // get the user who approved form and date
                EFormsDa da = new EFormsDa();

                DataSet ds = da.GetEformsRecord(base.EFormId);

                if (ds.Tables[0].Rows.Count == 1)
                {
                    approvedBy   = ds.Tables[0].Rows[0][EForm.UpdatedBy].ToString();
                    approvedTime = ds.Tables[0].Rows[0][EForm.UpdatedTime].ToString();

                    UserDa  userda = new UserDa();
                    DataSet userds = userda.GetByUserName(approvedBy);

                    userRealName = userds.Tables[0].Rows[0]["UserFirstName"].ToString() + " " + userds.Tables[0].Rows[0]["UserLastName"].ToString();
                }

                if (Session[SessionKey.PtFirstName] != null && Session[SessionKey.PtFirstName].ToString().Length > 0)
                {
                    NavTitle.Text += " for " + Session[SessionKey.PtFirstName].ToString();
                }

                if (Session[SessionKey.PtLastName] != null && Session[SessionKey.PtLastName].ToString().Length > 0)
                {
                    NavTitle.Text += " " + Session[SessionKey.PtLastName].ToString();
                }

                UserMsg.Text = "<span class=\"EFormAlertMsg\">This eform has been APPROVED by " + userRealName + " on " + approvedTime + " and is no longer available for update.</span><br/><br/><br/><br/>To print the narrative use the button located on the bottom right of this page.";
            }
            else
            {
                NavTitle.Text = "Approve Narrative";

                if (Session[SessionKey.PtFirstName] != null && Session[SessionKey.PtFirstName].ToString().Length > 0)
                {
                    NavTitle.Text += " for " + Session[SessionKey.PtFirstName].ToString();
                }

                if (Session[SessionKey.PtLastName] != null && Session[SessionKey.PtLastName].ToString().Length > 0)
                {
                    NavTitle.Text += " " + Session[SessionKey.PtLastName].ToString();
                }

                UserMsg.Text = "If all data is accurate approve the eform using the button on the lower right. Once approved you will no longer be able to update the eform.<br><br>After approval, the narrative will remain available for printing.";
            }
        }
Beispiel #6
0
        public int GetTabCount(int datasetId, string userName)
        {
            // TODO: should just use SetGroupViewCode; parse the string array on the .aspx page so you can use the tab count; dont need this method
            UserDa  uda    = new UserDa();
            DataSet uds    = uda.GetByUserName(userName); //TODO: replace this with call to GetUserId and set output variable UserId
            int     userId = int.Parse(uds.Tables[0].Rows[0][User.UserId].ToString());

            GroupDa da   = new GroupDa();
            DataSet ds   = da.GetGroupAccessCode(userId, datasetId);
            string  tabs = ds.Tables[0].Rows[0][Group.GroupAccessCode].ToString();

            string[] tabNameList = tabs.ToString().Split(new Char[] { ',' });
            return(tabNameList.Length);
        }
Beispiel #7
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            txtTo.ReadOnly           = true;
            MailForm.Visible         = true;
            sentMessageTable.Visible = false;

            if (Page.IsPostBack)
            {
                if (txtFrom.Text != null && txtFrom.Text.Length > 0)
                {
                    this.btnSend_Click(sender, e);

                    MailForm.Visible         = false;
                    sentMessageTable.Visible = true;
                }

/*				else
 *                              {
 *                                      ErrorMsg.Text = "Please enter a valid email address in the 'from' field.";
 *                              }
 */
            }
            else
            {
                //
                if (Request.QueryString["userError"] != null && Request.QueryString["userError"].Length > 0 && Request.QueryString["userError"] == "true")
                {
                    txtSubject.Text = "Caisis Error Report";
                }

                UserDa  user = new UserDa();
                DataSet ds   = user.GetByUserName(User.Identity.Name);

                //populate from address
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string emailAddress = ds.Tables[0].Rows[0]["UserEmail"].ToString();
                    fromFName.Value = ds.Tables[0].Rows[0]["UserFirstName"].ToString();
                    fromLName.Value = ds.Tables[0].Rows[0]["UserLastName"].ToString();
                    fromUName.Value = ds.Tables[0].Rows[0]["UserName"].ToString();
                    if (emailAddress != null && !emailAddress.Equals(""))
                    {
                        txtFrom.Text     = emailAddress;
                        txtFrom.ReadOnly = true;
                    }
                }

                txtTo.Text = CaisisConfiguration.GetWebConfigValue("adminEmail");
            }
        }
Beispiel #8
0
        /// <summary>
        /// when eform has already been approved redirects user to the clinic list
        /// </summary>
        private void CheckEFormApproval()
        {
            EFormController ect = new EFormController();

            string status = ect.GetEFormStatus(_eformId);

            if (status.Equals(EformStatusManager.Status_Approved))
            {
                string approvedBy   = "";
                string approvedTime = "";
                string userRealName = "";

                // get the user who approved form and date
                EFormsDa da = new EFormsDa();

                DataSet ds = da.GetEformsRecord(_eformId);

                if (ds.Tables[0].Rows.Count == 1)
                {
                    approvedBy   = ds.Tables[0].Rows[0][EForm.UpdatedBy].ToString();
                    approvedTime = ds.Tables[0].Rows[0][EForm.UpdatedTime].ToString();

                    UserDa  userda = new UserDa();
                    DataSet userds = userda.GetByUserName(approvedBy);

                    userRealName = userds.Tables[0].Rows[0]["UserFirstName"].ToString() + " " + userds.Tables[0].Rows[0]["UserLastName"].ToString();
                }

                string jsScript = "<script language=javascript>alert('This eform was approved by " + userRealName + " on " + approvedTime + " and can no longer be updated.\\n\\n You will now be redirected to the clinic list'); top.location.href = 'Index.aspx?status=home';</script>";

                Response.Write(jsScript);
            }
            // submit parent frame with data
            else
            {
                // js script from parent page passes in url var when it should submit
                if (Request.QueryString["submitMe"] != null && Request.QueryString["submitMe"].ToString().ToLower().Equals("true"))
                {
                    //submitMe()
                    string jsScript = "<script language=javascript>parent.submitMe();</script>";

                    Response.Write(jsScript);
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// If user has eforms pending display icon to reminders inbox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SetInboxImage(object sender, EventArgs e)
        {
            string userName = new SecurityController().GetUserName();

            UserDa  uda = new UserDa();
            DataSet uDs = uda.GetByUserName(userName);

            int userId = int.Parse(uDs.Tables[0].Rows[0]["UserId"].ToString());

            EFormsDa iDa = new EFormsDa();
            // string status = "'" + Caisis.UI.Core.Eforms.EformStatusManager.Status_DataEntryInProgress + "','" + Caisis.UI.Core.Eforms.EformStatusManager.Status_DataEntryReviewed + "'";
            string  status = "'" + EformStatusManager.Status_DataEntryInProgress + "'";
            DataSet iDs    = iDa.GetEformsInbox(userId, status);

            if (!(iDs != null && iDs.Tables.Count > 0 && iDs.Tables[0].Rows.Count > 0))
            {
                //splashKioskInbox.Src="../../Images/splashOptionsYouHaveMessages.gif";
                splashKioskInbox.Visible = false;
            }
        }
Beispiel #10
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (Request.QueryString["toUser"] != null && Request.QueryString["toUser"].ToString() != "")
            {
                toUserName = Request.QueryString["toUser"].ToString();

                // emails regarding datafeed records are sent to the admin
                if (toUserName.ToUpper().StartsWith("DATAFEED"))
                {
                    toUserEmail    = CaisisConfiguration.GetWebConfigValue("adminEmail");
                    txtTo.Text     = "Caisis Administrators";
                    txtTo.ReadOnly = true;
                    noToEmail      = false;
                    toDataFeed     = true;
                }
                else
                {
                    UserDa  toUser   = new UserDa();
                    DataSet toUserDs = toUser.GetByUserName(toUserName);

                    //populate to address
                    if (toUserDs.Tables[0].Rows.Count > 0)
                    {
                        bool activeUser = false;
                        if ((toUserDs.Tables[0].Rows[0][BOL.User.DeactivatedTime] == null) || (toUserDs.Tables[0].Rows[0][BOL.User.DeactivatedTime].ToString().Length < 1))
                        {
                            activeUser = true;
                        }
                        else
                        {
                            deactivatedToUser = true;
                        }


                        string emailAddress = toUserDs.Tables[0].Rows[0]["UserEmail"].ToString();
                        toFirstName = toUserDs.Tables[0].Rows[0]["UserFirstName"].ToString();
                        toLastName  = toUserDs.Tables[0].Rows[0]["UserLastName"].ToString();


                        if (emailAddress == null || emailAddress.Equals(""))
                        {
                            noToEmail = true;
                        }



                        if (activeUser == true && noToEmail == false)
                        {
                            toUserEmail    = emailAddress;
                            txtTo.Text     = toFirstName + " " + toLastName + " (email not shown)";
                            txtTo.ReadOnly = true;
                        }
                        else if (deactivatedToUser)
                        {
                            toUserEmail    = CaisisConfiguration.GetWebConfigValue("adminEmail");
                            txtTo.Text     = "Caisis Administrator";
                            txtTo.ReadOnly = true;
                        }
                        else if (noToEmail)// active but no email address
                        {
                            toUserEmail    = CaisisConfiguration.GetWebConfigValue("adminEmail");
                            txtTo.Text     = "Caisis Administrator";
                            txtTo.ReadOnly = true;
                        }
                    }
                    // no user identified
                    else
                    {
                        toUserEmail = CaisisConfiguration.GetWebConfigValue("adminEmail");
                        noToEmail   = true;
                    }
                }
            }

            txtSubject.Text = "Locked Record in Caisis";


            MailForm.Visible         = true;
            sentMessageTable.Visible = false;

            if (Page.IsPostBack)
            {
                this.btnSend_Click(sender, e);

                MailForm.Visible         = false;
                sentMessageTable.Visible = true;
            }
            else
            {
                UserDa  user = new UserDa();
                DataSet ds   = user.GetByUserName(User.Identity.Name);

                //populate from address
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string emailAddress = ds.Tables[0].Rows[0]["UserEmail"].ToString();
                    fromFName.Value = ds.Tables[0].Rows[0]["UserFirstName"].ToString();
                    fromLName.Value = ds.Tables[0].Rows[0]["UserLastName"].ToString();
                    if (emailAddress != null && !emailAddress.Equals(""))
                    {
                        txtFrom.Text     = emailAddress;
                        txtFrom.ReadOnly = true;
                    }
                }
            }
        }
Beispiel #11
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            //rGen = new Random();

            FormTable.Visible = true;
            SentTable.Visible = false;

            if (Page.IsPostBack)
            {
                if (Request.Form["userName"] != null && Request.Form["userName"].ToString().Length > 0)
                {
                    FormTable.Visible = false;
                    SentTable.Visible = true;

                    //take username and get password
                    UserDa  da = new UserDa();
                    DataSet ds = da.GetByUserName(userName.Value);


                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        string userStatus = da.GetUserStatus(userName.Value);
                        if (userStatus.Equals("Valid"))
                        {
                            string userEmail     = ds.Tables[0].Rows[0]["UserEmail"].ToString();
                            string userFirstName = ds.Tables[0].Rows[0]["UserFirstName"].ToString();
                            string userLastName  = ds.Tables[0].Rows[0]["UserLastName"].ToString();

                            //set new password in database
                            string newPassword = this.SetRandomPassword(userEmail);

                            if (!newPassword.Equals("false"))
                            {
                                //email new random password
                                this.EmailNewPassword(userEmail, userFirstName, userLastName, newPassword);

                                emailMessage.Text = "An email with a new password has been sent to " + userEmail + ".\n\n<br>Please update this password on first login. Thank you.";
                            }
                            else
                            {
                                //update of password failed
                                emailMessage.Text = "There was a problem updating your password. Please contact " + CaisisConfiguration.GetWebConfigValue("adminEmail") + " to request a new password.";
                            }
                        }
                        else if (userStatus.Equals("InvalidDeactivated"))
                        {
                            //Deactivated user
                            emailMessage.Text = "User has been deactivated. Please contact " + CaisisConfiguration.GetWebConfigValue("adminEmail") + ".";
                        }
                        else
                        {
                            //InvalidUnknown. InvalidUsername should never get here because of 'if(ds.Tables[0].Rows.Count > 0)' above.
                            emailMessage.Text = "There was an unknown problem updating your password. Please contact " + CaisisConfiguration.GetWebConfigValue("adminEmail") + " to request a new password.";
                        }
                    }
                    else
                    {
                        emailMessage.Text = "The username you entered does not have an email address on file. Please contact the Administrator to obtain a new password.";
                    }

                    ValidationMsg.Visible = false;
                }
                else
                {
                    ValidationMsg.InnerText = "You must enter your username to request a new password.";
                }
            }
        }
        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();
                        }
                    }
                }
            }
        }