private void LogUserLoginHistory(string userName, int cchId, string connString)
        {
            using (InsertUserLoginHistory iulh = new InsertUserLoginHistory()) {
                string         aspNetUserName = "******".GetConfigurationValue();
                MembershipUser mu             = Membership.GetUser(aspNetUserName, true);
                if (mu != null)
                {
                    if (mu.ProviderUserKey != null)
                    {
                        Request.UserID(mu.ProviderUserKey.ToString());
                    }
                }

                if (!string.IsNullOrEmpty(userName))
                {
                    mu = Membership.GetUser(userName, true);
                    if (mu != null)
                    {
                        aspNetUserName = userName;
                        if (mu.ProviderUserKey != null)
                        {
                            Request.UserID(mu.ProviderUserKey.ToString());
                        }
                    }
                }
                Request.UserName(aspNetUserName);

                iulh.UserName         = Request.UserName();
                iulh.CCHID            = cchId;
                iulh.Domain           = Request.RequestUri.Host;
                iulh.CchApplicationId = 2;  // 1 is for Transparency App; 2 is for HR App
                iulh.PostData(connString);
            }
        }
Exemple #2
0
        protected void ContinueAsEmployee(object sender, EventArgs e)
        {
            if (gvUsers.SelectedIndex > -1)
            {
                LoadUserEmployerSessionInfo();

                using (GetPasswordQuestions gpq = new GetPasswordQuestions())
                {
                    if (!gpq.PutInSession())
                    {
                        ThisSession.CurrentAvailableSecurityQuestions = new[] { "none" };
                    }
                }

                using (InsertUserLoginHistory iulh = new InsertUserLoginHistory())
                {
                    iulh.UserName     = Membership.GetUserNameByEmail(ThisSession.PatientEmail);
                    iulh.CallCenterID = Membership.GetUser().ProviderUserKey.ToString();
                    iulh.Domain       = Request.Url.Host;
                    iulh.PostData();
                    if (!iulh.HasErrors && iulh.RowsBack != 1)
                    {
                        //In the event this fails or either 0 or more than one row is effected
                        //NOTIFY LAURA :)
                    }
                    ThisSession.UserLogginID = Membership.GetUser().ProviderUserKey.ToString();
                    ThisSession.LoggedIn     = true;
                }
                Response.Redirect("~/SearchInfo/Search.aspx#tabcare");
            }
        }
Exemple #3
0
 /// <summary>
 ///  This method will not work at this time because we do not have an AspNet User Id to log this event against
 /// </summary>
 /// <param name="handshakeId"></param>
 /// <param name="absUri"></param>
 /// <param name="cchid"></param>
 /// <param name="cx"></param>
 private void CreateLoginAudit(string handshakeId, string absUri, int cchid, string cx)
 {
     using (var iulh = new InsertUserLoginHistory())
     {
         iulh.UserName         = handshakeId;
         iulh.Domain           = string.Format("{0}:{1}", absUri, cchid);
         iulh.CchApplicationId = 2;  // 1 is for Transparency App; 2 is for HR App
         iulh.PostData(cx);
     }
 }
 private void CreateLoginAudit(string UN, string D, int cchid, string cx)
 {
     using (InsertUserLoginHistory iulh = new InsertUserLoginHistory())
     {
         iulh.UserName         = UN;
         iulh.Domain           = D;
         iulh.CCHID            = cchid;
         iulh.CchApplicationId = 2;  // 1 is for Transparency App; 2 is for HR App
         iulh.PostData(cx);
     }
 }
Exemple #5
0
 private void CaptureRegistrationLogin()
 {
     using (InsertUserLoginHistory iulh = new InsertUserLoginHistory())
     {
         iulh.UserName = cuwReview.UserName;
         iulh.PostData();
         if (!iulh.HasErrors && iulh.RowsBack != 1)
         {
             //In the event this fails or either 0 or more than one row is effected
             //NOTIFY LAURA :)
         }
     }
 }
