MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/www/mps/Patient_Login.ascx.vb
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Security
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Text.RegularExpressions
Imports InvoiceCloudWS


Partial Class Patient_Login
    Inherits System.Web.UI.UserControl


#Region "Global_Variables"
    '**********************************************************************************************************************************************************'
    ' ****SET Global Variables for Class 
    '**********************************************************************************************************************************************************'
    Private DebugMode As Boolean = ConfigurationManager.AppSettings.Item("Debug_Mode")
    Private CustomerPaymentURL As String = "?"
    Private ClientCustomPhone As String = "1-866-270-8965"
    Dim loginresult As String
    Private ConnStringName As String
    Private exlog As New clsDBData
#End Region


#Region "User_Control_Properties"


    Sub sbGetSet_hlink_invoicecloud(ByRef vHref As String, ByRef vInnerHTML As String, ByRef vTarget As String, Optional GetSet_Mode As String = "GET")
        If GetSet_Mode = "GET" Then
            vHref = linktoinvoicecloud.HRef
            vInnerHTML = linktoinvoicecloud.InnerHtml
            vTarget = linktoinvoicecloud.Target
        ElseIf GetSet_Mode = "SET" Then
            linktoinvoicecloud.HRef = vHref
            linktoinvoicecloud.InnerHtml = vInnerHTML
            linktoinvoicecloud.Target = vTarget
        End If
    End Sub


#End Region


#Region "Pop_Commands"

    Public Sub ShowPopup()
        modal_pop.Show()
    End Sub

    Public Sub Closepopup()
        modal_pop.Hide()
    End Sub

#End Region



#Region "Standard_Functions"

    Protected Sub jsOpenNewWindow(ByVal URL_Link As String)
        ' Get the URL link and set javascript block to open in new tab/window.

        ' (2017.11.10) - I set the jscript block as a string to return to the master page to allow the page to 
        ' refresh first to handle some of the actions that needed to happen.  the master page takes the session
        ' value and runs the jscript block on page load once (and clears the session value out so it does not continue).
        ' otherwise can use uncomment the scriptmanager.registerstartupscript line.  NOTE: the scriptmanager call must be
        ' used when running jscript from server side within a Web User control, otherwise would be page.clientscript
        If URL_Link <> "" Then
            Dim sb As New StringBuilder
            'Dim URL_Link As String = "https://www.invoicecloud.com/mps"
            sb.Clear()
            sb.Append("<script language='javascript' type='text/javascript'>")
            'sb.Append("window.open('" & URL_Link & "', '_blank');")
            If Session("GoToAction") IsNot Nothing Then
                If Session("GoToAction") = 1 Then
                    sb.Append("open_pop_win('" & URL_Link & "', 'paybill');")
                ElseIf Session("GoToAction") = 2 Then
                    sb.Append("open_pop_win('" & URL_Link & "', 'statement');")
                ElseIf Session("GoToAction") = 3 Then
                    sb.Append("open_pop_win('" & URL_Link & "', 'receipt');")
                Else
                    sb.Append("open_pop_win('" & URL_Link & "', '');")
                End If
            End If
            sb.Append("</script>")
            'ScriptManager.RegisterStartupScript(Page, Me.GetType(), "Startup", sb.ToString, False)
            Session("jsOpenNewWindow") = sb.ToString
        End If
    End Sub

    Public Function BaseURL(Optional ByVal includeslash As Boolean = True) As String
        Dim base_URL As String = ""
        Dim base_URL2 As String = Request.Url.GetLeftPart(UriPartial.Authority)

        If includeslash = True Then
            base_URL = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd("/") + "/"
        Else
            base_URL = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd("/")
        End If

        Return base_URL
    End Function


#End Region