Exemple #6
0
        protected void MainLogin_LoggedIn(object sender, EventArgs e)
        {
            String  mlUN         = MainLogin.UserName.Trim();
            Boolean IsCustomer   = Roles.IsUserInRole(mlUN, "Customer"),
                    IsCallCenter = Roles.IsUserInRole(mlUN, "CallCenter"),
                    IsAdmin      = Roles.IsUserInRole(mlUN, "Admin"),
                    IsManagement = Roles.IsUserInRole(mlUN, "Management"),
                    IsDebugUser  = Roles.IsUserInRole(mlUN, "DebugUser");

            bool iqComplete; string lastIQUrl;

            if (IsCustomer)
            {
                using (TextBox userName = (MainLogin.FindControl("UserName") as TextBox))
                {
                    String sUN = Encoder.HtmlEncode(userName.Text.Trim());

                    ThisSession.UserLogginID = Membership.GetUser(sUN).ProviderUserKey.ToString();
                    ThisSession.LoggedIn     = true;

                    LoadUserSessionInfo();
                    //LoadUserEmployerSessionInfo();
                    iqComplete = LoadUserEmployerSessionInfo(out lastIQUrl);
                    LoadEmployerContent();

                    using (GetPasswordQuestions gpq = new GetPasswordQuestions())
                    {
                        if (!gpq.PutInSession())
                        {
                            ThisSession.CurrentAvailableSecurityQuestions = new[] { "none" };
                        }
                        ThisSession.CurrentSecurityQuestion = Membership.GetUser(sUN).PasswordQuestion;
                    }
                    using (InsertUserLoginHistory iulh = new InsertUserLoginHistory())
                    {
                        iulh.UserName = Membership.GetUserNameByEmail(ThisSession.PatientEmail);
                        iulh.Domain   = Request.Url.Host;
                        if (IsDebugUser)
                        {
                            iulh.CallCenterID = Guid.Empty.ToString();
                        }
                        iulh.PostData();
                    }
                    if (ThisSession.SavingsChoiceEnabled)
                    {
                        if (!iqComplete)
                        {
                            if (lastIQUrl == null || lastIQUrl == "null" || lastIQUrl.Trim() == "" || lastIQUrl == "error")
                            {
                                Response.Redirect("~/SavingsChoice/SavingsChoiceWelcome.aspx");
                            }
                            else
                            {
                                Response.Redirect("~/SavingsChoice/" + lastIQUrl);
                            }
                        }
                    }
                }
                if (Request.QueryString.AllKeys.Contains("dest"))
                {
                    HttpContext.Current.Session["requestedTab"] = Encoder.HtmlEncode(Request.QueryString["dest"]);
                }
            }
            else if (IsCallCenter)
            {
                Response.Redirect(ResolveUrl("~/CallCenter/Default.aspx"));
            }
            else if (IsAdmin && !IsManagement)
            {
                using (InsertUserLoginHistory iulh = new InsertUserLoginHistory())
                {
                    iulh.UserName = Membership.GetUserNameByEmail(ThisSession.PatientEmail);
                    iulh.Domain   = Request.Url.Host;
                    iulh.PostData();
                    if (!iulh.HasErrors && iulh.RowsBack != 1)
                    {
                    }
                }
                Response.Redirect("~/Admin/Default.aspx");
            }
            else if (IsManagement && !IsAdmin)
            {
                Response.Redirect("~/ContentManagement/Default.aspx");
            }
            else if (IsManagement && IsAdmin)
            {
                Response.Redirect("~/AdminPortal/Default.aspx");
            }
        }
        public HttpResponseMessage PostHash(String hsID, [FromBody] HandshakeRequest hsRequest)
        {
            Handshake  h = new Handshake();
            Boolean    providerActive = false, providerIsPartner = false;
            int        employerID = 0;
            string     cnxString  = "";
            CCHEncrypt e          = new CCHEncrypt();

            using (ValidateMobilePartner vmp = new ValidateMobilePartner(hsID, hsRequest.OrganizationID))
            {
                vmp.ForEachProvider(delegate(Boolean valid, Boolean isPartner, int empId, string cnx, string un)
                {
                    providerActive    = valid;
                    providerIsPartner = isPartner;
                    employerID        = empId;
                    cnxString         = cnx;
                    Request.UserName(un);
                    MembershipUser mu = Membership.GetUser(un, true);
                    Request.UserID(mu.ProviderUserKey.ToString());
                });
            }

            if (providerActive && providerIsPartner)
            {
                e.UserKey   = Request.EncryptionKey();
                e.SecretKey = Properties.Settings.Default.SecretKey;
                e.Add("UserID", Request.UserID());

                e.Add("EmployerID", employerID.ToString());
                using (GetPartnerEmployeeInfoByName gpeibn = new GetPartnerEmployeeInfoByName())
                {
                    gpeibn.FirstName           = hsRequest.FirstName;
                    gpeibn.LastName            = hsRequest.LastName;
                    gpeibn.DOB                 = hsRequest.DOB;
                    gpeibn.SubscriberMedicalID = hsRequest.MedicalID;
                    //gpeibn.RelationshipCode = hsRequest.RelationshipCode;

                    gpeibn.GetData(cnxString);

                    if (gpeibn.Tables.Count == 0 ||
                        gpeibn.Tables[0].Rows.Count == 0 ||
                        gpeibn.Tables[0].Rows[0][0].ToString() == string.Empty)
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NoContent, new Exception("User Not Found")));
                    }

                    //UserAccess Check dstrickland 7/8/2015
                    using (var cpaa = new CheckPersonApplicationAccess(gpeibn.CCHID, cnxString))
                    {
                        if (!cpaa.HasAccess)
                        {
                            return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized,
                                                               new Exception(cpaa.ErrorMessage)));
                        }
                    }

                    e.Add("CCHID", gpeibn.CCHID.ToString());
                    gpeibn.ForEach <Handshake.EmployeeInfoData>(
                        delegate(Handshake.EmployeeInfoData eid)
                    {
                        h.EmployeeInfo = eid;
                    }
                        );

                    //CreateLoginAudit(Request.UserName(), Request.RequestUri.Host.ToString(), gpeibn.CCHID, cnxString);
                    using (InsertUserLoginHistory iulh = new InsertUserLoginHistory())
                    {
                        iulh.UserName         = Request.UserName();
                        iulh.CCHID            = gpeibn.CCHID;
                        iulh.Domain           = Request.RequestUri.Host;
                        iulh.CchApplicationId = 2;  // 1 is for Transparency App; 2 is for HR App
                        iulh.PostData(cnxString);
                    }
                }

                h.AuthHash = e.ToString();
                return(this.Request.CreateResponse <Handshake>(HttpStatusCode.OK, h));
            }
            else
            {
                return(this.Request.CreateResponse(HttpStatusCode.Unauthorized));
            }
        }
Exemple #8
0
 private void CaptureRegistrationLogin()
 {
     using (InsertUserLoginHistory iulh = new InsertUserLoginHistory())
     {
         iulh.UserName = cuwReview.UserName;
         iulh.PostData();
         if (!iulh.HasErrors && iulh.RowsBack != 1)
         {
             //In the event this fails or either 0 or more than one row is effected
             //NOTIFY LAURA :)
         }
     }
 }
Exemple #9
0
        protected void MainLogin_LoggedIn(object sender, EventArgs e)
        {
            String mlUN = MainLogin.UserName.Trim();
            Boolean IsCustomer = Roles.IsUserInRole(mlUN, "Customer"),
                IsCallCenter = Roles.IsUserInRole(mlUN, "CallCenter"),
                IsAdmin = Roles.IsUserInRole(mlUN, "Admin"),
                IsManagement = Roles.IsUserInRole(mlUN, "Management"),
                IsDebugUser = Roles.IsUserInRole(mlUN, "DebugUser");

            bool iqComplete; string lastIQUrl;

            if (IsCustomer)
            {
                using (TextBox userName = (MainLogin.FindControl("UserName") as TextBox))
                {
                    String sUN = Encoder.HtmlEncode(userName.Text.Trim());

                    ThisSession.UserLogginID = Membership.GetUser(sUN).ProviderUserKey.ToString();
                    ThisSession.LoggedIn = true;

                    LoadUserSessionInfo();
                    //LoadUserEmployerSessionInfo();
                    iqComplete = LoadUserEmployerSessionInfo(out lastIQUrl);
                    LoadEmployerContent();

                    using (GetPasswordQuestions gpq = new GetPasswordQuestions())
                    {
                        if (!gpq.PutInSession())
                        {
                            ThisSession.CurrentAvailableSecurityQuestions = new[] { "none" };
                        }
                        ThisSession.CurrentSecurityQuestion = Membership.GetUser(sUN).PasswordQuestion;
                    }
                    using (InsertUserLoginHistory iulh = new InsertUserLoginHistory())
                    {
                        iulh.UserName = Membership.GetUserNameByEmail(ThisSession.PatientEmail);
                        iulh.Domain = Request.Url.Host;
                        if (IsDebugUser) { iulh.CallCenterID = Guid.Empty.ToString(); }
                        iulh.PostData();
                    }
                    if (ThisSession.SavingsChoiceEnabled)
                    {
                        if (!iqComplete)
                            if (lastIQUrl == null || lastIQUrl == "null" || lastIQUrl.Trim() == "" || lastIQUrl == "error")
                                Response.Redirect("~/SavingsChoice/SavingsChoiceWelcome.aspx");
                            else
                                Response.Redirect("~/SavingsChoice/" + lastIQUrl);
                    }
                }
                if (Request.QueryString.AllKeys.Contains("dest"))
                    HttpContext.Current.Session["requestedTab"] = Encoder.HtmlEncode( Request.QueryString["dest"] );
            }
            else if (IsCallCenter)
            {
                Response.Redirect(ResolveUrl("~/CallCenter/Default.aspx"));
            }
            else if (IsAdmin && !IsManagement)
            {
                using (InsertUserLoginHistory iulh = new InsertUserLoginHistory())
                {
                    iulh.UserName = Membership.GetUserNameByEmail(ThisSession.PatientEmail);
                    iulh.Domain = Request.Url.Host;
                    iulh.PostData();
                    if (!iulh.HasErrors && iulh.RowsBack != 1)
                    { }
                }
                Response.Redirect("~/Admin/Default.aspx");
            }
            else if (IsManagement && !IsAdmin)
            {
                Response.Redirect("~/ContentManagement/Default.aspx");
            }
            else if (IsManagement && IsAdmin)
            {
                Response.Redirect("~/AdminPortal/Default.aspx");
            }
        }