#Region "Validate_Login"

    Public Sub Validate_Login(ByVal vPmtCode As String, ByVal vLastName As String, Optional AutoLogin As Boolean = False, Optional ActionLink As Integer = 1)

        Dim vUtility As New clsUtility
        Dim vDBData As New clsDBData
        Dim vPayment_Code As String = vPmtCode
        Dim vGuar_LastName As String = vLastName

        Try
            Dim ds As DataSet = New DataSet()
            ds = vDBData.GetDT_ProviderData_ByPmtCode(vPayment_Code, vGuar_LastName, "")

            ' verify the user had successful return if there is a value in the customer name field and a value in client name
            If ds.Tables(0).Rows(0)("ClientName").ToString() <> "" And ds.Tables(0).Rows(0)("CustomerName").ToString() <> "" Then
                FormsAuthentication.SetAuthCookie(vPayment_Code, False)

                Session("PageData") = ds
                ' ---- Set session variables for use in the Olark Chat --------------------------------------------------------------------'
                If AutoLogin Then
                    Session("CustomerName") = String.Format("{0} FAQ REVIEW", ds.Tables(0).Rows(0)("ClientName").ToString())
                Else
                    Session("CustomerName") = String.Format("{0} ({1})", ds.Tables(0).Rows(0)("CustomerName").ToString(), ds.Tables(0).Rows(0)("ClientName").ToString())
                    Session("CustomerEmailAddress") = ds.Tables(0).Rows(0)("CustomerEmailAddress").ToString()
                End If
                Session("Login_PmtCode") = vPayment_Code
                Session("CustomerValidationCode") = ds.Tables(0).Rows(0)("CustomerValidationCode").ToString()
                Session("CustomerPaymentCode") = ds.Tables(0).Rows(0)("CustomerPaymentCode")
                '-------------------------------------------------------------------------------------------------------------------------'
                Session("ShowSurveyInd") = ds.Tables(0).Rows(0)("ShowSurveyInd")
                Session("FinancialAssistanceTitle") = ds.Tables(0).Rows(0)("FinancialAssistanceTitle").ToString()
                Session("FinancialAssistanceFileName") = ds.Tables(0).Rows(0)("FinancialAssistanceFileName").ToString()
                Session("CustomColor1") = ds.Tables(0).Rows(0)("ClientColor1")
                Session("CustomColor2") = ds.Tables(0).Rows(0)("ClientColor2")
                Session("CustomColor3") = ds.Tables(0).Rows(0)("ClientColor3")
                Session("ClientId") = CInt(ds.Tables(0).Rows(0)("ClientId"))

                '-------------------------------------------------------------------------------------------------------------------------'
                Session("AutoLogin_Used") = AutoLogin                                           ' -- Set the session value for if the user auto-logged in or not
                Session("OperatingHours") = ds.Tables(0).Rows(0)("OperatingHours").ToString()   ' -- Set the operating hours to be displayed on home page
                '-------------------------------------------------------------------------------------------------------------------------'


                Dim ws As New InvoiceCloudWS.CloudReporting()
                ws.Url = "https://www.invoicecloud.com/portal/webservices/CloudReporting.asmx?wsdl"
                Dim result As DataSet
                Dim invoiceGuid As String
                Dim billerGuid As String = "2c016966-820b-409c-ab67-e11563bd4a1c"
                Dim webServiceKey As String = "ac8bceb5-1636-49f1-a063-992d1389fec4"
                result = ws.InvoiceSummary(billerGuid, webServiceKey, ds.Tables(0).Rows(0)("CustomerPaymentCode"), ds.Tables(0).Rows(0)("CustomerPaymentCode"))


                If result.Tables.Count > 0 AndAlso result.Tables(0).Rows.Count > 0 AndAlso result.Tables(0).Rows(0)("InvoiceGUID").GetType() Is GetType(System.Guid) Then
                    invoiceGuid = result.Tables(0).Rows(0)("InvoiceGuid").ToString()
                    Session("PaymentSiteURL") = String.Format(“https://www.invoicecloud.com/portal/Customer.aspx?InvoiceGUID={0}&bg={1}”, invoiceGuid, billerGuid)
                Else
                    Session("PaymentSiteURL") = "https://www.invoicecloud.com/mps"
                End If


                ' ---- change the hyperlink URL based on either PayBill or ViewStatement being clicked ------------'
                If ActionLink = 1 Then
                    ' Set the hidden hyperlink with updated payment site URL value
                    If Session("PaymentSiteURL") <> "" Then
                        'Response.Redirect(Session("PaymentSiteURL"), False)
                        linktoinvoicecloud.HRef = Session("PaymentSiteURL")
                        Call jsOpenNewWindow(Session("PaymentSiteURL"))
                    Else
                        'Response.Redirect("https://www.invoicecloud.com/mps", False)
                        linktoinvoicecloud.HRef = "https://www.invoicecloud.com/mps"
                        Call jsOpenNewWindow("https://www.invoicecloud.com/mps")
                    End If
                ElseIf ActionLink = 2 Then
                    linktoinvoicecloud.HRef = "~/ViewStatement.aspx?pc=" + ds.Tables(0).Rows(0)("CustomerPaymentCode") + "&vc=" + Session("CustomerValidationCode")
                    Call jsOpenNewWindow(BaseURL() + "/ViewStatement.aspx?pc=" + ds.Tables(0).Rows(0)("CustomerPaymentCode") + "&vc=" + Session("CustomerValidationCode"))
                ElseIf ActionLink = 3 Then
                    linktoinvoicecloud.HRef = "~/ViewPmtReceipt.aspx?pc=" + ds.Tables(0).Rows(0)("CustomerPaymentCode") + "&vc=" + Session("CustomerValidationCode")
                    Call jsOpenNewWindow(BaseURL() + "/ViewPmtReceipt.aspx?pc=" + ds.Tables(0).Rows(0)("CustomerPaymentCode") + "&vc=" + Session("CustomerValidationCode"))
                End If
                ' --------------------------------------------------------------------------------------------------'


                ' ---- Set the pop-up window to show back up after postback, and set link to open new tab ---'
                link_to_cloud.Visible = False
                link_to_cloud2.Visible = True
                main_login_area.Visible = False
                lbl_Login_Response.Text = "Login Sucessful!"
                modal_pop.TargetControlID = "btn_displaypopup"
                'modal_pop.Show()
                Response.Redirect("~\Home.aspx")
                ' --------------------------------------------------------------------------------------------'
            Else
                loginresult = "Sign In Failed. Check payment code or last name."
                Dim loginPageQueryString = "LoginResult=" & Server.UrlEncode(loginresult)
                lbl_Login_Response.Text = loginresult
                If ActionLink = 1 Then
                    link_to_cloud.Visible = True
                End If
                modal_pop.Show()
            End If

        Catch ex As Exception
            exlog.exLog_Transcript(Session("IP_Address"), Session("User_Agent"), Session("Session_ID"), "Patient_Login.ascx", ex)

            If DebugMode = True Then
                MsgBox("Error Message: " + ex.Message)
            End If
        End Try

    End Sub


    Protected Sub Submit_Click(sender As Object, e As EventArgs) Handles btn_submit.Click
        ' Call the subroutine to verify the user login info and fill the session variables
        Call Validate_Login(txtbox_pmtcode.Text, txtbox_LastName.Text, False, Session("GoToAction"))

    End Sub

#End Region

End Class