Exemple #10
0
        public HttpResponseMessage GetHash(String hsID)
        {
            HandshakeMobile h = new HandshakeMobile();
            Boolean         providerActive = false;
            CCHEncrypt      e = new CCHEncrypt();

            using (ValidateMobileProvider vmp = new ValidateMobileProvider(hsID))
                vmp.ForEachProvider(delegate(Boolean valid) { if (valid)
                                                              {
                                                                  providerActive = true;
                                                              }
                                    });

            if (providerActive)
            {
                e.UserKey   = Request.EncryptionKey();
                e.SecretKey = Properties.Settings.Default.SecretKey;
                e.Add("UserID", Request.UserID());

                using (GetKeyUserInfo gkui = new GetKeyUserInfo(Request.UserName()))
                {
                    e.Add("EmployerID", gkui.EmployerID);
                    h.EmployerName = gkui.EmployerName;
                    using (GetKeyEmployeeInfo gkei = new GetKeyEmployeeInfo())
                    {
                        //UserAccess Check dstrickland 7/8/2015
                        using (var cpaa = new CheckPersonApplicationAccess(gkei.CCHID, gkui.CnxString))
                        {
                            if (!cpaa.HasAccess)
                            {
                                return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized,
                                                                   new Exception(cpaa.ErrorMessage)));
                            }
                        }

                        gkei.Email = Request.UserName();
                        gkei.GetData(gkui.CnxString);
                        e.Add("CCHID", gkei.CCHID.ToString());
                        gkei.ForEach <HandshakeMobile.EmployeeInfoData>(
                            delegate(HandshakeMobile.EmployeeInfoData eid)
                        {
                            h.EmployeeInfo = eid;
                        }
                            );
                    }
                }

                using (GetEmployerConnString gecs = new GetEmployerConnString(Convert.ToInt32(e["EmployerID"])))
                {
                    using (InsertUserLoginHistory iulh = new InsertUserLoginHistory())
                    {
                        iulh.UserName         = Request.UserName();
                        iulh.Domain           = Request.RequestUri.Host;
                        iulh.CchApplicationId = 2;  // 1 is for Transparency App; 2 is for HR App
                        iulh.PostData(gecs.ConnString);
                    }
                }

                h.AuthHash = e.ToString();
                return(this.Request.CreateResponse <HandshakeMobile>(HttpStatusCode.OK, h));
            }
            else
            {
                return(this.Request.CreateResponse(HttpStatusCode.NoContent));
            }
        }
Exemple #11
0
        protected void ContinueAsEmployee(object sender, EventArgs e)
        {
            if (gvUsers.SelectedIndex > -1)
            {
                LoadUserEmployerSessionInfo();

                using (GetPasswordQuestions gpq = new GetPasswordQuestions())
                {
                    if (!gpq.PutInSession())
                    {
                        ThisSession.CurrentAvailableSecurityQuestions = new[] { "none" };
                    }
                }

                using (InsertUserLoginHistory iulh = new InsertUserLoginHistory())
                {
                    iulh.UserName = Membership.GetUserNameByEmail(ThisSession.PatientEmail);
                    iulh.CallCenterID = Membership.GetUser().ProviderUserKey.ToString();
                    iulh.Domain = Request.Url.Host;
                    iulh.PostData();
                    if (!iulh.HasErrors && iulh.RowsBack != 1)
                    {
                        //In the event this fails or either 0 or more than one row is effected
                        //NOTIFY LAURA :)
                    }
                    ThisSession.UserLogginID = Membership.GetUser().ProviderUserKey.ToString();
                    ThisSession.LoggedIn = true;
                }
                Response.Redirect("~/SearchInfo/Search.aspx#tabcare");
            }
        }