Contents of ucApprovals.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucApprovals.ascx.vb" Inherits="EnjazVB.ucApprovals" %>
 <div class="form-group">

     <asp:gridview id="grdApprovals" 
  CssClass="table table-hover table-striped" runat="server"   AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
    <Columns>
        <asp:BoundField DataField="wl_id" HeaderText="تسلسل"  />
        <asp:BoundField DataField="process_desc" HeaderText="العملية"  />
        <asp:BoundField DataField="emp_name" HeaderText="عن طريق الموظف" />
        <asp:BoundField DataField="wl_Date" HeaderText="تاريخ الطلب" />
         <asp:BoundField DataField="STATUS" HeaderText="حالةالطلب" />
        <asp:BoundField DataField="CLOSED_DATE" HeaderText="تاريخ اقفال"/>
        <asp:BoundField DataField="CLOSED_REMARKS" HeaderText="ملاحظة"/>
    </Columns>
                                             <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
</asp:gridview>

    <%--  <asp:GridView ID="grdWL"   CssClass="table table-hover table-striped" runat="server" AllowPaging="True" AllowCustomPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%" meta:resourcekey="grdWLResource1">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
                                    <Columns>
                                    
                                        <asp:TemplateField HeaderText="الاجراء"  >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWNextProcess" runat="server" Text="الاجراء الحالي" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="NEXT_PROCESS_DESC" ></asp:LinkButton>
                                                <asp:TextBox ID="NEXT_PROCESS_DESC" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                           <asp:LinkButton ID="btnStep" runat="server" OnCommand="btnStep_Command"
                                                     Text='<%# Bind("NEXT_PROCESS_DESC") %>'
                                                    ToolTip="Click to open the details" CommandName="Step" CommandArgument='<%# string.Concat(Eval("wl_id"), ",", Eval("ref_id"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>
                                <asp:TemplateField HeaderText="العميل" SortExpression="customer" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFEmpName" runat="server" Text="العميل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="customer" ></asp:LinkButton>
                                                <asp:TextBox ID="customer" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="رقم الجوال" SortExpression="phone" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblPhone" runat="server" Text="رقم الجوال" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="phone" ></asp:LinkButton>
                                                <asp:TextBox ID="phone" AutoPostBack="True" CssClass="form-control input-sm" OnTextChanged="txtFWL_TextChanged" runat="server" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblStnName" runat="server" Text='<%# Eval("phone") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                   <asp:TemplateField HeaderText="بنك الراتب" SortExpression="BANK"  >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblBank" runat="server" Text="بنك الراتب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="BANK" ></asp:LinkButton>
                                                <asp:TextBox ID="BANK" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblBank" runat="server" Text='<%# Eval("BANK") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="تسلسل" SortExpression="wl_id" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWLID" runat="server" Text="تسلسل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="wl_id" ></asp:LinkButton>
                                                <asp:TextBox ID="wl_id" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" meta:resourcekey="wl_idResource1"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblWlID" runat="server" Text='<%# Eval("wl_id") %>' meta:resourcekey="lblWlIDResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="تاريخ الطلب" SortExpression="wl_date" meta:resourcekey="TemplateFieldResource3">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWDate" runat="server" Text="تاريخ الطلب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="wl_date" ></asp:LinkButton>
                                                <asp:TextBox ID="wl_date" AutoPostBack="True" CssClass="form-control input-sm" TextMode="Date" runat="server" OnTextChanged="txtFWL_TextChanged" meta:resourcekey="wl_dateResource1"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblDate" runat="server" Text='<%# Eval("wl_date") %>' meta:resourcekey="lblDateResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <asp:BoundField DataField="next_process_id" HeaderText="NextProcessID" Visible="False"  />
                                        <asp:BoundField DataField="process_id" HeaderText="ProcessID" Visible="False"  />

                                        <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource13">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnpending" runat="server" CssClass="btn btn-primary btn-sm pull-right" ToolTip="Pending List"  Text="
                                                        &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-right&quot;&gt;&lt;/i&gt;
                                                " ></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:LinkButton ID="btnPending" runat="server"
                                                    ToolTip="Add to Pending" CssClass="btn btn-primary btn-sm pull-right" CommandName="addpending" CommandArgument='<%# Eval("wl_id") %>'  OnClientClick="javascript:return confirm('Are you sure add to pending?');" meta:resourcekey="btnPendingResource2" Text="
                                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-left&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages" BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
                                </asp:GridView>--%>

     </div>

Contents of ucApprovals.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucApprovals
    
    '''<summary>
    '''grdApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdApprovals As Global.System.Web.UI.WebControls.GridView
End Class

Contents of ucApprovals.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Public Class ucApprovals
    Inherits System.Web.UI.UserControl

    Dim q As String = ""
    Public Property DocNo As String
            Get
                Return ViewState("DocNo")
            End Get
            Set(value As String)
                ViewState("DocNo") = value
                loadData()
            End Set
        End Property
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        SetGridStyle(grdApprovals)
    End Sub
    Private Sub loadData()
        q = ""
        q = q & "    Select DISTINCT  w.wl_id,FORMAT(w.wl_Date,'dd/MM/yyyy  hh:mm')wl_Date,FORMAT(w.CLOSED_DATE,'dd/MM/yyyy  hh:mm')CLOSED_DATE,w.CLOSED_REMARKS,w.next_process_desc as process_desc,e.emp_name   "
        q = q & "    ,w.closed_remarks ,T.TYPE_DESC AS STATUS from   "
        q = q & "   (SELECT REF_ID, WL_ID ,WL_DATE, CLOSED_DATE ,CLOSED_REMARKS,next_process_desc,status,CLOSED_bY  FROM   app_worklist   WHERE REF_ID='" & DocNo & "' UNION SELECT REF_ID, WL_ID ,WL_DATE, wl_date as CLOSED_DATE ,CLOSED_REMARKS,next_process_desc ,'C' AS STATUS,CLOSED_bY  FROM  app_remarks   WHERE REF_ID='" & DocNo & "'   )    w    "
        q = q & "        left join  "
        ' q = q & "     APP_WORKOWNER  O On w.wl_id=O.WL_ID "
        q = q & "     (Select O.*,U.* FROM  APP_WORKOWNER  O ,APP_USERS U WHERE O.OWNER=U.EMP_NO )  O "
        q = q & "      On w.wl_id=O.WL_ID And  ISNULL(W.CLOSED_bY,'1')=(CASE WHEN W.CLOSED_bY IS NOT NULL THEN O.USER_ID ELSE '1' END ) "
        q = q & "    LEFT JOIN  EMP_MST e  ON O.OWNER=E.emp_no "
        ' q = q & "    Left Join  app_processes p on w.next_process_id=p.process_id   "
        q = q & "    Left Join(SELECT * FROM TYPE_MST WHERE TYPE_CODE='ST') T ON W.STATUS=T.TYPE_CATEGORY "
        q = q & "    WHERE W.REF_ID ='" & DocNo & "' "
        'q = q & "    order by cast(W.wl_id as int)  "

        Dim DT = GetTable(q)

        q = ""
        q = q & "    Select  DISTINCT w.wl_id,FORMAT(w.wl_Date,'dd/MM/yyyy  hh:mm')wl_Date,FORMAT(w.CLOSED_DATE,'dd/MM/yyyy  hh:mm')CLOSED_DATE,w.CLOSED_REMARKS,w.next_process_desc as process_desc,e.emp_name   "
        q = q & "    ,w.closed_remarks ,T.TYPE_DESC AS STATUS from   "
        q = q & "   (SELECT REF_ID, WL_ID ,WL_DATE, CLOSED_DATE ,CLOSED_REMARKS,next_process_desc,status,CLOSED_bY  FROM   app_worklist   WHERE REF_ID='" & DocNo & "' UNION SELECT REF_ID, WL_ID ,WL_DATE, wl_date as CLOSED_DATE ,CLOSED_REMARKS,next_process_desc ,'C' AS STATUS,CLOSED_bY  FROM  app_remarks   WHERE REF_ID='" & DocNo & "'   )    w    "
        q = q & "        left join  "
        ' q = q & "     APP_WORKOWNER  O On w.wl_id=O.WL_ID "
        q = q & "     (Select O.*,U.* FROM  APP_WORKOWNER  O ,APP_USERS U WHERE O.OWNER=U.EMP_NO )  O "
        q = q & "      On w.wl_id=O.WL_ID And  ISNULL(W.CLOSED_bY,'1')=(CASE WHEN W.CLOSED_bY IS NOT NULL THEN O.USER_ID ELSE '1' END ) "
        q = q & "    LEFT JOIN  EMP_MST e  ON O.OWNER=E.emp_no "
        ' q = q & "    Left Join  app_processes p on w.next_process_id=p.process_id   "
        q = q & "    Left Join(SELECT * FROM TYPE_MST WHERE TYPE_CODE='ST') T ON W.STATUS=T.TYPE_CATEGORY "
        q = q & "    WHERE W.REF_ID ='" & DocNo & "' "
        Dim DT2 = GetTableCon(q, "Enjazcon")

        DT.Merge(DT2)
        Dim sortedResults = From row In DT.AsEnumerable()
                            Order By CInt(row.Field(Of String)("wl_id")) Ascending

        Dim sortedDataTable As DataTable = DT.Clone() ' Clone the structure (columns) of the original table

        ' Import each sorted row into the new DataTable
        For Each row In sortedResults
            sortedDataTable.ImportRow(row)
        Next

        grdApprovals.DataSource = sortedDataTable
        grdApprovals.DataBind()
        SetGridStyle(grdApprovals)







    End Sub

End Class

Contents of ucAttachment.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucAttachment.ascx.vb" Inherits="EnjazVB.ucAttachment" %>
 <div class="form-group">
                         <asp:gridview id="grdAttachment" 
  CssClass="table table-hover table-striped" runat="server" AllowPaging="false" AllowCustomPaging="false" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
    <Columns>
        <asp:BoundField DataField="sr_no" HeaderText="تسلسل"  />
        <asp:BoundField DataField="att_desc" HeaderText="المرفق"  />
       <%-- <asp:BoundField DataField="attach_id" HeaderText="عن طريق الموظف" />--%>
        <asp:BoundField DataField="emp_name" HeaderText="ارفق بواسطة" />
                <asp:BoundField DataField="attach_date" HeaderText="التاريخ" />
         <asp:BoundField DataField="FILENAME" Visible="false" HeaderText="FILENAME" />
        
          <asp:TemplateField >
                                     <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton ID="btnStep" runat="server" OnCommand="btnStep_Command"
                                                     Text='<%# Bind("action") %>'
                                                    ToolTip="اضغط للارفاق" CommandName="Step" CommandArgument='<%# string.Concat(Eval("doc_type"), ",", Eval("ref_id"), ",", Eval("att_desc"), ",", Eval("action2"), ",", Eval("FILENAME"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>


         <asp:TemplateField >
                                     <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton Visible='<%#Eval("FILENAME").ToString() <> "" %>' ID="btnDel" runat="server" OnCommand="btnDel_Command"
                                                                                         OnClientClick="if (confirm('هل تريد حذف الملف بالفعل ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                     Text="<i aria-hidden='true' class='glyphicon glyphicon-trash'></i>"
                                                    ToolTip="اضغط للحذف" CommandName="Del" CommandArgument='<%#String.Concat(Eval("doc_type"), ",", Eval("ref_id"), ",", Eval("att_desc"), ",", Eval("action2"), ",", Eval("FILENAME"), ",", Eval("sr_no"), ",", Eval("emp_no"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>


        <%--<asp:BoundField DataField="CLOSED_DATE" HeaderText="تاريخ اقفال"/>
        <asp:BoundField DataField="CLOSED_REMARKS" HeaderText="ملاحظة"/>--%>
    </Columns>
                                             <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
</asp:gridview>
                                  
     </div>

Contents of ucAttachment.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucAttachment
    
    '''<summary>
    '''grdAttachment control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdAttachment As Global.System.Web.UI.WebControls.GridView
End Class

Contents of ucAttachment.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Public Class ucAttachment
    Inherits System.Web.UI.UserControl
    Dim q As String = ""

    Public Property requestId As String
        Get
            Return ViewState("requestId")
        End Get
        Set(value As String)
            ViewState("requestId") = value
            loadAttachment()
        End Set
    End Property

    Public Property IsReadOnly As Boolean
        Get
            Return ViewState("IsReadOnly")
        End Get
        Set(value As Boolean)
            ViewState("IsReadOnly") = value
            If value Then
                grdAttachment.Columns(6).Visible = False
            End If
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        SetGridStyle(grdAttachment)
    End Sub
    Private Sub loadAttachment()
        q = ""
        q = q & " SELECT * FROM (   "
        q = q & "   select	'" & requestId & "' as ref_id,TYPE_ABBR, type_category doc_type,(case when doc_type='DCOTHERS' then DOC_DESC ELSE  type_Desc END ) as att_desc,SR_NO,e.emp_no, emp_name,FORMAT(up.sys_date,'dd/MM/yyyy')attach_date,up.FILENAME, "
        q = q & "    Case when up.FILENAME Is null then N'ارفاق' else N'عرض' end as action,case when up.FILENAME is null then N'ATT' else N'DIS' end as action2   from   "
        q = q & "    (select * from type_mst  where type_code='DC') t left join (select * from APP_UPLOAD_MST where DOC_NO='" & requestId & "' ) up on t.TYPE_CATEGORY=up.doc_type "
        q = q & "    left join  (select * from  ARS_REQUEST_HDR  where DOC_NO='" & requestId & "'  )h on up.DOC_NO=h.doc_no "
        q = q & "    left join app_users u on up.SYS_USERID=u.user_id "
        q = q & "    left join emp_mst e on u.emp_no=e.emp_no  "
        q = q & "   UNION "
        q = q & "   Select '" & requestId & "' as ref_id ,TYPE_ABBR, type_category doc_type,type_Desc as att_desc,NULL AS SR_NO , NULL AS emp_no, NULL AS emp_name,NULL AS attach_date,NULL AS FILENAME, "
        q = q & "   N'ارفاق' AS action,N'ATT' AS action2 FROM TYPE_MST WHERE TYPE_CODE='DC' AND TYPE_CATEGORY='DCOTHERS' "
        q = q & "  ) A ORDER BY CAST(TYPE_ABBR AS INT) "
        Dim DT
        Dim NewDb = GetFieldValue("SELECT  DOC_NO FROM  APP_UPLOAD_MST WHERE DOC_NO='" & requestId & "' ")
        Dim OldDb = GetFieldValueCon("SELECT  DOC_NO FROM  APP_UPLOAD_MST WHERE DOC_NO='" & requestId & "' ", "Enjazcon")
        If NewDb = "" And OldDb = "" Then
            DT = GetTable(q)
        ElseIf NewDb <> "" And OldDb = "" Then
            DT = GetTable(q)
        ElseIf NewDb = "" And OldDb <> "" Then
            DT = GetTableCon(q, "Enjazcon")
        Else
            DT = GetTable(q)
            Dim dt2 = GetTableCon(q, "Enjazcon")
            DT.Merge(dt2)




            ' Create a new DataTable to hold distinct rows
            Dim distinctDataTable As DataTable = DT.DefaultView.ToTable(True, "REF_ID", "TYPE_ABBR", "doc_type", "att_desc", "SR_NO", "emp_no", "emp_name", "attach_date", "FILENAME", "action", "action2")
            Dim sortedResults = From row In distinctDataTable.AsEnumerable()
                                Order By CInt(row.Field(Of String)("TYPE_ABBR")) Ascending

            DT = distinctDataTable.Clone() ' Clone the structure (columns) of the original table
            For Each row In sortedResults
                DT.ImportRow(row)
            Next
            DT.AcceptChanges()
        End If




        grdAttachment.DataSource = DT
        grdAttachment.DataBind()
        SetGridStyle(grdAttachment)
    End Sub
    Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O" 'rblWLStatus.SelectedValue.ToString

        'Dim rowIndex As Integer = Convert.ToInt32(e.CommandArgument)


        'Reference the GridView Row.
        ' Dim row As GridViewRow = grdAttachment.Rows(rowIndex)




        If e.CommandName = "Step" Then

            Dim sDOC_TYPE As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
            Dim sArgRefID As String = ""
            Dim sDOC_DESC As String
            Dim sAction As String
            Dim sFileName As String
            'sWorklistID = e.CommandArgument 'wl_id
            sDOC_TYPE = e.CommandArgument.ToString.Split(",")(0).ToString
            sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString
            sDOC_DESC = e.CommandArgument.ToString.Split(",")(2).ToString
            sAction = e.CommandArgument.ToString.Split(",")(3).ToString
            sFileName = e.CommandArgument.ToString.Split(",")(4).ToString
            'sFileName = row.Cells(4).Text.ToString
            Dim url As String
            Dim s As String
            If sAction.ToString.ToUpper = "DIS" Then
                url = "../ImageStorage/" & sFileName & " "
                s = "window.open('" & url + "', 'popup_window', 'width=600,height=500,left=100,top=100,resizable=yes');"
            Else
                url = "../Pages/UploadFiles.aspx?docno=" & sArgRefID & "&doctype=" & sDOC_TYPE & "&docdesc=" & sDOC_DESC & " "
                s = "window.open('" & url + "', 'popup_window', 'width=400,height=200,left=100,top=100,resizable=yes');"
            End If



            'ClientScript.RegisterStartupScript(Me.GetType(), "script", s, True)
            ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "script", s, True)

        End If
        SetGridStyle(grdAttachment)
    End Sub


    Protected Sub btnDel_Command(sender As Object, e As CommandEventArgs)

        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O"
        If e.CommandName = "Del" Then

            Dim sDOC_TYPE As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
            Dim sArgRefID As String = ""
            Dim sDOC_DESC As String
            Dim sAction As String
            Dim sFileName As String
            Dim sSr_no As String
            Dim sEmp_no As String
            'sWorklistID = e.CommandArgument 'wl_id
            sDOC_TYPE = e.CommandArgument.ToString.Split(",")(0).ToString
            sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString
            sDOC_DESC = e.CommandArgument.ToString.Split(",")(2).ToString
            sAction = e.CommandArgument.ToString.Split(",")(3).ToString
            sFileName = e.CommandArgument.ToString.Split(",")(4).ToString
            sSr_no = e.CommandArgument.ToString.Split(",")(5).ToString
            sEmp_no = e.CommandArgument.ToString.Split(",")(6).ToString
            'sFileName = row.Cells(4).Text.ToString
            Dim url As String
            Dim s As String

            If Session("supper_user").ToString = "True" Or Session("emp_no").ToString = sEmp_no Then


                'Dim cn As New SqlConnection
                'Dim cmd As New SqlCommand
                'Dim trans As SqlTransaction

                'cn = OpenConnection()
                'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
                'cmd.Connection = cn
                'cmd.Transaction = trans

                'SetDateSession(cn, cmd)
                Dim saveFlag As Boolean = False

                Using cn As New SqlConnection(GetConnString)
                    cn.Open()
                    Using trans As SqlTransaction = cn.BeginTransaction()
                        Try

                            Using cmd As New SqlCommand()
                                cmd.Connection = cn        ' Set the connection
                                cmd.Transaction = trans    ' Set the transaction
                                SetDateSession(cn, cmd)

                                q = "delete from app_upload_mst where doc_no='" & sArgRefID & "' and sr_no='" & sSr_no & "' and doc_type='" & sDOC_TYPE & "'"
                                cmd.CommandText = q
                                cmd.ExecuteNonQuery()

                                RunInOtherDb(q)

                            End Using
                            trans.Commit()
                            saveFlag = True
                            Dim PathFileName = Server.MapPath("~/ImageStorage/" & sFileName)
                            System.IO.File.Delete(PathFileName)

                        Catch ex As Exception
                            ShowPopUpMsg(Me.Page, ex.ToString)
                            trans.Rollback()

                        Finally
                            ' cmd.Dispose()
                            trans.Dispose()
                            cn.Close()
                            cn.Dispose()
                        End Try
                    End Using
                End Using
                If saveFlag = True Then


                    'ClientScript.RegisterStartupScript(Me.GetType(), "script", s, True)
                    ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "script", s, True)
                    loadAttachment()
                End If
            Else
                ShowPopUpMsg(Me.Page, "لايمكنك حذف ملف لم تقم بارفاقه ")
            End If

        End If
        'SetGridStyle(grdAttachment)

    End Sub

End Class

Contents of ucBlog.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucBlog.ascx.vb" Inherits="EnjazVB.ucBlog" %>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">
  <title>Single Post - ZenBlog Bootstrap Template</title>
  <meta name="description" content="">
  <meta name="keywords" content="">

  <!-- Favicons -->
  <link href="/Blog/assets/img/favicon.png" rel="icon">
  <link href="/Blog/assets/img/apple-touch-icon.png" rel="apple-touch-icon">

  <!-- Fonts -->
  <link href="https://fonts.googleapis.com" rel="preconnect">
  <link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500;1,600;1,700;1,800&display=swap" rel="stylesheet">

  <!-- Vendor CSS Files -->
  <link href="/Blog/assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link href="/Blog/assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
  <link href="/Blog/assets/vendor/aos/aos.css" rel="stylesheet">
  <link href="/Blog/assets/vendor/swiper/swiper-bundle.min.css" rel="stylesheet">

  <!-- Main CSS File -->
  <link href="/Blog/assets/css/main.css" rel="stylesheet">

  <!-- =======================================================
  * Template Name: ZenBlog
  * Template URL: https://bootstrapmade.com/zenblog-bootstrap-blog-template/
  * Updated: Aug 08 2024 with Bootstrap v5.3.3
  * Author: BootstrapMade.com
  * License: https://bootstrapmade.com/license/
  ======================================================== -->
</head>

<body class="single-post-page">
       <asp:ScriptManager ID="ToolkitScriptManager1" runat="server" AsyncPostBackTimeout="360000">
            <Scripts>
                </Scripts>
           </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
  <header id="header" style="background-color:#bd8242 !important;color:white;" class="header d-flex align-items-center sticky-top">
    <div   class="container position-relative d-flex align-items-center justify-content-between">

      <a href="index.html" class="logo d-flex align-items-center me-auto me-xl-0">
        <!-- Uncomment the line below if you also wish to use an image logo -->
        <!-- <img src="assets/img/logo.png" alt=""> -->
        <h1 style="color:white;" class="sitename">إنجاز الاملاك العقارية</h1>
      </a>

      <nav   id="navmenu" class="navmenu">
        <ul>
          <li><a style="color:white;" href="/Pages/HomePage.aspx">الرئيسية</a></li>
        </ul>
        <i class="mobile-nav-toggle d-xl-none bi bi-list"></i>
      </nav>

     <%-- <div class="header-social-links">
        <a href="#" class="twitter"><i class="bi bi-twitter-x"></i></a>
        <a href="#" class="facebook"><i class="bi bi-facebook"></i></a>
        <a href="#" class="instagram"><i class="bi bi-instagram"></i></a>
        <a href="#" class="linkedin"><i class="bi bi-linkedin"></i></a>
      </div>--%>

    </div>
  </header>

  <main class="main">

    <!-- Page Title -->
    <div class="page-title">
      <div class="container d-lg-flex justify-content-between align-items-center">
        <h1 class="mb-2 mb-lg-0">المدونة</h1>
      <%--  <nav class="breadcrumbs">
          <ol>
            <li><a href="index.html">Home</a></li>
            <li class="current">Single Post</li>
          </ol>
        </nav>--%>
      </div>
    </div><!-- End Page Title -->
            
    <div class="container">
      <div class="row">

        <div class="col-lg-8">

          <!-- Blog Details Section -->
          <section id="blog-details" class="blog-details section">
            <div class="container">

              <article class="article">

               


                        <asp:Repeater   OnItemDataBound="OnItemDataBound"   ID="rpMain" runat="server">
        <ItemTemplate> 
                       <asp:HiddenField ID="hfITEM_CODE" runat="server" Value='<%# Eval("ITEM_CODE") %>' />
             <div class="post-img">
                  <img src='<%# Eval("BLOG_IMAGE") %>' alt="" class="img-fluid">
                </div>

                 <h2 class="title"><%# Eval("BLOG_TITLE") %></h2>

                <div class="meta-top">
                  <ul>
<%--                    <li class="d-flex align-items-center"><i class="bi bi-person"></i> <a href="blog-details.html">John Doe</a></li>--%>
                    <li class="d-flex align-items-center"><i class="bi bi-clock"></i> <a href="blog-details.html"><time datetime="2020-01-01"><%# Eval("BLOG_DATETIME") %></time></a></li>
<%--                    <li class="d-flex align-items-center"><i class="bi bi-chat-dots"></i> <a href="blog-details.html">12 Comments</a></li>--%>
                  </ul>
                </div><!-- End meta top -->

                <div class="content">
                  <p>
                  <%# Eval("BLOG_CONTENT") %>
                  </p>

                
                         <asp:Repeater   ID="rpDetails" runat="server">
        <ItemTemplate> 
            <h3> <%# Eval("SUB_TITLE") %></h3>
              <p>
                 <%# Eval("SUB_CONTENT") %> </p>
             <img src='<%# Eval("SUB_IMAGE") %>' class="img-fluid" alt="">
            </ItemTemplate>
                             </asp:Repeater>

                  
                

                </div><!-- End post content -->


            </ItemTemplate>
                            </asp:Repeater>







           




               <%-- <div class="meta-bottom">
                  <i class="bi bi-folder"></i>
                  <ul class="cats">
                    <li><a href="#">Business</a></li>
                  </ul>

                  <i class="bi bi-tags"></i>
                  <ul class="tags">
                    <li><a href="#">Creative</a></li>
                    <li><a href="#">Tips</a></li>
                    <li><a href="#">Marketing</a></li>
                  </ul>
                </div><!-- End meta bottom -->--%>

              </article>

            </div>
          </section><!-- /Blog Details Section -->

      
       
        </div>

        <div class="col-lg-4 sidebar">

          <div class="widgets-container">

           
          
            <!-- Recent Posts Widget -->
            <div class="recent-posts-widget widget-item">

              <h3 class="widget-title">الموضوعات</h3>
                        <asp:Repeater  OnItemCommand="rpPosts_ItemCommand"  ID="rpPosts" runat="server">
        <ItemTemplate> 
              <div class="post-item">
                <img src='<%# Eval("BLOG_IMAGE") %>' alt="" class="flex-shrink-0">
                <div>
                  <h4>   <asp:LinkButton ID="lnkSelect" runat="server" CommandName="SelectItem" CommandArgument='<%# Eval("ITEM_CODE") %>'>
                <%# Eval("BLOG_TITLE") %>
            </asp:LinkButton>
                     <%-- <a href="blog-details.html"><%# Eval("BLOG_TITLE") %></a></h4>--%>
                  <time datetime="2020-01-01"><%# Eval("BLOG_DATETIME") %></time>
                </div>
              </div><!-- End recent post item-->
            </ItemTemplate>
                            </asp:Repeater>
          <%--    <div class="post-item">
                <img src="assets/img/blog/blog-recent-2.jpg" alt="" class="flex-shrink-0">
                <div>
                  <h4><a href="blog-details.html">Quidem autem et impedit</a></h4>
                  <time datetime="2020-01-01">Jan 1, 2020</time>
                </div>
              </div>

              <div class="post-item">
                <img src="assets/img/blog/blog-recent-3.jpg" alt="" class="flex-shrink-0">
                <div>
                  <h4><a href="blog-details.html">Id quia et et ut maxime similique occaecati ut</a></h4>
                  <time datetime="2020-01-01">Jan 1, 2020</time>
                </div>
              </div>

              <div class="post-item">
                <img src="assets/img/blog/blog-recent-4.jpg" alt="" class="flex-shrink-0">
                <div>
                  <h4><a href="blog-details.html">Laborum corporis quo dara net para</a></h4>
                  <time datetime="2020-01-01">Jan 1, 2020</time>
                </div>
              </div>

              <div class="post-item">
                <img src="assets/img/blog/blog-recent-5.jpg" alt="" class="flex-shrink-0">
                <div>
                  <h4><a href="blog-details.html">Et dolores corrupti quae illo quod dolor</a></h4>
                  <time datetime="2020-01-01">Jan 1, 2020</time>
                </div>
              </div>--%>

            </div><!--/Recent Posts Widget -->

          
          </div>

        </div>

      </div>
    </div>

           
  </main>

  <footer id="footer" class="footer dark-background">

    <div class="container footer-top">
      <div class="row gy-4">
        <div class="col-lg-4 col-md-6 footer-about">
          <img  src="/assets/img/logo-nav.png" alt="">
        </div>

        <div class="col-lg-2 col-md-3 footer-links">
          
        </div>

        <div class="col-lg-2 col-md-3 footer-links">
        
        </div>

        <div class="col-lg-2 col-md-3 footer-links">
          
          <ul class="list-inline">
              <li>
                <p>العنوان : الرياض</p>
              </li>
            
              <li>
                  <p>المونسية - شارع النجاح</p>
              </li>
                
    
 
              <li>
                <p> EnjazAlamlak.C@gmail.com </p>
              </li>
             
            </ul>
        </div>

        <div class="col-lg-2 col-md-3 footer-links">
       
        </div>

      </div>
    </div>

    <div class="container copyright text-center mt-4">
      <p>
              جميع الحقوق محفوظة &copy;<strong><asp:Localize ID="locCopy" runat="server"></asp:Localize></strong> <strong>إنجاز الأملاك العقارية</strong> .
            </p>
 
    </div>

  </footer>

  <!-- Scroll Top -->
  <a href="#" id="scroll-top" class="scroll-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>

  <!-- Preloader -->
  <div id="preloader"></div>

  <!-- Vendor JS Files -->
  <script src="/Blog/assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="/Blog/assets/vendor/php-email-form/validate.js"></script>
  <script src="/Blog/assets/vendor/aos/aos.js"></script>
  <script src="/Blog/assets/vendor/swiper/swiper-bundle.min.js"></script>

  <!-- Main JS File -->
  <script src="/Blog/assets/js/main.js"></script>
</ContentTemplate>
        </asp:UpdatePanel>
</body>

</html>

Contents of ucBlog.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucBlog

    '''<summary>
    '''ToolkitScriptManager1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ToolkitScriptManager1 As Global.System.Web.UI.ScriptManager

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''rpMain control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents rpMain As Global.System.Web.UI.WebControls.Repeater

    '''<summary>
    '''rpPosts control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents rpPosts As Global.System.Web.UI.WebControls.Repeater

    '''<summary>
    '''locCopy control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents locCopy As Global.System.Web.UI.WebControls.Localize
End Class

Contents of ucBlog.ascx.vb:

Imports WebClass.Sys.Classes
Imports WebClass.Sys.webclass.mainclass
Imports WebClass.Sys.Classes.clsGlobarVar
Imports System.IO
Imports System.Drawing
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Imports System.Drawing.Drawing2D

Public Class ucBlog
    Inherits System.Web.UI.UserControl
    Dim q = ""
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            LoadPostDetails()
            LoadPosts()
        End If
    End Sub

    Private Sub LoadPostDetails(Optional Item_Code As String = "")
        q = ""
        q = q & " SELECT TOP 1 ITEM_CODE,TITLE AS BLOG_TITLE,CONTENT AS BLOG_CONTENT,SYS_DATE AS BLOG_DATETIME,'https://enjazaqar.com/'+'/ImageStorage/'+FILENAME AS BLOG_IMAGE   FROM APP_BLOG WHERE STATUS='Y' "
        If Item_Code <> "" Then
            q = q & " AND ITEM_CODE='" & Item_Code & "'  "
        End If
        q = q & "  ORDER BY SYS_DATE DESC   "
        Dim dt = GetTableCon(q, "EnjazBlog")
        If dt.Rows.Count > 0 Then
            rpMain.DataSource = dt
            rpMain.DataBind()




        End If



    End Sub
    Private Sub LoadPosts()
        q = ""
        q = q & " Select  ITEM_CODE,TITLE As BLOG_TITLE,CONTENT As BLOG_CONTENT,SYS_DATE As BLOG_DATETIME,'https://enjazaqar.com/'+'/ImageStorage/'+FILENAME AS BLOG_IMAGE  FROM APP_BLOG WHERE STATUS='Y' ORDER BY SYS_DATE DESC   "
        Dim dt2 = GetTableCon(q, "EnjazBlog")
        If dt2.Rows.Count > 0 Then
            rpPosts.DataSource = dt2
            rpPosts.DataBind()




        End If
    End Sub
    Protected Sub OnItemDataBound(sender As Object, e As RepeaterItemEventArgs)
        If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
            Dim rptDetails As Repeater = TryCast(e.Item.FindControl("rpDetails"), Repeater)
            Dim ITEM_CODE As String = TryCast(e.Item.FindControl("hfITEM_CODE"), HiddenField).Value

            'Dim ITEM_CODE = dt(0)("ITEM_CODE").ToString
            q = ""
            q = q & " SELECT  ITEM_CODE,TITLE AS SUB_TITLE,CONTENT AS SUB_CONTENT,'https://enjazaqar.com/'+'/ImageStorage/'+FILENAME AS SUB_IMAGE  FROM APP_BLOG_DTL WHERE ITEM_CODE='" & ITEM_CODE & "' ORDER BY ORDERID   "
            Dim dtDtl = GetTableCon(q, "EnjazBlog")
            If dtDtl.Rows.Count > 0 Then
                rptDetails.DataSource = dtDtl
                rptDetails.DataBind()
            End If

        End If
    End Sub

    Protected Sub rpPosts_ItemCommand(ByVal source As Object, ByVal e As RepeaterCommandEventArgs)
        If e.CommandName = "SelectItem" Then
            Dim itemID As String = e.CommandArgument
            LoadPostDetails(itemID)
        End If
    End Sub

End Class

Contents of ucBlogAdm.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucBlogAdm.ascx.vb"  Inherits="EnjazVB.ucBlogAdm" %>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TinyMCE Example</title>

    <!-- Include TinyMCE with your valid API key -->
    <script src="https://cdn.tiny.cloud/1/qzz541sujimy8jp4621u6copn2az3cuxyt9oh41h1dk5s0ho/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>

    <script>
        // Initialize TinyMCE
        document.addEventListener("DOMContentLoaded", function () {
            tinymce.init({
                selector: 'textarea', // Target textarea
                width: 600,           // Editor width
                height: 300,          // Editor height
                plugins: 'lists link image code', // Enable necessary plugins
                toolbar: 'undo redo | formatselect | bold italic underline | alignleft aligncenter alignright | bullist numlist outdent indent | link image | code', // Define toolbar buttons
                menubar: false,       // Hide the menubar
                branding: false,      // Hide TinyMCE branding
                readonly: false       // Ensure it's editable
            });
        });
    </script>
<%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">
 <ContentTemplate>--%>
<div class="col-sm-12">
    <div class="col-sm-1"></div>
    <div class="col-sm-10">
  <div  class="form-group">
                            <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                  الإعدادات 
                                </div>
                                <div class="panel-body">

                                    <div  class="form-group">
                                   
                                    <div class="col-sm-12">

                                  <div class="form-group">

                        <div class="form-group">
                             <div class="col-sm-2">
         <asp:Label ID="Label3" runat="server" Text="الحالة" Font-Bold="True" ></asp:Label>
        </div>
                                       <div class="col-sm-6">
              <asp:DropDownList AutoPostBack="true" OnSelectedIndexChanged="ddlStatus_SelectedIndexChanged" ID="ddlStatus"  CssClass="form-control" runat="server">
                  <asp:ListItem Text="نشط" Value="Y" Selected="True"></asp:ListItem>
                          <asp:ListItem Text="غير نشط" Value="N"  ></asp:ListItem>
</asp:DropDownList>
             </div>
</div>
<div class="form-group">
    <div class="col-sm-2">
         <asp:Label ID="Label1" runat="server" Text="عنوان المقال" Font-Bold="True" ></asp:Label>
        </div>
    <div class="col-sm-10">
             <asp:TextBox ID="txtTitle" TextMode="MultiLine" Rows="3"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
 </div>


<div class="form-group">
    <div class="col-sm-2">
         <asp:Label ID="Label2" runat="server" Text="نص المقال" Font-Bold="True" ></asp:Label>
        </div>
    <div class="col-sm-10">
        <asp:TextBox ID="txtHTMLContent"  runat="server" Rows="20" TextMode="MultiLine"/>
   </div>
 </div>

    
     <div class="form-group">
   <div class="col-sm-2">
         <asp:Label ID="Label8" runat="server" Text="صورة للمقال" Font-Bold="True" ></asp:Label>
        </div>
         <div class="col-sm-4">
          <asp:FileUpload ID="up" runat="server"  AllowMultiple="true" CssClass="btn btn-default btn-md" Width="100%" meta:resourcekey="upResource1" />
</div>
     </div>
   
<div class="form-group">
         <div class="col-sm-2">
         <asp:Label ID="Label9" runat="server" Text="صور اخرى" Font-Bold="True" ></asp:Label>
        </div>
    <%--     <div class="col-sm-4">
          <asp:FileUpload ID="upOther" runat="server"  AllowMultiple="True" CssClass="btn btn-default btn-md" Width="100%" meta:resourcekey="upResource1" />
</div>--%>
    </div>


                                       <br />
                                        <div class="form-group">
                                              <br />
                                            </div>
                                           <div class="form-group">
                                           <%--    <div class="col-sm-3">
                                                   </div>--%>
                                                <div class="col-sm-4">
                                                     <asp:LinkButton  ID="btnSave" runat="server"   CssClass="btn btn-primary btn-md" OnClick="btnSave_Click" 
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-login&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; حفظ
                                                        " ></asp:LinkButton>
                                                   <asp:LinkButton  ID="btnPlus" runat="server"  Visible="false"  CssClass="btn btn-primary btn-md" OnClick="btnPlus_Click" 
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-plus&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; حفظ
                                                        " ></asp:LinkButton>
                                                   
                                               </div>
                                                                                <div class="col-sm-4">
                                                          <asp:LinkButton ID="btnEmpCancel" runat="server"  CssClass="btn btn-primary btn-md"  Visible="false"  
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; إلغاء
                                                        " ></asp:LinkButton>
                                             </div>
                                               </div>
  </div>




                                  </div>
                                     
                                        </div>


                                    <div class="form-group">
                         <asp:gridview id="grd" 
  CssClass="table table-hover table-striped" runat="server" AllowPaging="false" AllowCustomPaging="false" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
    <Columns> 
        <asp:BoundField DataField="SR_NO" HeaderText="تسلسل"  />
                <asp:BoundField DataField="ITEM_CODE" HeaderText="كود"  />
        <asp:BoundField DataField="TITLE" HeaderText="عنوان المقال"  />
       <asp:BoundField DataField="status" HeaderText="الحالة"  />
        <asp:BoundField DataField="SYS_DATE" HeaderText="التاريخ" />
        <%--  <asp:BoundField DataField="sup_name" HeaderText="المشرف" />
          <asp:BoundField DataField="sup"  HeaderText="المشرف" />--%>
               <asp:TemplateField >
                  <ItemTemplate>
                      <asp:Image ID="ItemImage" Height="70" Width="70" ImageUrl='<%#Eval("ITEM_IMAGE")%>' runat="server" />
                 </ItemTemplate>
              </asp:TemplateField>

         
    <asp:TemplateField >
                                     <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton  ID="btnModify" runat="server"  OnCommand="btnUpdate_Command" 
                                                    Text="<i aria-hidden='true' class='glyphicon glyphicon-edit'></i>"
                                                    ToolTip="اضغط للتعديل" CommandName="upd" CommandArgument='<%#Eval("ITEM_CODE")%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>
 </Columns>
                                             <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages" BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
</asp:gridview>
                                  
     </div>

                                    </div>
                                </div>
                            </div>
       
        
    



    </div>
    <div class="col-sm-1"></div>
   

    </div>
  <%--  </ContentTemplate>
     <Triggers>
        <asp:PostBackTrigger ControlID="btnSave"  />
    </Triggers>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>--%>

Contents of ucBlogAdm.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucBlogAdm

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlStatus As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtTitle control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtTitle As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtHTMLContent control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtHTMLContent As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label8 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label8 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''up control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents up As Global.System.Web.UI.WebControls.FileUpload

    '''<summary>
    '''Label9 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label9 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnPlus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnPlus As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnEmpCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnEmpCancel As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''grd control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grd As Global.System.Web.UI.WebControls.GridView
End Class

Contents of ucBlogAdm.ascx.vb:

Imports WebClass.Sys.Classes
Imports WebClass.Sys.webclass.mainclass
Imports WebClass.Sys.Classes.clsGlobarVar
Imports System.IO
Imports System.Drawing
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Imports System.Drawing.Drawing2D

Public Class ucBlogAdm
    Inherits System.Web.UI.UserControl
    Dim q As String = ""

    Public Property COUNTER As Int32
        Get
            Return ViewState("COUNTER")
        End Get
        Set(value As Int32)
            ViewState("COUNTER") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            loadData()
            COUNTER = 0
        End If
        SetGridStyle(grd)
    End Sub


    Private Sub loadData()
        q = ""
        q = q & "   SELECT  ROW_NUMBER() OVER (ORDER BY SYS_DATE DESC)  As SR_NO, ITEM_CODE, TITLE  , "
        q = q & "   Format(SYS_DATE,'dd/MM/yyyy') as SYS_DATE ,'/ImageStorage/'+FILENAME AS ITEM_IMAGE,(CASE WHEN STATUS='Y' THEN N'نشط' ELSE N'غير نشط' END ) STATUS  "
        q = q & "   From APP_BLOG     "
        q = q & "   WHERE 1=1  "

        q = q & "   ORDER BY  SYS_DATE  DESC   "

        Dim DT = GetTable(q) 'GetTableCon(q, "EnjazBlog") '

        grd.DataSource = DT
        grd.DataBind()
        SetGridStyle(grd)

    End Sub

    Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O" 'rblWLStatus.SelectedValue.ToString

        'Dim rowIndex As Integer = Convert.ToInt32(e.CommandArgument)


        'Reference the GridView Row.
        ' Dim row As GridViewRow = grdAttachment.Rows(rowIndex)




        If e.CommandName = "Step" Then



            'sFileName = row.Cells(4).Text.ToString
            Dim url As String
            Dim s As String

            url = e.CommandArgument.ToString()
            s = "window.open('" & url + "', 'popup_window', 'width=600,height=500,left=100,top=100,resizable=yes');"



            'ClientScript.RegisterStartupScript(Me.GetType(), "script", s, True)
            ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "script", s, True)

        End If
        SetGridStyle(grd)
    End Sub



    Protected Sub btnSave_Click(sender As Object, e As EventArgs)
        Dim g As String = ""
        Dim UpOK As Boolean = False
        Dim NewFile As String = ""
        Dim imgPath As String = ""

        Dim imgSize As Integer = 0

        If IsNothing(ViewState("sType_category")) Then
            ViewState("sType_category") = ""
        End If



        If txtTitle.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل العنوان")
            Exit Sub
        End If
        'Dim htmlContent As String = txtDesc.Value
        If txtHTMLContent.Text.ToString = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل نص المقال")
            Exit Sub
        End If

        If ViewState("sType_category").ToString = "" Then
            If Not up.HasFiles Then
                ShowPopUpMsg(Me.Page, "فضلا تحقق من صورة المنتج")
                Exit Sub
            End If
        End If

        ''If ViewState("sType_category").ToString = "" Then
        ''    If GetFieldValue("select TYPE_CATEGORY from TYPE_MST where upper(TYPE_DESC)='" & txtDesc.ToString.ToString.ToUpper & "'") <> "" Then
        ''        ShowPopUpMsg(Me.Page, "فضلا ادخل وصف اخر ")
        ''        Exit Sub
        ''    End If
        ''End If

        If up.HasFiles Then

            For Each postedFile As HttpPostedFile In up.PostedFiles

                imgSize = up.PostedFile.ContentLength
                g = Guid.NewGuid().ToString
                NewFile = g & Mid(up.FileName, up.FileName.LastIndexOf(".") + 1, 4)

                If postedFile.ContentLength > 4000000 Then
                    Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "Alert", "alert('File is too big.')", True)
                Else
                    'clsGenClass.ResizeImage(Image, 150, 40).
                    'postedFile.SaveAs(Server.MapPath("~/ImageStorage/" & NewFile))
                    If postedFile.ContentLength = 0 Then
                        ShowPopUpMsg(Me.Page, "no image")
                        Exit Sub
                    Else
                        Dim img = System.Drawing.Image.FromStream(postedFile.InputStream)
                        'If ddlMainTypes.SelectedValue = "MCLINKS" Then
                        '    ResizeImage(img, 800, 530).Save(Server.MapPath("~/ImageStorage/" & NewFile))
                        'Else
                        ResizeImage(img, 1024, 768).Save(Server.MapPath("~/ImageStorage/" & NewFile))
                        'End If


                    End If

                End If
            Next
        End If

        Dim cn As New SqlConnection
        Dim cmd As New SqlCommand
        Dim trans As SqlTransaction

        cn = OpenConnection()
        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        cmd.Connection = cn
        cmd.Transaction = trans

        SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Try
            COUNTER = COUNTER + 1
            Dim CATEG As String = DateTime.Today.ToString("ddd", CultureInfo.InvariantCulture).ToUpper() & COUNTER.ToString & CreateRandomCode()

            If GetFieldValue(cn, cmd, "SELECT ITEM_CODE FROM APP_BLOG WHERE ITEM_CODE='" & CATEG & "'  ") <> "" Then
                COUNTER = COUNTER + 1
                CATEG = DateTime.Today.ToString("ddd", CultureInfo.InvariantCulture).ToUpper() & COUNTER.ToString & CreateRandomCode() & CreateRandomCode()
            End If
            If ViewState("sType_category").ToString = "" Then
                ''q = "SELECT MAX(ORDERID)+1 FROM APP_BLOG_DTL WHERE MAIN_CATEG='" & ddlMainTypes.SelectedValue.ToString & "'  "

                ''Dim ORDER_ID = GetFieldValue(cn, cmd, q)
                ''If ORDER_ID = "" Then
                ''    ORDER_ID = "1"
                ''End If

                q = ""
                q = q & "   INSERT INTO APP_BLOG (ITEM_CODE, "
                q = q & "    STATUS  ,"
                q = q & "    TITLE, "
                q = q & "    CONTENT, "
                q = q & "    FILENAME, "
                q = q & "    SYS_DATE ,"
                q = q & "    SYS_USERID "
                q = q & "    )"
                q = q & "  VALUES(@ITEM_CODE, @STATUS, @TITLE, @CONTENT, @FILENAME, dbo.GetServerDate(), @SYS_USERID) "
                cmd.Parameters.AddWithValue("@ITEM_CODE", CATEG)
                cmd.Parameters.AddWithValue("@STATUS", "Y")
                cmd.Parameters.AddWithValue("@TITLE", txtTitle.Text.ToString)
                cmd.Parameters.AddWithValue("@CONTENT", txtHTMLContent.Text.ToString)
                cmd.Parameters.AddWithValue("@FILENAME", NewFile)

                cmd.Parameters.AddWithValue("@SYS_USERID", Session("user_id").ToString())


                'q = q & "  VALUES("
                'q = q & "  N'" & CATEG & "', "
                'q = q & " 'Y' , "
                'q = q & "  N'" & txtTitle.Text.ToString & "' , "
                'q = q & "  N'" & txtHTMLContent.Text.ToString & "' , "
                'q = q & "  '" & NewFile & "' , "
                'q = q & "   dbo.GetServerDate(),"
                'q = q & "  '" & Session("user_id").ToString() & "'  "
                'q = q & "      ) "
                cmd.CommandText = q
                cmd.ExecuteNonQuery()




            Else
                CATEG = ViewState("sType_category").ToString
                q = ""
                q = q & " Update APP_BLOG  SET   "
                q = q & "    STATUS = '" & ddlStatus.SelectedValue.ToString & "',"
                q = q & "    TITLE= N'" & txtTitle.Text & "' ,"
                q = q & "    CONTENT= N'" & txtHTMLContent.Text.ToString & "' "
                If up.HasFiles Then
                    q = q & "    ,FILENAME='" & NewFile & "'  "
                End If
                q = q & "    WHERE  ITEM_CODE='" & ViewState("sType_category").ToString & "'  "
                cmd.CommandText = q
                cmd.ExecuteNonQuery()
            End If






            trans.Commit()
            saveFlag = True

        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
            trans.Rollback()

        Finally
            cmd.Dispose()
            trans.Dispose()
            cn.Close()
            cn.Dispose()
        End Try
        If saveFlag = True Then
            ViewState("sType_category") = ""
            ViewState("sType_code") = ""
            txtHTMLContent.Text = ""
            'ddlMainTypes.SelectedIndex = -1
            'ddlMainTypes_SelectedIndexChanged(Nothing, Nothing)

            txtTitle.Text = ""
            'loadData()

            ' btnEmpCancel_Click(Nothing, Nothing)
        End If
        SetGridStyle(grd)
    End Sub


    Public Shared Function ResizeImage(img As Drawing.Image, width As Integer, height As Integer) As Drawing.Image
        Dim newImage = New Bitmap(width, height)
        Using gr = Graphics.FromImage(newImage)
            gr.SmoothingMode = SmoothingMode.HighQuality
            gr.InterpolationMode = InterpolationMode.HighQualityBicubic
            gr.PixelOffsetMode = PixelOffsetMode.HighQuality
            gr.DrawImage(img, New Rectangle(0, 0, width, height))
        End Using
        Return newImage
    End Function
    Public Shared Function CreateRandomCode() As String
        Dim strPasswordCharacters As String = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ123456789"
        Dim randomNum As New Random()
        Dim chars As Char() = New Char(2 - 1) {}
        Try
            For i As Integer = 0 To 2 - 1
                chars(i) = strPasswordCharacters(CInt((strPasswordCharacters.Length) * randomNum.NextDouble()))
            Next
        Catch
            For i As Integer = 0 To 2 - 1
                chars(i) = strPasswordCharacters(CInt((strPasswordCharacters.Length) * randomNum.NextDouble()))
            Next
        End Try

        Return New String(chars)
    End Function


    Protected Sub btnUpdate_Command(sender As Object, e As CommandEventArgs)

        Dim q As String = ""
        If e.CommandName = "upd" Then
            ' btnEmpCancel.Visible = True

            'sWorklistID = e.CommandArgument 'wl_id
            Dim sITEM_CODE = e.CommandArgument.ToString.Split(",")(0).ToString
            ViewState("sType_category") = sITEM_CODE
            btnPlus.Visible = True
            Dim dt = GetTable("SELECT * FROM APP_BLOG  WHERE ITEM_CODE='" & sITEM_CODE & "'  ") 'GetTableCon("SELECT * FROM APP_BLOG  WHERE ITEM_CODE='" & sITEM_CODE & "'  ", "EnjazBlog") '
            Dim dr = dt(0)
            txtTitle.Text = dr("TITLE").ToString()
            txtHTMLContent.Text = dr("CONTENT").ToString()
            ddlStatus.Text = dr("STATUS").ToString()

        End If
        SetGridStyle(grd)
    End Sub

    Protected Sub ddlWorkEntity_SelectedIndexChanged(sender As Object, e As EventArgs)
        loadData()
    End Sub

    Protected Sub ddlArea_SelectedIndexChanged(sender As Object, e As EventArgs)
        loadData()
    End Sub

    Protected Sub ddlSubType_SelectedIndexChanged(sender As Object, e As EventArgs)
        loadData()
    End Sub

    Protected Sub ddlStatus_SelectedIndexChanged(sender As Object, e As EventArgs)
        loadData()
    End Sub

    Protected Sub ddlCompany_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub btnPlus_Click(sender As Object, e As EventArgs)
        Dim g As String = ""
        Dim UpOK As Boolean = False
        Dim NewFile As String = ""
        Dim imgPath As String = ""

        Dim imgSize As Integer = 0

        If IsNothing(ViewState("sType_category")) Then
            ShowPopUpMsg(Me.Page, "فضلا اختر مقال")
            Exit Sub
        End If



        'If txtTitle.Text = "" Then
        '    ShowPopUpMsg(Me.Page, "فضلا ادخل العنوان")
        '    Exit Sub
        'End If
        'Dim htmlContent As String = txtDesc.Value
        If txtHTMLContent.Text.ToString = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل نص المقال")
            Exit Sub
        End If

        If ViewState("sType_category").ToString = "" Then
            If Not up.HasFiles Then
                ShowPopUpMsg(Me.Page, "فضلا تحقق من صورة المنتج")
                Exit Sub
            End If
        End If

        ''If ViewState("sType_category").ToString = "" Then
        ''    If GetFieldValue("select TYPE_CATEGORY from TYPE_MST where upper(TYPE_DESC)='" & txtDesc.ToString.ToString.ToUpper & "'") <> "" Then
        ''        ShowPopUpMsg(Me.Page, "فضلا ادخل وصف اخر ")
        ''        Exit Sub
        ''    End If
        ''End If

        If up.HasFiles Then

            For Each postedFile As HttpPostedFile In up.PostedFiles

                imgSize = up.PostedFile.ContentLength
                g = Guid.NewGuid().ToString
                NewFile = g & Mid(up.FileName, up.FileName.LastIndexOf(".") + 1, 4)

                If postedFile.ContentLength > 4000000 Then
                    Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "Alert", "alert('File is too big.')", True)
                Else
                    'clsGenClass.ResizeImage(Image, 150, 40).
                    'postedFile.SaveAs(Server.MapPath("~/ImageStorage/" & NewFile))
                    If postedFile.ContentLength = 0 Then
                        ShowPopUpMsg(Me.Page, "no image")
                        Exit Sub
                    Else
                        Dim img = System.Drawing.Image.FromStream(postedFile.InputStream)
                        'If ddlMainTypes.SelectedValue = "MCLINKS" Then
                        '    ResizeImage(img, 800, 530).Save(Server.MapPath("~/ImageStorage/" & NewFile))
                        'Else
                        ResizeImage(img, 1024, 768).Save(Server.MapPath("~/ImageStorage/" & NewFile))
                        'End If


                    End If

                End If
            Next
        End If

        Dim cn As New SqlConnection
        Dim cmd As New SqlCommand
        Dim trans As SqlTransaction

        cn = OpenConnection()
        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        cmd.Connection = cn
        cmd.Transaction = trans

        SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Try

            q = "SELECT MAX(ORDERID)+1 FROM APP_BLOG_DTL WHERE ITEM_CODE='" & ViewState("sType_category").ToString & "'  "

            Dim ORDER_ID = GetFieldValue(cn, cmd, q)
            If ORDER_ID = "" Then
                ORDER_ID = "1"
            End If

            q = ""
            q = q & "   INSERT INTO APP_BLOG_DTL (ITEM_CODE, "
            q = q & "    TITLE, "
            q = q & "    CONTENT, "
            q = q & "    FILENAME,ORDERID  "
            q = q & "    )"
            q = q & "  VALUES(@ItemCode, @Title, @Content, @Filename, @OrderId) "
            cmd.Parameters.AddWithValue("@ItemCode", ViewState("sType_category").ToString)
            cmd.Parameters.AddWithValue("@Title", txtTitle.Text.ToString)
            cmd.Parameters.AddWithValue("@Content", txtHTMLContent.Text.ToString)
            cmd.Parameters.AddWithValue("@Filename", NewFile)
            cmd.Parameters.AddWithValue("@OrderId", ORDER_ID)

            'q = q & "  VALUES("
            'q = q & "  N'" & ViewState("sType_category").ToString & "', "
            'q = q & "  N'" & txtTitle.Text.ToString & "' , "
            'q = q & "  N'" & txtHTMLContent.Text.ToString & "' , "
            'q = q & "  '" & NewFile & "', " & ORDER_ID & "   "
            'q = q & "      ) "
            cmd.CommandText = q
                cmd.ExecuteNonQuery()










            trans.Commit()
            saveFlag = True

        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
            trans.Rollback()

        Finally
            cmd.Dispose()
            trans.Dispose()
            cn.Close()
            cn.Dispose()
        End Try
        If saveFlag = True Then
            ViewState("sType_category") = ""
            ViewState("sType_code") = ""
            txtHTMLContent.Text = ""
            'ddlMainTypes.SelectedIndex = -1
            'ddlMainTypes_SelectedIndexChanged(Nothing, Nothing)

            txtTitle.Text = ""
            'loadData()

            ' btnEmpCancel_Click(Nothing, Nothing)
        End If
        SetGridStyle(grd)
    End Sub
End Class

Contents of ucCancelConfirm.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucCancelConfirm.ascx.vb" Inherits="EnjazVB.ucCancelConfirm" %>
<%@ Register Src="~/Controls/ucCustomerInfo.ascx" TagPrefix="uc1" TagName="ucCustomerInfo" %>
<%@ Register Src="~/Controls/ucApprovals.ascx" TagPrefix="uc1" TagName="ucApprovals" %>
<%@ Register Src="~/Controls/ucAttachment.ascx" TagPrefix="uc1" TagName="ucAttachment" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <%-- <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>--%>
    <ContentTemplate>
        <fieldset>
            <legend class="noLegend"></legend>
            <div class="panel panel-primary">
                <div class="panel-heading text-center">
                    <h3 id="H2" class="panel-title" runat="server"><asp:Localize ID="locEOS_Details" runat="server" Text="الموافقة علي الغاء طلب"></asp:Localize></h3>
                    <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i>
                    </span>
                </div>
                <div class="panel-body">
                  
                    <div class="container-fluid">
                        <div class="form-horizontal">
                            <div class="form-group">
                                 <div class="col-sm-12">
                                <uc1:ucCustomerInfo runat="server" id="ucCustomerInfo" />
                            </div>
                                 </div>
                                 

                              <div class="form-group">
                                         <div class="col-sm-3">
        <asp:Label ID="Label1" runat="server" Text="الحسبة علي اي بنك" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlInvestmentAgency" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>
                                        
                                           <%-- <div class="col-sm-3">
                                                  <asp:Label ID="Label8" runat="server" Text="مبلغ الحسبة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtInvestmentIntialAmt" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>--%>
                                         <div class="col-sm-3">
                                              <div class="form-group">
                                                   <div class="col-sm-6">
                                                  <asp:Label ID="Label8" runat="server" Text="موظف البنك" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtInitBankEmp"  ReadOnly="true"     CssClass="form-control" runat="server" ></asp:TextBox>
                                               </div>
                                                   <div class="col-sm-6">
                                                            <asp:Label ID="Label18" runat="server" Text="المدة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtInitLong" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                               </div>
                                                  </div>
                                              </div>

                                        
                                               <div class="col-sm-3">
                                                 
                                                <span>
                                                    <div class="form-group">
                                                           <div class="col-sm-6">
                                                                <asp:Label ID="Label14" runat="server" Text="التمويل العقاري" Font-Bold="True" ></asp:Label>
                                                   <asp:TextBox ID="txtInitReal" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                 </div>
                                                          <div class="col-sm-6">
                                                         <asp:Label ID="Label15" runat="server" Text="التمويل الشخصي" Font-Bold="True" ></asp:Label>
                                                    <asp:TextBox ID="txtInitPersonal" TextMode="Number"  ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>
                                           </div>
                                                              </div>
                                                        </span>
                                                   </div>

      <div class="col-sm-3">
                                                 
   <span>
       <div class="form-group">
            <div class="col-sm-6">
                 <asp:Label ID="Label16" runat="server" Text="القسط" Font-Bold="True" ></asp:Label>
       <asp:TextBox ID="txtInitInstall" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox> 
  </div>
              <div class="col-sm-6">
                   <asp:Label ID="Label17" runat="server" Text="قسط الدعم" Font-Bold="True" ></asp:Label>
                <asp:TextBox ID="txtInitSuppInstall" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
</div>
</div>
  </span>
          </div>



                                    
                                    
                           
                                
                                </div>




                                     <div class="form-group">
                                            <div class="col-sm-3">
                                              <asp:Label ID="Label23" runat="server" Text="الخدمة المطلوبة" Font-Bold="True" ></asp:Label>
                                       <asp:DropDownList ID="ddlService" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                             </div>
                                       

                                             <div class="col-sm-3">
                                              <asp:Label ID="Label22" runat="server" Text="نوع العقار" Font-Bold="True" ></asp:Label>
                                                 <asp:DropDownList ID="ddlRealEstate" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                                
                                                 </div>
                                         <div class="col-sm-3">
                                            <asp:Label ID="lblRealEstatValue" runat="server" Text="قيمة العقار الاصلي" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtRealValue" TextMode="Number"  ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                           <div class="col-sm-1">
                                                  <asp:Label ID="Label9" runat="server" Text="يوجد متضامن" Font-Bold="True" ></asp:Label>
                                               <div class="col-sm-12">

                                           <span><asp:CheckBox  ID="ChYes" runat="server"  Enabled="false"   Text="نعم" onclick="MutExChkList(this);" /></span>
                                               <span><asp:CheckBox  ID="CheNo" runat="server" Enabled="false"  Text="لا" onclick="MutExChkList(this);" /></span>
                                              </div>
                                               </div>
                                         
                                             <div class="col-sm-2">
                                                  <asp:Label ID="Label32" runat="server" Text="هوية العميل" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtCustomId"  ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
                                  
                                         </div>

                                      <div class="form-group">
                                         <div class="col-sm-3">
                                              <asp:Label ID="Label27" runat="server" Text="جوال المالك" Font-Bold="True" ></asp:Label>
                                        <asp:TextBox ID="txtCusPhone" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                             </div>

      <div class="col-sm-3">
                                              <asp:Label ID="Label28" runat="server" Text="مدينة العقار" Font-Bold="True" ></asp:Label>
                                       <asp:DropDownList ID="ddlCity" runat="server" Enabled="false" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                             </div>

      <div class="col-sm-3">
                                              <asp:Label ID="Label29" runat="server" Text="معرفة العميل بالشركة" Font-Bold="True" ></asp:Label>
                                       <asp:DropDownList ID="ddlWayOfKnow" runat="server" Enabled="false" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                             </div>

      </div>
                                     <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label30" runat="server" Text="شرح حالة العميل" Font-Bold="True" ></asp:Label>
                                   <asp:TextBox ID="txtCustom_status" CssClass="form-control" ReadOnly="true" runat="server" TextMode="MultiLine" ></asp:TextBox>
                                </div>
                                        </div>


                                        <div runat="server" id="divEval" class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                 اجراءات التقييم 
                                </div>
                                <div class="panel-body">
  <div class="form-group">
       <div class="col-sm-3">
                                                  <asp:Label ID="Label10" runat="server" Text="مبلغ التقييم" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtEvalutionAmt" ReadOnly="true" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
                                       <div class="col-sm-3">
        <asp:Label ID="Label19" runat="server" Text="جهة التمويل" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlFinanceEntity" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>

       <div class="col-sm-3">
                 <asp:Label ID="Label34" runat="server" Text="سير المعاملة" Font-Bold="True" ></asp:Label>
           <asp:DropDownList ID="ddlProcType" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
     </div>

              <div runat="server" visible="false" class="col-sm-3">
                                                  <asp:Label ID="Label20" runat="server" Text="موظف البنك" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtEvalBankEmp" ReadOnly="true"    CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>


                                        </div>
                                     <div class="form-group">
                                          <div class="col-sm-3">
                                 
                                                  <asp:Label ID="Label36" runat="server" Text="يوجد التزامات " Font-Bold="True" ></asp:Label>
                                             <asp:DropDownList ID="ddlInstall" Enabled="false" AutoPostBack="true" OnSelectedIndexChanged="ddlInstall_SelectedIndexChanged" runat="server" CssClass="form-control input-sm" Width="100%">
                                                  <asp:ListItem Text="لا يوجد" Value="N"></asp:ListItem>
                                                  <asp:ListItem Text="يوجد" Value="Y"></asp:ListItem>
                                              </asp:DropDownList>
           </div>

      <div runat="server" id="divCompPay" visible="false" class="col-sm-3">
                                  <asp:Label ID="Label37" runat="server" Text="جهة السداد " Font-Bold="True" ></asp:Label>
                                            <asp:DropDownList Enabled="false" ID="ddlCompPay" runat="server" CssClass="form-control input-sm" Width="100%">
                                                <asp:ListItem Text="-اختر طريقة السداد-" Value=""></asp:ListItem>
                                                <asp:ListItem Text="سداد عن طريق الشركة" Value="C"></asp:ListItem>
                                                <asp:ListItem Text="سداد من خارج الشركة" Value="O"></asp:ListItem>
                                            </asp:DropDownList>
                                              </div>
                                         </div>

                                     <div runat="server" visible="false"  id="divInstallments" class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                    <h3 id="H4" class="panel-title" runat="server"><asp:Localize ID="Localize2" runat="server" Text="">بيانات الالتزامات المالية</asp:Localize></h3>
                                </div>
                                <div class="panel-body">
                                         


                          
                                      <div class="form-group">
                                          <div class="col-sm-12">
                                           
                                          <div class="col-sm-12">
                                                        <asp:GridView ID="grdInstall" runat="server" CssClass="table table-hover table-striped" AutoGenerateColumns="False" 
                        CellPadding="4" ForeColor="#333333" EmptyDataText="لا يوجد سجلات" GridLines="None" Width="100%" ShowFooter="True" >
                        <AlternatingRowStyle BackColor="White" />

                        <Columns>
                          
                            <asp:BoundField DataField="installAmt" DataFormatString="{0:d}" HeaderText="المبلغ" meta:resourcekey="BoundFieldResource1">
                                <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" />
                            </asp:BoundField>
 <asp:BoundField DataField="InstallmentEntity" HeaderText="شرح للمبلغ" >
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:BoundField>


                        </Columns>

                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                        <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                                          </div>
                                      </div>
                                      </div>


                                    </div>
        </div>  
</div>
                                                               <hr />
<div runat="server" id="divFinalApprove" class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                الموافقة النهائية 
                                </div>
                                <div class="panel-body">
  <div class="form-group">
       <div class="col-sm-3">
                                                  <asp:Label ID="lblPersonal" runat="server" Text="التمويل الشخصي" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtPersonalFin" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
             <div class="col-sm-3">
                                                  <asp:Label ID="lblRealEstate" runat="server" Text="التمويل العقاري" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtRealEstateFin" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
      <div class="col-sm-3">
                                                  <asp:Label ID="lblInstallment" runat="server" Text="القسط" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtInstallment" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
            <div class="col-sm-3">
                                                  <asp:Label ID="lblSupportInst" runat="server" Text="قسط الدعم" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtSupportInst" TextMode="Number"  ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                        </div>

                                      <div class="form-group">
                                          <div class="col-sm-3">
                                                  <asp:Label ID="lblLongtime" runat="server" Text="المدة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtLong" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
                                            <div class="col-sm-3">
                                                  <asp:Label ID="lblTax" runat="server" Text="الضريبة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtTax" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                            <div class="col-sm-3">
                                                  <asp:Label ID="lblPatch" runat="server" Text="الدفعة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtPatch" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                           <div class="col-sm-3">
                                                  <asp:Label ID="Label11" runat="server" Text="قيمة الشيك" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtChequAmt" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

 </div>

 <div class="form-group">
                                     <div class="col-sm-3">
                                                  <asp:Label ID="lblcommition" runat="server" Text="سعي من العميل" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtCustomerCommition" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                           <div class="col-sm-3">
                                                  <asp:Label ID="Label12" runat="server" Text="سعي من البنك" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtBankCommition" TextMode="Number"  ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
     


                                        </div>

                                   



                                       <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label31" runat="server" Text="ملاحظة او شرح" Font-Bold="True" ></asp:Label>
                                   <asp:TextBox ID="txtFinalStatus" ReadOnly="true" CssClass="form-control" runat="server" TextMode="MultiLine" ></asp:TextBox>
                                </div>
                                        </div>

                                      





                                    </div>
        </div>
</div>


                        <%-- <div class="form-group">
                               <div class="col-sm-12">
                         <asp:Label ID="Label7" runat="server" Text="الموافقات" Font-Bold="True" ></asp:Label>
                        <div class="form-group">
                                  <div style="height:350px;overflow:auto">
                                 <uc1:ucApprovals runat="server" id="ucApprovals" />
                                      </div>
                                </div>
                                   </div>
                             </div>--%>
                                                <div id="divInfoTabs" runat="server" class="form-group">
                            <div class="col-sm-12">
                                <ul class="nav nav-tabs">

                                           <li class="active"><a data-toggle="tab" href="#Attachment"><asp:Localize ID="lblApprovals" runat="server" Text="المرفقات" ></asp:Localize></a></li>
                                    <li><a data-toggle="tab" href="#Approvals"><asp:Localize ID="lblClearance" runat="server" Text="الموافقات" ></asp:Localize></a></li>


                                       </ul>
                                <div class="well tab-content">
                                    <div id="Attachment" class="tab-pane fade in active">
                                         <div style="height:350px;overflow:auto">
                                        <uc1:ucAttachment runat="server" id="ucAttachment" />
                                             </div>
                                    </div>
                                    <div id="Approvals" class="tab-pane fade">
                                         <div style="height:350px;overflow:auto">
                                       <uc1:ucApprovals runat="server" id="ucApprovals" />
                                             </div>
                                    </div>
                                    </div>
                                </div>
                                                                                </div>

       

                                <hr />


                                                <div class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                 اجراء الموافقة
                                </div>
                                <div class="panel-body">

                                        <div runat="server"  class="form-group">
  <div class="col-sm-3">
        <asp:Label ID="Label40" runat="server" Text="سبب الإلغاء" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlCancelReason" Enabled="false"  runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>
                                                </div>
                                       <div runat="server" visible="false" id="divChangeCategory" class="form-group">
  <div class="col-sm-3">
        <asp:Label ID="Label2" runat="server" Text="التصنيف" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddltypeCateg" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>
                                                </div>
                                    <div class="form-group">
                                          <div class="col-sm-12">
                                                   <asp:Label ID="Label21" runat="server" Text="تحديث الحالة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtRemarks" TextMode="MultiLine"    CssClass="form-control" runat="server" ></asp:TextBox>
                                               </div>
                                        </div>
<div class="form-group">
    <div class="col-sm-2">

           <asp:LinkButton ID="btnChangeCateg" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnChangeCateg_Click" 
                                      OnClientClick="if (confirm('هل تريد إلغاء وتصنيف ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; إلغاء وتصنيف
                                                        " ></asp:LinkButton>

        </div>
            <div class="col-sm-2">
                     
                                  <asp:LinkButton ID="btnTransferToOther" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnTransferToOther_Click" 
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تحويل لموظف اخر  
                                                        " ></asp:LinkButton>             
                </div>
                  <div class="col-sm-2">
                      <asp:LinkButton ID="btnConfirm" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnConfirm_Click" 
                                      OnClientClick="if (confirm('هل تريد إلغاء الطلب بالفعل ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; موافقة على الإلغاء
                                                        " ></asp:LinkButton>

                </div>                           
    </div>
                                
                             
                                    
                                </div>
                                </div>
                            </div>


                        </div>
                    </div>
                </div>
           </fieldset>
        </ContentTemplate>
    </asp:UpdatePanel>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>

     <div id="myModal" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="t4" class="modal-title" runat="server">
                            <asp:Localize ID="Localize3" runat="server" meta:resourcekey="Localize3Resource1" Text="تحويل الطلب"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                     <div class="col-sm-6">
                                                  <asp:Label ID="LabelSUP" runat="server" Text="الموظف" Font-Bold="True" ></asp:Label>
                                               <asp:DropDownList ID="ddlSup"   runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                        <%-- <asp:TextBox ID="txtEmployee"   ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>--%>
                                               
                      <asp:LinkButton ID="btnSave" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnSave_Click"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; تحويل
                                                        " ></asp:LinkButton>    
                     </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>
                    </div>

                </div>
            </div>
        </div>
          
<asp:UpdateProgress ID="UpdateProgress2" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>

Contents of ucCancelConfirm.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucCancelConfirm

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''H2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H2 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''locEOS_Details control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents locEOS_Details As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucCustomerInfo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucCustomerInfo As Global.EnjazVB.ucCustomerInfo

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlInvestmentAgency control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlInvestmentAgency As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label8 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label8 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitBankEmp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitBankEmp As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label18 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label18 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitLong control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitLong As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label14 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label14 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitReal control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitReal As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label15 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label15 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitPersonal control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitPersonal As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label16 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label16 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitInstall As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label17 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label17 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitSuppInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitSuppInstall As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label23 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label23 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlService control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlService As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label22 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label22 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlRealEstate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlRealEstate As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''lblRealEstatValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblRealEstatValue As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRealValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label9 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label9 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ChYes control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ChYes As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''CheNo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents CheNo As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''Label32 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label32 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCustomId control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCustomId As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label27 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label27 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCusPhone control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCusPhone As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label28 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label28 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCity control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCity As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label29 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label29 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlWayOfKnow control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlWayOfKnow As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label30 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label30 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCustom_status control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCustom_status As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divEval control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divEval As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label10 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label10 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtEvalutionAmt control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtEvalutionAmt As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label19 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label19 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlFinanceEntity control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlFinanceEntity As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label34 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label34 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlProcType control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlProcType As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label20 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label20 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtEvalBankEmp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtEvalBankEmp As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label36 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label36 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlInstall As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divCompPay control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCompPay As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label37 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label37 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCompPay control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCompPay As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divInstallments control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divInstallments As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''H4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize2 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''grdInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdInstall As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''divFinalApprove control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divFinalApprove As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lblPersonal control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblPersonal As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtPersonalFin control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPersonalFin As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblRealEstate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblRealEstate As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRealEstateFin control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRealEstateFin As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblInstallment control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblInstallment As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInstallment control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInstallment As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblSupportInst control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblSupportInst As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtSupportInst control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtSupportInst As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblLongtime control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblLongtime As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtLong control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtLong As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblTax control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblTax As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtTax control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtTax As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblPatch control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblPatch As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtPatch control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPatch As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label11 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label11 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtChequAmt control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtChequAmt As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblcommition control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblcommition As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCustomerCommition control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCustomerCommition As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label12 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label12 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtBankCommition control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtBankCommition As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label31 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label31 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtFinalStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtFinalStatus As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divInfoTabs control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divInfoTabs As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lblApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblApprovals As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''lblClearance control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblClearance As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucAttachment control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucAttachment As Global.EnjazVB.ucAttachment

    '''<summary>
    '''ucApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucApprovals As Global.EnjazVB.ucApprovals

    '''<summary>
    '''Label40 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label40 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCancelReason control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCancelReason As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divChangeCategory control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divChangeCategory As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddltypeCateg control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddltypeCateg As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label21 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label21 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRemarks As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnChangeCateg control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnChangeCateg As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnTransferToOther control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnTransferToOther As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnConfirm control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnConfirm As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress

    '''<summary>
    '''t4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents t4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize3 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''LabelSUP control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelSUP As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlSup control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlSup As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress2 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucCancelConfirm.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports WebClass.Sys.Classes
Imports EnjazVB.Sys.Classes


Public Class ucCancelConfirm
    Inherits System.Web.UI.UserControl
    Dim dtInstallment As New DataTable


    Public Property requestId As String
        Get
            Return ViewState("requestId")
        End Get
        Set(value As String)
            ViewState("requestId") = value
        End Set
    End Property

    Public Property WL_ID As String
        Get
            Return ViewState("WL_ID")
        End Get
        Set(value As String)
            ViewState("WL_ID") = value
        End Set
    End Property

    Public Property isQulity As Boolean
        Get
            Return Session("isQulity")
        End Get
        Set(value As Boolean)
            Session("isQulity") = value
        End Set
    End Property

    Public Property isSupvisor As Boolean
        Get
            Return Session("isSupvisor")
        End Get
        Set(value As Boolean)
            Session("isSupvisor") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            If Not (Request.QueryString("p1")) Is Nothing Then


                isSupvisor = IIf(GetFieldValue("SELECT IS_SUP FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
                isQulity = IIf(GetFieldValue("SELECT QUALITY FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)

                If isQulity And isSupvisor Then
                    btnChangeCateg.Visible = True
                Else
                    btnChangeCateg.Visible = False
                End If
                Dim Q As String = ""
                Q = "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' "
                If isSupvisor And Not isQulity Then
                    Q = "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' AND (EMP_NO='" & Session("emp_no").ToString & "' OR SUP='" & Session("emp_no").ToString & "')  "
                End If
                FillComboSelect(ddlSup, Q)
                Q = "SELECT type_category , type_desc FROM type_mst WHERE type_code='CR' ORDER BY TYPE_ABBR"
                FillComboSelect(ddlCancelReason, Q)

                FillComboSelect(ddltypeCateg, "select type_category, type_Desc from type_mst where type_code='TC' ORDER BY PERCENTAGE ")

                WL_ID = Request.QueryString("p1").ToString
                requestId = GetFieldValue("SELECT REF_ID FROM APP_WORKLIST WHERE WL_ID= '" & Request.QueryString("p1").ToString & "' ")
                If requestId = "" Then
                    requestId = GetFieldValueCon("SELECT REF_ID FROM APP_WORKLIST WHERE WL_ID= '" & Request.QueryString("p1").ToString & "' ", "Enjazcon")
                End If
                loadData()
                ucApprovals.DocNo = requestId
                ucCustomerInfo.DocNo = requestId
                ucAttachment.IsReadOnly = True
                ucAttachment.requestId = requestId

            End If
        End If
    End Sub

    Protected Sub btnTransferToOther_Click(sender As Object, e As EventArgs)
        OpenModal(Me.Page, "myModal")
    End Sub
    Protected Sub ddlInstall_SelectedIndexChanged(sender As Object, e As EventArgs)
        If ddlInstall.SelectedValue.ToString = "Y" Then
            divInstallments.Visible = True
            divCompPay.Visible = True
        Else
            divInstallments.Visible = False
            divCompPay.Visible = False
        End If
    End Sub
    Private Sub loadData()
        Dim Q As String = ""
        Q = ""
        q = q & " Select  h.trs_from as age, h.dept_head, ISNULL(ref_procid,'N') AS req_Importance,ISNULL(H.SERVICE,'F') AS SERVICE,M_REAL_VALUE,MORTEGAGE_VALUE,     "
        Q = Q & " h.REQ_BY As customer,h.emp_no,H.STATUS,H.CusEstateValue,H.CANCEL_REASON,  "
        Q = q & " h.CONTACT_NO AS phone, BK2.TYPE_DESC As BANK_DESC,WE.TYPE_DESC AS WORKPLACE,H.other2 as salary,  "
        q = q & " h.doc_no, Format(h.doc_date,'dd/MM/yyyy')doc_date , h.refcomp_code AS installments ,ISNULL(REF_DOCNO,'O')AS INSTALL_PAY, "
        q = q & " h.other4 as bank,h.other5 as investment_amt,h.other6 as readEstateAmt,h.other7 as corporate,e.emp_name , "
        q = q & "  h.other9 as financeEntity, h.other10 as  EvalutionAmt,h.other11 as PersonalFin, h.other12 as RealEstateFin, h.other13 as  Installment,    "
        q = q & " h.other14 as SupportInst,h.other15 as Longtime,h.other16 as Tax, h.other17 Patch, h.other18 as chequeAmt,h.other19 as CustomerCommition,h.other20 as BankCommition,   "
        q = q & " h.initPersonal,h.initReal,h.initInstall,h.initInSuppInstall,h.initLong,h.initEmpBank,h.EvalEmpBank ,h.service_req,h.realEstate_req "
        Q = Q & " ,h.CUSTOM_PHONE,h.CITY,h.WAY,h.CUSTOM_STATUS,h.FINAL_STATUS,H.CUST_ID,H.PAY_TRANCODE  "
        Q = Q & " from ARS_REQUEST_HDR h left join  emp_mst e  on h.emp_no=e.emp_no "
        'q = q & " left join app_worklist  w  on h.doc_no=w.ref_id  "
        'q = q & " left join app_processes p on w.next_process_id=p.process_id "
        Q = Q & "  left join      (SELECT        TYPE_CODE, TYPE_CATEGORY, TYPE_DESC, TYPE_ABBR, PERCENTAGE, COMP_CODE, CAT_SHORTNAME, REFCOMP_CODE, OTHER_CODE "
        Q = Q & "               From  TYPE_MST"
        Q = Q & "        Where (TYPE_CODE = 'BK')) BK2 ON   H.OTHER1 = BK2.TYPE_CATEGORY LEFT JOIN "
        Q = Q & "        (SELECT        TYPE_CODE, TYPE_CATEGORY, TYPE_DESC, TYPE_ABBR, PERCENTAGE, COMP_CODE, CAT_SHORTNAME, REFCOMP_CODE, OTHER_CODE "
        Q = Q & "               From  TYPE_MST"
        Q = Q & "        Where (TYPE_CODE = 'WE')) AS WE ON  H.OTHER3 = WE.TYPE_CATEGORY  "
        Q = Q & " where H.DOC_NO= '" & requestId & "' "

        Dim dt = GetTable(Q)
        If dt.Rows.Count = 0 Then
            dt = GetTableCon(Q, "Enjazcon")
        End If
        If dt.Rows.Count > 0 Then



            'empNo = dt(0)("emp_no").ToString

            If dt(0)("cancel_reason").ToString <> "" Then
                ddlCancelReason.SelectedValue = dt(0)("cancel_reason").ToString
            End If

            If dt(0)("bank").ToString <> "" Then
                ddlInvestmentAgency.SelectedValue = dt(0)("bank").ToString
                'txtInvestmentIntialAmt.Text = dt(0)("investment_amt").ToString
                txtInitBankEmp.Text = dt(0)("initEmpBank").ToString
                txtRealValue.Text = dt(0)("readEstateAmt").ToString
                txtCustomId.Text = dt(0)("CUST_ID").ToString

                txtInitReal.Text = dt(0)("initReal").ToString
                txtInitPersonal.Text = dt(0)("initPersonal").ToString
                txtInitInstall.Text = dt(0)("initInstall").ToString
                txtInitSuppInstall.Text = dt(0)("initInSuppInstall").ToString
                txtInitLong.Text = dt(0)("initLong").ToString

                If dt(0)("corporate").ToString = "Y" Then
                    ChYes.Checked = True
                Else
                    CheNo.Checked = True
                End If
            End If


            If dt(0)("service_req").ToString <> "" Then
                ddlService.SelectedValue = dt(0)("service_req").ToString
            End If
            If dt(0)("realEstate_req").ToString <> "" Then
                ddlRealEstate.SelectedValue = dt(0)("realEstate_req").ToString
            End If

            If dt(0)("financeEntity").ToString <> "" Then
                ddlFinanceEntity.SelectedValue = dt(0)("financeEntity").ToString
            End If

            If dt(0)("PAY_TRANCODE").ToString <> "" Then
                ddlProcType.SelectedValue = dt(0)("PAY_TRANCODE").ToString
            End If

            If dt(0)("CITY").ToString <> "" Then
                ddlCity.SelectedValue = dt(0)("CITY").ToString
            End If
            If dt(0)("WAY").ToString <> "" Then
                ddlWayOfKnow.SelectedValue = dt(0)("WAY").ToString
            End If

            txtCusPhone.Text = dt(0)("CUSTOM_PHONE").ToString
            txtFinalStatus.Text = dt(0)("FINAL_STATUS").ToString
            txtCustom_status.Text = dt(0)("CUSTOM_STATUS").ToString

            txtEvalBankEmp.Text = dt(0)("EvalEmpBank").ToString
            txtEvalutionAmt.Text = dt(0)("EvalutionAmt").ToString
            txtPersonalFin.Text = dt(0)("PersonalFin").ToString
            txtRealEstateFin.Text = dt(0)("RealEstateFin").ToString
            txtInstallment.Text = dt(0)("Installment").ToString
            txtSupportInst.Text = dt(0)("SupportInst").ToString
            txtLong.Text = dt(0)("Longtime").ToString
            txtTax.Text = dt(0)("Tax").ToString
            txtPatch.Text = dt(0)("Patch").ToString
            txtChequAmt.Text = dt(0)("chequeAmt").ToString
            txtCustomerCommition.Text = dt(0)("CustomerCommition").ToString
            txtBankCommition.Text = dt(0)("BankCommition").ToString
            ' txtEmployee.Text = dt(0)("emp_name").ToString

            If dt(0)("installments").ToString = "Y" Then
                ddlInstall.SelectedValue = "Y"
                'ChInstallYes.Checked = True
                'ChInstallNo.Checked = False
                Q = ""
                Q = Q & " SELECT * FROM INSTALLMENTS WHERE DOC_NO= '" & requestId & "' "

                dtInstallment = GetTable(Q)
                ViewState("dtInstallment") = dtInstallment

                grdInstall.DataSource = dtInstallment
                grdInstall.DataBind()
                MainClass.SetGridStyle(grdInstall)
                ddlCompPay.SelectedValue = dt(0)("INSTALL_PAY").ToString
                divInstallments.Visible = True
                divCompPay.Visible = True
            Else
                ddlInstall.SelectedValue = "N"
                divInstallments.Visible = False
                divCompPay.Visible = False
            End If

            'ddlEmployee.SelectedValue = dt(0)("emp_no").ToString
            If dt(0)("dept_head").ToString <> "" Then
                ddlSup.SelectedValue = dt(0)("dept_head").ToString
            End If



        End If





    End Sub


    Protected Sub imgInstallDel_Command(sender As Object, e As CommandEventArgs)

        If grdInstall.Rows.Count > 1 Then
            dtInstallment = ViewState("dtInstallment")
            dtInstallment.Rows.Remove(dtInstallment.Rows(Int(e.CommandArgument)))
            dtInstallment.AcceptChanges()
        Else

            dtInstallment = ViewState("dtInstallment")
            If dtInstallment Is Nothing Then
                Exit Sub
            End If
            If dtInstallment.Rows.Count <> 0 Then
                dtInstallment.Rows.Remove(dtInstallment.Rows(Int(e.CommandArgument)))
                dtInstallment.AcceptChanges()

            End If


            ViewState("dtInstallment") = Nothing

            'Exit Sub

        End If





        grdInstall.DataSource = dtInstallment
        grdInstall.DataBind()
        SetGridStyle(grdInstall, True)
        ViewState("dtInstallment") = dtInstallment
        'ViewState("Action") = clsGlobalVar.FormState.adStateDeleteMode
        'AddDel()
    End Sub


    Protected Sub btnSave_Click(sender As Object, e As EventArgs)

        If txtRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل ملاحظة ")
            Exit Sub
        End If

        Dim Q = ""

        Dim saveFlag As Boolean = False



        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction



        'cn = OpenConnection()
        '        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        '        cmd.Connection = cn
        '        cmd.Transaction = trans

        '        SetDateSession(cn, cmd)

        '        Try

        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)
                        Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        AppWl.WL03ProcessCode = AppProcess.ProcCancelConfirm.ToString.ToUpper
                        AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                        AppWl.WL05RefID = requestId
                        ' AppWl.WL99RefWLID = ViewState("p1")
                        AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL07Priority = "N"
                        AppWl.WL08CompCode = AppWl.WL08CompCode
                        AppWl.WL09SysUserID = AppWl.WL09SysUserID
                        AppWl.WL13Status = "O"
                        ' If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                        AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper()


                        AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                        AppWl.WL16RefStationID = ""
                        AppWl.WL17RefTask = ""
                        AppWl.WL18RefOther = "R"
                        AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                        AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        AppWl.WL98OnlyOwner = ddlSup.SelectedValue.ToString
                        'If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                        AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"



                        AppWl.WL99ModuleID = "R"
                        AppWl.WL99ApprLevel = "0"
                        InsertWorklist(cn, cmd, AppWl)
                        ' CloseWorklist(cn, cmd, worklistId, Session("UserID"), txtProcRemarks.Text)
                        CloseWorklist(cn, cmd, WL_ID, Session("user_id").ToString, "C", txtRemarks.Text)

                        Q = ""
                        Q = Q & " update ars_request_hdr set emp_no ='" & ddlSup.SelectedValue.ToString & "',DEPT_HEAD='" & GetFieldValue(cn, cmd, "select sup from emp_mst where emp_no='" & ddlSup.SelectedValue.ToString & "'") & "' where doc_no= '" & requestId & "'   "
                        cmd.CommandText = Q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(Q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try

            End Using
        End Using





        If saveFlag = True Then
            CloseModal(Me.Page, "myModal")
            ClosePage(Me.Page)
        End If

    End Sub

    Protected Sub btnConfirm_Click(sender As Object, e As EventArgs)
        If txtRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل ملاحظة ")
            Exit Sub
        End If
        Dim saveFlag As Boolean = False

        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        CloseWorklist(cn, cmd, WL_ID, Session("user_id").ToString, "C", txtRemarks.Text)




                        Dim q As String = ""

                        If isQulity And isSupvisor Then
                            q = ""
                            q = q & " update ars_request_hdr set status='D' "
                            q = q & " ,Q_CANCEL='Y'"
                            q = q & "  where doc_no = '" & requestId & "'   "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(q)
                        Else
                            Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                            AppWl.WL03ProcessCode = AppProcess.ProcCancelConfirm.ToString.ToUpper
                            AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                            AppWl.WL05RefID = requestId
                            ' AppWl.WL99RefWLID = ViewState("p1")
                            AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                            AppWl.WL07Priority = "N"
                            AppWl.WL08CompCode = AppWl.WL08CompCode
                            AppWl.WL09SysUserID = AppWl.WL09SysUserID
                            AppWl.WL13Status = "O"
                            AppWl.WL14NextProcessCode = AppProcess.ProcCancelConfirm.ToString.ToUpper
                            AppWl.WL15NextProcessDesc = "الجودة :" & GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                            AppWl.WL16RefStationID = ""
                            AppWl.WL17RefTask = ""
                            AppWl.WL18RefOther = "R"
                            AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                            '  AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                            AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.Predefined
                            AppWl.WL99Owners = GetTable(cn, cmd, "SELECT EMP_NO FROM EMP_MST WHERE STATUS_FLAG='A' AND IS_SUP='Y' AND QUALITY='Y' ")
                            AppWl.WL99PageLink = "../Pages/CancelConfirm.aspx"
                            AppWl.WL99ModuleID = "R"
                            AppWl.WL99ApprLevel = "0"
                            InsertWorklist(cn, cmd, AppWl)

                        End If




                        'q = ""
                        'q = q & " update ars_request_hdr set status='D' "
                        'If isQulity And isSupvisor Then
                        '    q = q & " ,Q_CANCEL='Y'"
                        'End If
                        'q = q & "  where doc_no = '" & requestId & "'   "
                        'cmd.CommandText = q
                        'cmd.ExecuteNonQuery()


                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            'RedirectURL("../pages/Worklist.aspx")
            ClosePage(Me.Page)
        End If
    End Sub

    Protected Sub btnChangeCateg_Click(sender As Object, e As EventArgs)
        divChangeCategory.Visible = True
        If txtRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل ملاحظة ")
            Exit Sub
        End If

        If ddltypeCateg.SelectedValue.ToString = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر التصنيف")
            Exit Sub
        End If



        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)
                        CloseWorklist(cn, cmd, WL_ID, Session("user_id").ToString, "C", txtRemarks.Text)




                        Dim q As String = ""

                        q = ""
                        q = q & " update ars_request_hdr set TYPE_CAT ='" & ddltypeCateg.SelectedValue.ToString & "' , status='D' "
                        q = q & " ,Q_CANCEL='Y'"
                        q = q & "  where doc_no = '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()

                        RunInOtherDb(q)





                    End Using

                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            'RedirectURL("../pages/Worklist.aspx")
            ClosePage(Me.Page)
        End If

    End Sub
End Class

Contents of ucCheckRequests.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucCheckRequests.ascx.vb" Inherits="EnjazVB.ucCheckRequests" %>
<%@ Register Src="~/Controls/ucCustomerInfo.ascx" TagPrefix="uc1" TagName="ucCustomerInfo" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <%-- <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>--%>
    <ContentTemplate>
        <fieldset>
            <legend class="noLegend"></legend>
            <div class="panel panel-primary">
                <div class="panel-heading text-center">
                    <h3 id="H2" class="panel-title" runat="server"><asp:Localize ID="locEOS_Details" runat="server" Text="متابعة الطلب"></asp:Localize></h3>
                    <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i>
                    </span>
                </div>
                <div class="panel-body">
                  
                    <div class="container-fluid">
                        <div class="form-horizontal">
                                <uc1:ucCustomerInfo runat="server" id="ucCustomerInfo" />
                            <hr />


                                                <div class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                 اجراء المتابعة
                                </div>
                                <div class="panel-body">


                                    <div class="form-group">
                                         <div class="col-sm-3">
        <asp:Label ID="lblEmp" runat="server" Text="تحويل الي الموظف" Font-Bold="True" ></asp:Label>
    </div>
                                         <div class="col-sm-3">
                                                 <asp:DropDownList ID="ddlEmployee" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>
                                        </div>
                                    
                                    <div class="form-group">
                                        <div class="col-sm-3">
                                            <asp:Label ID="LabelRemarks" runat="server" Text="ملاحظة او تعليق" Font-Bold="True" ></asp:Label>
                                            </div>
                                     <div class="col-sm-9">
                                    <asp:TextBox ID="txtProcRemarks" CssClass="form-control" runat="server" TextMode="MultiLine" ></asp:TextBox>
                                </div>
                                        </div>


                                            <div class="form-group">
            <div class="col-sm-4">
                                  <asp:LinkButton ID="btnSave" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnSave_Click"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; تحويل
                                                        " ></asp:LinkButton>
                </div>
                                                </div>
                                
                                </div>
                                </div>
                            </div>


                        </div>
                    </div>
                </div>
           </fieldset>
        </ContentTemplate>
    </asp:UpdatePanel>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>

Contents of ucCheckRequests.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucCheckRequests

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''H2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H2 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''locEOS_Details control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents locEOS_Details As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucCustomerInfo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucCustomerInfo As Global.EnjazVB.ucCustomerInfo

    '''<summary>
    '''lblEmp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblEmp As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlEmployee control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlEmployee As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''LabelRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRemarks As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtProcRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtProcRemarks As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucCheckRequests.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Public Class ucCheckRequests
    Inherits System.Web.UI.UserControl
    Dim q As String = ""

    Public Property requestId As String
        Get
            Return ViewState("requestId")
        End Get
        Set(value As String)
            ViewState("requestId") = value
        End Set
    End Property

    Public Property worklistId As String
        Get
            Return ViewState("worklistId")
        End Get
        Set(value As String)
            ViewState("worklistId") = value
        End Set
    End Property

    Public Property pageProcess As String
        Get
            Return ViewState("pageProcess")
        End Get
        Set(value As String)
            ViewState("pageProcess") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then

            ' btnSave.Visible = IIf(clsGenClass.GetFieldValue("select status from app_worklist where wl_id='" & ViewState("p1") & "'").Equals("C"), False, True)

            If Not (Request.QueryString("p1")) Is Nothing Then
                ViewState("p1") = Request.QueryString("p1").ToString
                ViewState("p2") = Request.QueryString("p2").ToString
                worklistId = ViewState("p1").ToString
                pageProcess = ViewState("p2").ToString
                requestId = GetFieldValue("select ref_id from app_worklist where wl_id='" & ViewState("p1").ToString & "'")
                If requestId = "" Then
                    requestId = GetFieldValueCon("select ref_id from app_worklist where wl_id='" & ViewState("p1").ToString & "'", "Enjazcon")
                End If
                If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                    lblEmp.Text = "تحويل الي المشرف"
                End If
                If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                    FillComboSelect(ddlEmployee, "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' AND  is_sup='Y'  ")
                Else
                    If Session("supper_user").ToString = "True" Then
                        FillComboSelect(ddlEmployee, "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' ")
                    Else
                        FillComboSelect(ddlEmployee, "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' AND SUP='" & Session("emp_no").ToString & "' ")
                    End If


                End If

                ucCustomerInfo.DocNo = requestId
                End If
            End If
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If
    End Sub

    Protected Sub btnSave_Click(sender As Object, e As EventArgs)

        If ddlEmployee.SelectedValue = "" Then
            If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                ShowPopUpMsg(Me.Page, "فضلا اختر المشرف")
            Else
                ShowPopUpMsg(Me.Page, "فضلا اختر الموظف")
            End If
            Exit Sub
            End If
            If txtProcRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اكتب تعليق")
            Exit Sub
            End If




        '    Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans


        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)
                        Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        AppWl.WL03ProcessCode = ViewState("p2").ToString
                        AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                        AppWl.WL05RefID = requestId
                        ' AppWl.WL99RefWLID = ViewState("p1")
                        AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL07Priority = "N"
                        AppWl.WL08CompCode = AppWl.WL08CompCode
                        AppWl.WL09SysUserID = AppWl.WL09SysUserID
                        AppWl.WL13Status = "O"
                        If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                            AppWl.WL14NextProcessCode = AppProcess.ProcCheck.ToString.ToUpper
                        Else
                            AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper
                        End If


                        AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                        AppWl.WL16RefStationID = ""
                        AppWl.WL17RefTask = ""
                        AppWl.WL18RefOther = "R"
                        AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                        AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        AppWl.WL98OnlyOwner = ddlEmployee.SelectedValue.ToString
                        If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                            AppWl.WL99PageLink = "../Pages/CheckRequests.aspx"
                        Else
                            AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                        End If


                        AppWl.WL99ModuleID = "R"
                        AppWl.WL99ApprLevel = "0"
                        InsertWorklist(cn, cmd, AppWl)
                        ' CloseWorklist(cn, cmd, worklistId, Session("UserID"), txtProcRemarks.Text)
                        CloseWorklist(cn, cmd, worklistId, Session("user_id").ToString, "C", txtProcRemarks.Text)
                        'If txtProcRemarks.Text <> "" Then
                        '    UpdateLastRemarks(cn, cmd, requestId, txtProcRemarks.Text)
                        'End If

                        q = ""
                        q = q & " update ars_request_hdr set " & IIf(pageProcess = AppProcess.ProcAssign.ToString.ToUpper, "dept_head", "emp_no") & " ='" & ddlEmployee.SelectedValue.ToString & "' where doc_no= '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(q)
                    End Using


                    trans.Commit()

                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try

            End Using
        End Using


        If saveFlag = True Then
            ' RedirectURL("../pages/Worklist.aspx")
            ClosePage(Me.Page)
        End If

    End Sub
End Class

Contents of ucContactUs.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucContactUs.ascx.vb" Inherits="EnjazVB.ucContactUs" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <ContentTemplate>
       <div  class="form-group" >
            <div class="row justify-content-center">
           <div class="col-sm-4"></div>
           <div class="col-sm-4">
            <asp:LinkButton ID="btnCallUs" OnClientClick="callNumber(); return false;"   runat="server" CssClass="btn small"  
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;bi bi-telephone&quot;&gt;&lt;/i&gt;&nbsp;&nbsp; إتصال
                                                        "></asp:LinkButton>
    <asp:LinkButton ID="btnWhatsapp" OnClientClick="openWhatsApp(); return false;"   runat="server" CssClass="btn"  
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;bi bi-whatsapp&quot;&gt;&lt;/i&gt;&nbsp;&nbsp; واتساب
                                                        "></asp:LinkButton>
               </div>
           <div class="col-sm-4"></div>
                </div>
           </div>
       <br />
       <br />
        <div  class="form-group" >
            <div class="col-sm-12">
  <div class="row justify-content-center">
      <div class="col-sm-4">
          <asp:RequiredFieldValidator ValidationGroup="ContactUsGroup" ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtname"
    ForeColor="Red" Display = "Dynamic" ErrorMessage = "فضلا تحقق من الاسم !" />
          </div>
      <div class="col-sm-4">
                       <asp:RegularExpressionValidator ValidationGroup="ContactUsGroup"  ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtEmail"
    ForeColor="Red" ValidationExpression="^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
    Display = "Dynamic" ErrorMessage = "فضلا تحقق من البريد الإلكتروني"/>
<asp:RequiredFieldValidator ValidationGroup="ContactUsGroup" ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtEmail"
    ForeColor="Red" Display = "Dynamic" ErrorMessage = "البريد الالكتروني مطلوب" />
          </div>
      <div class="col-sm-4">
                    <asp:RequiredFieldValidator ValidationGroup="ContactUsGroup" ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtSubject"
    ForeColor="Red" Display = "Dynamic" ErrorMessage = "فضلا تحقق من الموضوع !" />
          </div>
          </div>
                </div>
            </div>
   <div  class="form-group" >
 <div class="col-sm-12">
  <div class="row justify-content-center">
      <%-- <div class="col-sm-1">
       </div>--%>
       <div class="col-sm-4">
            <asp:TextBox ID="txtname" placeholder="الاسم" CssClass="form-control" runat="server"></asp:TextBox>
 </div>
       
       <div class="col-sm-4"> 
          <asp:TextBox ID="txtEmail" placeholder="البريد الإلكتروني" CssClass="form-control" runat="server"></asp:TextBox>
                                         </div>
    
       <div class="col-sm-4">
            <asp:TextBox ID="txtSubject" placeholder="الموضوع" CssClass="form-control" runat="server"></asp:TextBox>
                                         </div>
     

  </div>
     <br />
     <div  class="form-group" >
          <div class="col-sm-12">
  <div class="row justify-content-center">
     
       <div class="col-sm-4">
             <asp:RequiredFieldValidator ValidationGroup="ContactUsGroup" ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtMessage"
    ForeColor="Red" Display = "Dynamic" ErrorMessage = "فضلا تحقق من نص الرسالة !" />
           </div>
      <div class="col-sm-4">
           </div>
      <div class="col-sm-4">
           </div>
      </div>
              </div>
         </div>
     <div  class="form-group" >
 <div class="col-sm-12">
     <asp:TextBox ID="txtMessage" TextMode="MultiLine" placeholder="نص الرسالة" CssClass="form-control" runat="server"></asp:TextBox>
     </div>
         </div>
       <br />
       <div class="row justify-content-center">
       <div class="col-sm-1">
       </div>
       <div class="col-sm-3">
           
 </div>
       <div class="col-sm-1">
             </div>
<div class="col-sm-2">
     <asp:LinkButton ID="btnSend" ValidationGroup="ContactUsGroup"  runat="server" CssClass="btn"  OnClick="btnSend_Click"
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;bi bi bi-send&quot;&gt;&lt;/i&gt;&nbsp;&nbsp; ارسال
                                                        "></asp:LinkButton>
        
       </div>
       <div class="col-sm-1">
                                         </div>
       <div class="col-sm-3">
           
                                         </div>
       <div class="col-sm-1">
                                         </div>

  </div>
 </div>
       </div>
       </ContentTemplate>
    </asp:UpdatePanel>

<script type="text/javascript">
        function callNumber() {
          window.location.href = 'tel:' + '0533316852';
        }

        function openWhatsApp() {
            window.location.href = 'https://wa.me/' + '966533316852'  ;
       }
    </script>

Contents of ucContactUs.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucContactUs

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''btnCallUs control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnCallUs As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnWhatsapp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnWhatsapp As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''RequiredFieldValidator2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator2 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''RegularExpressionValidator2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RegularExpressionValidator2 As Global.System.Web.UI.WebControls.RegularExpressionValidator

    '''<summary>
    '''RequiredFieldValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator1 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''RequiredFieldValidator3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator3 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtname control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtname As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''txtEmail control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtEmail As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''txtSubject control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtSubject As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''RequiredFieldValidator4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator4 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtMessage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtMessage As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnSend control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSend As Global.System.Web.UI.WebControls.LinkButton
End Class

Contents of ucContactUs.ascx.vb:

Imports System.Net
Imports System.Net.Mail
Imports System.Net.Configuration
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Public Class ucContactUs
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnSend_Click(sender As Object, e As EventArgs)
        Send(sender, e)
    End Sub

    Protected Sub Send(ByVal sender As Object, ByVal e As EventArgs)
        If txtname.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا تحقق من الاسم")
            Exit Sub
        End If
        If txtEmail.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا تحقق من البريد الإلكتروني")
            Exit Sub
        End If
        Dim sendFlag As Boolean = False
        Try
            Dim smtpSection As SmtpSection = CType(ConfigurationManager.GetSection("system.net/mailSettings/smtp"), SmtpSection)
            Dim mm As MailMessage = New MailMessage(smtpSection.From, "injazAlamlak.re@gmail.com")
            mm.Subject = txtSubject.Text.Trim
            mm.Body = "الاسم :" & txtname.Text & "<br /><br />البريد : " & txtEmail.Text & "<br />" & txtMessage.Text
            mm.IsBodyHtml = True



            Dim smtp As SmtpClient = New SmtpClient
            smtp.Host = smtpSection.Network.Host
            smtp.EnableSsl = smtpSection.Network.EnableSsl
            Dim networkCred As NetworkCredential = New NetworkCredential(smtpSection.Network.UserName, smtpSection.Network.Password)
            smtp.UseDefaultCredentials = smtpSection.Network.DefaultCredentials
            smtp.Credentials = networkCred
            smtp.Port = smtpSection.Network.Port
            smtp.Send(mm)
            sendFlag = True
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
        End Try
        If sendFlag Then
            txtname.Text = ""
            txtEmail.Text = ""
            txtSubject.Text = ""
            txtMessage.Text = ""
            Dim message As String = "شكراً لتواصلك معنا , تم استلام رسالتك ."

            ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType(), "Alert", "<script type = 'text/javascript'>window.onload=new function(){setTimeout(""alert('" + message + "');window.location='/../pages/HomePage.aspx';"", 1000)};</script>", False)
            'ShowPopUpMsg(Me.Page, "شكراً لتواصلك معنا , تم استلام رسالتك .")
        End If

    End Sub
End Class

Contents of ucCreateRequest.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucCreateRequest.ascx.vb" Inherits="EnjazVB.ucCreateRequest" %>
<%--<%@ Register Src="~/Controls/ucPrivacyPolicy.ascx" TagPrefix="uc1" TagName="ucPrivacyPolicy" %>--%>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <%-- <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>--%>
    <ContentTemplate>
        <fieldset>
            <legend class="noLegend"></legend>
            <div class="panel panel-primary">
                <div id="divHeader" runat="server" style="background: linear-gradient(TO RIGHT ,#BF953F,#FCF6BA,#B38728,#FBF5B7,#AA771C); font-size: 2vw; font-weight: bold;" class="panel-heading text-center">
                    <h2 id="H2" class="panel-title" runat="server">
                        <asp:Localize ID="Req_Details" runat="server" Text=" طلب تمويل عقاري"></asp:Localize></h2>
                    <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i>
                    </span>
                </div>
                <div class="panel-body">

                    <div class="container-fluid">
                        <div class="form-horizontal">
                            <div style="overflow:no-display">
                                <div style="overflow:auto">
                           <div class="form-group">


                                  <div class="col-sm-12">
                                <div class="col-sm-3">
                                </div>
                                <div class="col-sm-6">
                                       <div id="divULink" visible="false" runat="server" class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label1" runat="server" Text="الرابط الخاص بك " Font-Bold="True"></asp:Label><span>
                                            <asp:TextBox ID="txtULink"  ReadOnly="true" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                                 <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label2" runat="server" Text="الخدمة المطلوبة" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlService" AutoPostBack="true" OnSelectedIndexChanged="ddlService_SelectedIndexChanged" runat="server" CssClass="form-control" Width="100%">
                                                <asp:ListItem Value="F" Text="تمويل" Selected="True"></asp:ListItem>
                                             <asp:ListItem Value="M" Text="فك رهن واعادة تمويل" ></asp:ListItem>
                                            </asp:DropDownList>
</div>
                                    </div>
                                    
                                       <div runat="server" id="divRealValue" visible="false" class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="lbl" runat="server" Text="قيمة العقار السوقية" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtRealValue" TextMode="Number" placeholder="فضلا ادخل القيمة السوقية" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                                    <div  runat="server" id="divMortegage" visible="false"  class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label6" runat="server" Text="مبلغ الرهن" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtMortegage"  TextMode="Number"  placeholder="فضلا ادخل قيمة الرهن" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>


                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="LabelRequestedBy" runat="server" Text="الاسم" Font-Bold="True"></asp:Label><span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtname" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtname" placeholder="فضلا ادخل الاسم" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="LabelRequestID" runat="server" Text="رقم الجوال" Font-Bold="True"></asp:Label><span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtPhone" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <span>
                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                                                    ControlToValidate="txtPhone" ErrorMessage="تحقق من رقم الجوال" ForeColor="Red"
                                                    ValidationExpression="[0-9]{10}"></asp:RegularExpressionValidator>
                                            </span>
                                            <asp:TextBox ID="txtPhone" TextMode="Number" MaxLength="10" placeholder="05 فضلا رقم الجوال" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label3" runat="server" Text="جهة العمل" Font-Bold="True"></asp:Label><span><asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="ddlWorkPlace"
                                                ErrorMessage="*" ForeColor="Red" InitialValue=""></asp:RequiredFieldValidator></span>
                                            <asp:DropDownList ID="ddlWorkPlace" runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>

                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="LabelRequestedDate" runat="server" Text="الراتب" Font-Bold="True"></asp:Label>
                                            <span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="txtsalary" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtsalary" TextMode="Number" placeholder="فضلا ادخل الراتب" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label4" runat="server" Text="بنك ايداع الراتب" Font-Bold="True"></asp:Label><span><asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="ddlBank"
                                                ErrorMessage="*" ForeColor="Red" InitialValue=""></asp:RequiredFieldValidator></span>
                                            <asp:DropDownList ID="ddlBank" runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>

                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label5" runat="server" Text="العمر" Font-Bold="True"></asp:Label><span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" ControlToValidate="txtAge" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtAge" TextMode="Number" placeholder="فضلا ادخل العمر" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                               <div runat="server"  id="divCustomEstateValue" class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="lblEstateValue" runat="server" Text="قيمة العقار ان وجد" Font-Bold="True"></asp:Label>
                                             <asp:TextBox ID="txtCusEstateValue" Text="0" TextMode="Number" placeholder="ادخل قيمة العقار ان وجد" CssClass="form-control" runat="server"></asp:TextBox>
                                      </div>
                                    </div>
                     <%--               <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="lblLoans" runat="server" Text="عليك التزامات مالية ؟" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlLoans" runat="server" CssClass="form-control input-sm" Width="100%">
                                                <asp:ListItem Text="نعم" Value="Y" Selected="True"></asp:ListItem>
                                                <asp:ListItem Text="لا" Value="N"></asp:ListItem>
                                            </asp:DropDownList>

                                        </div>
                                    </div>--%>
                                    <br />

                                    <div class="form-group">
                                        <div class="col-sm-12">
                                             <asp:LinkButton ValidationGroup="PrivacyGroup" OnClick="btnPolicyDetails_Click" runat="server" Text="سياسة الخصوصية  Privacy Policy" ID="btnPolicyDetails"></asp:LinkButton>
                                        </div>
                                    </div>


                                    <div class="form-group">
                                        <div class="col-sm-4">
                                            <asp:LinkButton ID="btnSave" style="background:#C5B358;border-color:#BF953F;"  runat="server" CssClass="btn btn-primary btn-md" OnClick="btnSave_Click"
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; حفظ
                                                        "></asp:LinkButton>
                                          
                                           <%--   <asp:LinkButton ID="btnCopy"  onclick="CopyToClipboard();"  style="background:#C5B358;border-color:#BF953F;"  runat="server" CssClass="btn btn-primary btn-md" 
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; حفظ
                                                        "></asp:LinkButton>--%>

                                    
                                        </div>


                                    </div>

                                </div>
                                <div class="col-sm-3">
                                </div>
                                      </div>

                           
                               </div>
                                </div>
                                </div>

                            
 </div>
                    </div>
                </div>
            </div>
        </fieldset>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>



<div id="myModal" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <asp:Button ValidationGroup="closepop" ID="btcloseUp" OnClick="btcloseUp_Click" runat="server" Text="إغلاق" ></asp:Button>
                        <h4 id="t4" class="modal-title" runat="server">
                            <asp:Localize ID="Localize3" runat="server" meta:resourcekey="Localize3Resource1" Text="سياسية الخصوصية"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         <div class="form-group">
                             <div class="col-sm-12">
                       <%-- <uc1:ucPrivacyPolicy runat="server" id="ucPrivacyPolicy" />--%>
                       </div>
                             </div>
                       
                    </div>
                    <div class="modal-footer">
                                  <asp:Button ValidationGroup="closepop" ID="btnClosepop" OnClick="btcloseUp_Click" runat="server" Text="إغلاق" ></asp:Button>
                    </div>

                </div>
            </div>
        </div>



<script>
function ShowMessage()
{
      alert('تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة');
      window.location.href='~/pages/MainPage.aspx';
}
</script>


Contents of ucCreateRequest.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucCreateRequest

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''divHeader control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divHeader As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''H2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H2 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Req_Details control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Req_Details As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''divULink control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divULink As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtULink control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtULink As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlService control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlService As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divRealValue As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lbl control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lbl As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRealValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divMortegage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divMortegage As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label6 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtMortegage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtMortegage As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''LabelRequestedBy control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestedBy As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator1 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtname control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtname As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''LabelRequestID control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestID As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator2 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''RegularExpressionValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RegularExpressionValidator1 As Global.System.Web.UI.WebControls.RegularExpressionValidator

    '''<summary>
    '''txtPhone control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPhone As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator6 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''ddlWorkPlace control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlWorkPlace As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''LabelRequestedDate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestedDate As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator3 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtsalary control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtsalary As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator5 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''ddlBank control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlBank As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label5 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator4 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtAge control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtAge As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divCustomEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCustomEstateValue As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lblEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblEstateValue As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCusEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCusEstateValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnPolicyDetails control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnPolicyDetails As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress

    '''<summary>
    '''btcloseUp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btcloseUp As Global.System.Web.UI.WebControls.Button

    '''<summary>
    '''t4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents t4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize3 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''btnClosepop control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnClosepop As Global.System.Web.UI.WebControls.Button
End Class

Contents of ucCreateRequest.ascx.vb:

Imports Oracle.ManagedDataAccess.Client
Imports WebClass.Sys.Classes
Imports WebClass.Sys.webclass.mainclass
Imports WebClass.Sys.Classes.clsGlobarVar
Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization

Public Class ucCreateRequest
    Inherits System.Web.UI.UserControl
    Dim q As String = ""

    Public Property DocNo As String
        Get
            Return ViewState("DocNo")
        End Get
        Set(value As String)
            ViewState("DocNo") = value
        End Set
    End Property

    Public Property Source As String
        Get
            Return ViewState("Source")
        End Get
        Set(value As String)
            ViewState("Source") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If

        If Not IsPostBack Then

            If Not IsNothing(Session("emp_no")) Then
                ' lblLoans.Text = "عليه التزامات مالية ؟"
                LabelRequestedBy.Text = "اسم العميل"
                '  divHeader.Style.Remove("style")
                divHeader.Style.Remove("background")
                btnSave.Style.Remove("background")
                btnSave.Style.Remove("border-color")
                divULink.Visible = True
                txtULink.Text = "http://enjazaqar.com/pages/CreateRequest.aspx?P1=" & Session("emp_no").ToString & "&P2=x1@2"
            End If
            If Not (Request.QueryString("P1")) Is Nothing Then
                ViewState("P1") = Request.QueryString("P1").ToString
            End If

            If Not (Request.QueryString("P3")) Is Nothing Then
                Source = Request.QueryString("P3").ToString
            Else
                Source = ""
            End If

            q = "select type_category,type_Desc from type_mst where type_Code='BK' AND TYPE_ABBR='Y'"
            FillComboSelect(ddlBank, q)
            q = "select type_category,type_Desc from type_mst where type_Code='WE' ORDER BY  TYPE_ABBR "
            FillComboSelect(ddlWorkPlace, q)


        End If
    End Sub

    Protected Sub btTest_Click(sender As Object, e As EventArgs)
        ' ShowPopUpMsg(Me.Page, GetFieldValue("select ref_id from app_worklist"))
        ' Dim currentDate As String = "13/09/2020"
        ' Dim convertedDate As DateTime = DateTime.ParseExact(currentDate, "dd/MM/yyyy", CultureInfo.InvariantCulture)

        ' Convert.ToDateTime(currentDate)
        ShowPopUpMsg(Me.Page, CDate(GetServerDate("", "")).ToString("dd/MM/yyyy"))
    End Sub

    Protected Sub btnSave_Click(sender As Object, e As EventArgs)
        Dim CNT = 0
        If txtname.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الاسم")
            Exit Sub
        End If
        If txtname.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الاسم")
            Exit Sub
        End If
        If txtPhone.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الجوال")
            Exit Sub
        End If
        If txtsalary.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الراتب")
            Exit Sub
        End If
        If txtAge.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل العمر")
            Exit Sub
        End If
        If ddlBank.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا تحقق من البنك")
            Exit Sub
        End If
        If ddlWorkPlace.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا تحقق من جهة العمل")
            Exit Sub
        End If

        If ddlService.SelectedValue = "M" Then
            If txtRealValue.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل القيمة السوقية للعقار")
                Exit Sub
            End If
            If txtMortegage.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الرهن")
                Exit Sub
            End If
        End If
        If ddlService.SelectedValue = "F" Then
            If txtCusEstateValue.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل قيمة العقار ان وجد وان لم يوجد ادخل 0")
                Exit Sub
            End If
        End If

        'If GetFieldValue("SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE LTRIM(RTRIM(CONTACT_NO)) = LTRIM(RTRIM(N'" & txtPhone.Text & "'))  ") <> "" Then
        '    If Not IsNothing(Session("emp_no")) Then
        '        ShowPopUpMsg(Me.Page, "العميل لديه طلب بالفعل")
        '    Else
        '        ShowPopUpMsg(Me.Page, "لديك طلب بالفعل الرجاء التواصل معنا")
        '    End If

        '    Exit Sub
        'End If

        If Not IsNothing(Session("emp_no")) Then
            If GetFieldValue("SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE STATUS='O' AND  LTRIM(RTRIM(CONTACT_NO)) = LTRIM(RTRIM(N'" & txtPhone.Text & "'))  ") <> "" Then
                ShowPopUpMsg(Me.Page, "العميل لديه طلب بالفعل")
                Exit Sub
            End If
        Else

            If GetFieldValue("SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE STATUS='O' AND  LTRIM(RTRIM(CONTACT_NO)) = LTRIM(RTRIM(N'" & txtPhone.Text & "')) AND FORMAT(DOC_DATE,'dd/MM/yyyy')=FORMAT(EnjazVB.GetServerDate(),'dd/MM/yyyy')  ") <> "" Then
                ShowPopUpMsg(Me.Page, "لديك طلب بالفعل الرجاء التواصل معنا")
                Exit Sub
            End If

            CNT = CInt(GetFieldValue("SELECT COUNT(DOC_NO)  FROM ARS_REQUEST_HDR WHERE   LTRIM(RTRIM(CONTACT_NO)) = LTRIM(RTRIM(N'" & txtPhone.Text & "')) AND DATEDIFF(DAY,DOC_DATE,EnjazVB.GetServerDate())>=4  "))
            If CNT > 1 Then
                ShowPopUpMsg(Me.Page, "لديك طلب بالفعل الرجاء التواصل معنا")
                Exit Sub
            End If
        End If




        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        If GetFieldValue(cn, cmd, "SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE LTRIM(RTRIM(CONTACT_NO))= LTRIM(RTRIM(N'" & txtPhone.Text & "'))  AND STATUS='O'  AND FORMAT(DOC_DATE,'dd/MM/yyyy')=FORMAT(EnjazVB.GetServerDate(),'dd/MM/yyyy') ") = "" Then

                            btnSave.Enabled = False
                            DocNo = GetSeries(cn, cmd, "R")
                            ViewState("ServerDate") = GetServerDate(cn, cmd)
                            q = ""
                            q = ""
                            q = q & " INSERT INTO ars_request_hdr  "
                            q = q & " ( "
                            q = q & "      tran_type, "
                            q = q & "      doc_no, "
                            q = q & "      doc_date, "
                            q = q & "      REQ_DATE ,"
                            q = q & "      yr ,"
                            q = q & "      emp_no, "
                            q = q & "      br_assign, "
                            q = q & "      dept_head, "
                            q = q & "      CUST_ID, "
                            q = q & "      req_action, "
                            q = q & "      req_by, "
                            q = q & "      trs_from, "
                            q = q & "      trs_to, "
                            q = q & "      status, "
                            q = q & "      subject, "
                            q = q & "      sys_userid, "
                            q = q & "      comp_code, "
                            q = q & "      refcomp_code, "
                            q = q & "      contact_no, "

                            q = q & "      other1, "  'bank
                            q = q & "      other2, " 'salary
                            q = q & "      other3, "  'workplace 
                            'q = q & "      other8, "
                            q = q & "      SERVICE, "
                            If ddlService.SelectedValue.ToString = "M" Then
                                q = q & "      M_REAL_VALUE, "
                                q = q & "      MORTEGAGE_VALUE, "
                            End If
                            q = q & "     CusEstateValue,"
                            q = q & "      ref_docno ,DUP"
                            q = q & " ) "
                            q = q & " VALUES ("
                            q = q & "      'R',"
                            q = q & "      @doc_no,"
                            q = q & "      FORMAT(convert(date,'" & CDate(ViewState("ServerDate")) & "'),'dd/MM/yyyy') , "
                            q = q & "      '" & CDate(ViewState("ServerDate")).ToString("dd/MM/yyyy") & "' , "
                            q = q & "      '" & CInt(CDate(ViewState("ServerDate")).ToString("yyyy")) & "' , "
                            If Not IsNothing(Session("emp_no")) Then
                                q = q & "      '" & Session("emp_no").ToString & "',"
                            Else
                                If Not IsNothing(ViewState("P1")) Then
                                    q = q & "      '" & ViewState("P1").ToString & "',"
                                Else
                                    q = q & "      '',"
                                End If


                            End If
                            If Not IsNothing(Session("emp_no")) Then
                                q = q & "      'EMP',"
                            Else
                                '  q = q & "      'CUS',"
                                If Source = "" Then
                                    q = q & "      'CUS',"
                                Else
                                    q = q & "      '" & Source & "',"
                                End If
                            End If

                            If Not IsNothing(Session("emp_no")) Then
                                q = q & "      '" & GetFieldValue("select sup from emp_mst where emp_no='" & Session("emp_no").ToString & "'") & "',"
                            Else
                                q = q & "      '',"
                            End If


                            q = q & "      '',"
                            q = q & "      '1',"
                            q = q & "      N'" & txtname.Text & "',"
                            q = q & "      N'" & txtAge.Text & "'," 'trs_from --age
                            q = q & "      ''," 'trs_to
                            q = q & "      'O',"
                            q = q & "      '',"
                            q = q & "      '',"
                            q = q & "      '',"
                            q = q & "      '',"
                            q = q & "       N'" & txtPhone.Text & "', "
                            q = q & "      '" & ddlBank.SelectedValue.ToString & "', "
                            q = q & "      N'" & txtsalary.Text & "', "
                            q = q & "      '" & ddlWorkPlace.Text.ToString & "', "
                            'q = q & "      '" & ddlLoans.SelectedValue.ToString & "', " 'Quotation or Cash
                            q = q & "      '" & ddlService.SelectedValue.ToString & "', "
                            If ddlService.SelectedValue.ToString = "M" Then
                                q = q & "       N'" & txtRealValue.Text & "', "
                                q = q & "      N'" & txtMortegage.Text & "', "
                            End If
                            q = q & "      N'" & txtCusEstateValue.Text & "', "
                            q = q & "      '' ,'" & IIf(CNT > 0, "Y", "N") & "' "
                            q = q & "      ) "
                            cmd.CommandText = q
                            If q.ToString.ToUpper.Contains("DELETE") Or q.ToString.ToUpper.Contains("UPDATE") Or q.ToString.ToUpper.Contains("DROP") Or q.ToString.ToUpper.Contains("TRUNCATE") Then
                                Throw New Exception("try again !")
                            End If
                            cmd.Parameters.AddWithValue("@doc_no", DocNo)
                            cmd.ExecuteNonQuery()

                            Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                            AppWl.WL03ProcessCode = AppProcess.ProcCreate.ToString.ToUpper
                            AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                            AppWl.WL05RefID = DocNo
                            ' AppWl.WL99RefWLID = ViewState("p1")
                            AppWl.WL06RefDate = CDate(ViewState("ServerDate")).ToString("dd/MM/yyyy")
                            AppWl.WL07Priority = "N"
                            AppWl.WL08CompCode = AppWl.WL08CompCode
                            AppWl.WL09SysUserID = AppWl.WL09SysUserID
                            AppWl.WL13Status = "O"
                            If Not IsNothing(Session("emp_no")) Or Not IsNothing(ViewState("P1")) Then
                                AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper
                            Else
                                AppWl.WL14NextProcessCode = AppProcess.ProcAssign.ToString.ToUpper
                            End If

                            AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                            AppWl.WL16RefStationID = ""
                            AppWl.WL17RefTask = ""
                            AppWl.WL18RefOther = "R"
                            AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                            If Not IsNothing(Session("emp_no")) Or Not IsNothing(ViewState("P1")) Then
                                AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                                If Not IsNothing(Session("emp_no")) Then
                                    AppWl.WL98OnlyOwner = Session("emp_no").ToString
                                Else
                                    AppWl.WL98OnlyOwner = ViewState("P1").ToString
                                End If

                                AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                            Else
                                AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                                AppWl.WL99PageLink = "../Pages/CheckRequests.aspx"
                            End If

                            AppWl.WL99ModuleID = "R"
                            AppWl.WL99ApprLevel = "0"
                            InsertWorklist(cn, cmd, AppWl)




                            trans.Commit()
                            saveFlag = True
                        End If
                    End Using
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then

            If Not IsNothing(Session("emp_no")) Then
                ShowPopUpMsg(Me.Page, "تم رفع الطلب بنجاح ")
                clear()
                ' RedirectURL("~/pages/Worklist.aspx")
            Else
                ' ShowPopUpMsg(Me.Page, "تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة")
                'Response.Write("<script language='javascript'>window.alert('تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة');window.location='~/pages/MainPage.aspx';</script>")
                ' RedirectURL("~/pages/MainPage.aspx")
                '  Windows.location.href = "~/pages/MainPage.aspx"

                'ScriptManager.RegisterStartupScript(Me, Me.GetType(), "key", "ShowMessage()", True)
                clear()
                Dim message As String = "تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة"

                ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType(), "Alert", "<script type = 'text/javascript'>window.onload=new function(){setTimeout(""alert('" + message + "');window.location='/../pages/HomePage.aspx';"", 1000)};</script>", False)
                ' ScriptManager.RegisterClientScriptBlock(_page, _page.GetType(), "ModalScript", sb.ToString(), False)


                ' ShowPopUpMsg(Me.Page, "تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة")
                ' Threading.sleep()
                'Dim meta As New HtmlMeta()
                'meta.HttpEquiv = "Refresh"
                'meta.Content = "3;url=~/pages/MainPage.aspx"
                'Me.Page.Controls.Add(meta)
                'Label1.Text = "You will now be redirected in 5 seconds"


                'Page.ClientScript.RegisterStartupScript(Me.Page, Me.Page.GetType(), "Redirect", script, True)
                'Page.ClientScript.RegisterStartupScript(Me.[GetType](), "Redirect", script, True)

                ''''''ScriptManager.RegisterStartupScript(_Page.Page, _Page.GetType(), "showalert", sb.ToString(), True)
            End If

        End If

    End Sub

    Public Sub clear()
        txtname.Text = ""
        txtPhone.Text = ""
        txtsalary.Text = ""
        txtAge.Text = ""
        txtRealValue.Text = ""
        txtMortegage.Text = ""
        ddlService.SelectedIndex = -1
        ddlBank.SelectedIndex = -1
        ddlWorkPlace.SelectedIndex = -1
    End Sub

    Protected Sub btnCopy_Click(sender As Object, e As EventArgs)
        ' Clipboard.SetText("")
        ' My.Computer.Clipboard.SetText("This is a test string.")
        ' Clipboard.SetText("")
    End Sub

    Protected Sub ddlService_SelectedIndexChanged(sender As Object, e As EventArgs)
        If ddlService.SelectedValue = "F" Then
            divRealValue.Visible = False
            divMortegage.Visible = False
            divCustomEstateValue.Visible = True
        Else
            divRealValue.Visible = True
            divMortegage.Visible = True
            txtCusEstateValue.Text = "0"
            divCustomEstateValue.Visible = False
        End If
    End Sub

    Protected Sub btnPolicyDetails_Click(sender As Object, e As EventArgs)
        'OpenModal(Me.Page, "myModal")
        'RedirectURL("~/Pages/PrivacyPolicy.aspx")
        OpenTab(Me.Page, "../../../Pages/PrivacyPolicy.aspx")
    End Sub



    Protected Sub btcloseUp_Click(sender As Object, e As EventArgs)
        CloseModal(Me.Page, "myModal")
    End Sub

End Class

Contents of ucCustomerInfo.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucCustomerInfo.ascx.vb" Inherits="EnjazVB.ucCustomerInfo" %>
       <div class="form-group">
    <div class="col-sm-3">
        <asp:Label ID="Label1" runat="server" Text="اسم العميل" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtName" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
 <div class="col-sm-3">
        <asp:Label ID="Label2" runat="server" Text="جوال العميل" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtPhone" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
                                                        <div class="col-sm-3">
        <asp:Label ID="Label3" runat="server" Text="بنك ايداع الراتب" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtBank" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
 <div class="col-sm-3">
        <asp:Label ID="Label4" runat="server" Text="الراتب" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtSalary" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>


            </div>

                             <div class="form-group">
                                    <div class="col-sm-3">
        <asp:Label ID="Label6" runat="server" Text="جهة العمل" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtWorkPlace" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
      <div class="col-sm-3">
        <asp:Label ID="Label5" runat="server" Text="العمر" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtAge" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
    <div class="col-sm-3">
        <asp:Label ID="lblDocNo" runat="server" Text="رقم الطلب" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtDocNo" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
 <div class="col-sm-3">
        <asp:Label ID="lblDocDate" runat="server" Text="تاريخ الطلب" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtDocDate" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>


            </div>

       <div class="form-group">
                       <div runat="server" id="divCustomEstateValue" visible="false" class="col-sm-3">
       <asp:Label ID="Label9" runat="server" Text="قيمة العقار ان وجد" Font-Bold="True"></asp:Label>
 <asp:TextBox ReadOnly="true" ID="txtCusEstateValue" TextMode="Number" CssClass="form-control" runat="server"></asp:TextBox>
</div>

  <div class="col-sm-3">
        <asp:Label ID="Label7" runat="server" Text="الخدمة المطلوبة" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList Enabled="false" ID="ddlService"  runat="server" CssClass="form-control" Width="100%">
                                                <asp:ListItem Value="F" Text="تمويل" Selected="True"></asp:ListItem>
                                             <asp:ListItem Value="M" Text="فك رهن واعادة تمويل" ></asp:ListItem>
                                            </asp:DropDownList>
 </div>
      
          
                  <div class="col-sm-3">
                                            <asp:Label ID="Label43" runat="server" Text="طريقة الشراء" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlBuying" Enabled="false"  runat="server" CssClass="form-control" Width="100%">
                                                <asp:ListItem Value="C" Text="كاش" ></asp:ListItem>
                                             <asp:ListItem Value="I" Text="اقساط" ></asp:ListItem>
                                            </asp:DropDownList>
                                         </div>

                                    <div class="col-sm-3">
                                            
                                            <asp:Label ID="Label44" runat="server" Text="رقم العرض" Font-Bold="True"></asp:Label>
                                                <asp:TextBox ID="txtOfferId"  ReadOnly="true" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div> 
           
       </div>

         <div class="form-group">
               <div runat="server" id="divRealValue" visible="false" class="col-sm-3">
       <asp:Label ID="lbl" runat="server" Text="قيمة العقار السوقية" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ReadOnly="true" ID="txtRealValue" TextMode="Number" CssClass="form-control" runat="server"></asp:TextBox>
                                       
 </div>
            <div runat="server" id="divMortegage" visible="false" class="col-sm-3">
        <asp:Label ID="Label8" runat="server" Text="مبلغ الرهن" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ReadOnly="true" ID="txtMortegage"  TextMode="Number"   CssClass="form-control" runat="server"></asp:TextBox>
                                      
 </div>

                         
                                 </div>

Contents of ucCustomerInfo.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucCustomerInfo

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtName control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtName As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtPhone control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPhone As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtBank control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtBank As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtSalary control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtSalary As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label6 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtWorkPlace control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtWorkPlace As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label5 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtAge control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtAge As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblDocNo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblDocNo As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtDocNo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDocNo As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblDocDate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblDocDate As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtDocDate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDocDate As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divCustomEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCustomEstateValue As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label9 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label9 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCusEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCusEstateValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlService control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlService As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label43 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label43 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlBuying control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlBuying As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label44 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label44 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtOfferId control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtOfferId As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divRealValue As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lbl control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lbl As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRealValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divMortegage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divMortegage As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label8 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label8 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtMortegage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtMortegage As Global.System.Web.UI.WebControls.TextBox
End Class

Contents of ucCustomerInfo.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Public Class ucCustomerInfo
    Inherits System.Web.UI.UserControl

    Dim q As String = ""
    Public Property DocNo As String
        Get
            Return ViewState("DocNo")
        End Get
        Set(value As String)
            ViewState("DocNo") = value
            loadData()
        End Set
    End Property



    Public Property OFFER_ID As String
        Get
            Return txtOfferId.Text.ToString
        End Get
        Set(value As String)
            ViewState("OFFER_ID") = value
        End Set
    End Property

    Public Property BUYING_TYPE As String
        Get
            Return ddlBuying.SelectedValue.ToString
        End Get
        Set(value As String)
            ViewState("BUYING_TYPE") = value
        End Set
    End Property

    Public Property ForUpload As String
        Get
            Return ViewState("ForUpload")
        End Get
        Set(value As String)
            ViewState("ForUpload") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub


    Private Sub loadData()
        q = ""
        q = q & "   Select  req.doc_no as doc_no , format(req.doc_DATE, 'dd/MM/yyyy') AS doc_DATE,req.trs_from as age,ISNULL(REQ.SERVICE,'F') AS SERVICE,M_REAL_VALUE,MORTEGAGE_VALUE,    "
        q = q & "     req.REQ_BY As customer,REQ.CusEstateValue,  "
        q = q & "      req.CONTACT_NO AS phone, BK.TYPE_DESC As BANK,WE.TYPE_DESC AS WORKPLACE,req.other2 as salary,FORUPLOAD,ISNULL(BUYING_TYPE,'I') AS BUYING_TYPE , OFFER_ID "
        q = q & "       From  "
        q = q & "       ARS_REQUEST_HDR AS req  LEFT  Join "
        q = q & "        (SELECT        TYPE_CODE, TYPE_CATEGORY, TYPE_DESC, TYPE_ABBR, PERCENTAGE, COMP_CODE, CAT_SHORTNAME, REFCOMP_CODE, OTHER_CODE "
        q = q & "               From  TYPE_MST"
        q = q & "        Where (TYPE_CODE = 'BK')) AS BK ON req.OTHER1 = BK.TYPE_CATEGORY left join  "
        q = q & "        (SELECT        TYPE_CODE, TYPE_CATEGORY, TYPE_DESC, TYPE_ABBR, PERCENTAGE, COMP_CODE, CAT_SHORTNAME, REFCOMP_CODE, OTHER_CODE "
        q = q & "               From  TYPE_MST"
        q = q & "        Where (TYPE_CODE = 'WE')) AS WE ON req.OTHER3 = WE.TYPE_CATEGORY   "
        q = q & "       where  req.doc_no='" & DocNo & "'"

        Dim DT As DataTable = GetTable(q)
        If DT.Rows.Count = 0 Then
            DT = GetTableCon(q, "Enjazcon")
        End If
        If DT.Rows.Count > 0 Then
            txtName.Text = DT(0)("customer").ToString
            txtPhone.Text = DT(0)("phone").ToString
            txtBank.Text = DT(0)("BANK").ToString
            txtSalary.Text = DT(0)("salary").ToString

            txtWorkPlace.Text = DT(0)("WORKPLACE").ToString
            txtAge.Text = DT(0)("age").ToString
            txtDocNo.Text = DT(0)("doc_no").ToString
            txtDocDate.Text = DT(0)("doc_DATE").ToString
            ddlService.SelectedValue = DT(0)("SERVICE").ToString
            txtCusEstateValue.Text = DT(0)("CusEstateValue").ToString
            ForUpload = IIf(DT(0)("FORUPLOAD").ToString = "", "N", DT(0)("FORUPLOAD").ToString)
            ddlBuying.SelectedValue = DT(0)("BUYING_TYPE").ToString
            txtOfferId.Text = DT(0)("OFFER_ID").ToString

            If DT(0)("SERVICE").ToString = "M" Then
                txtRealValue.Text = DT(0)("M_REAL_VALUE").ToString
                txtMortegage.Text = DT(0)("MORTEGAGE_VALUE").ToString
                divRealValue.Visible = True
                divMortegage.Visible = True
                divCustomEstateValue.Visible = False
            Else
                divRealValue.Visible = False
                divMortegage.Visible = False

                divCustomEstateValue.Visible = True
            End If
        End If






    End Sub

End Class

Contents of ucEmployee.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEmployee.ascx.vb" Inherits="EnjazVB.ucEmployee" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <%-- <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>--%>
    <ContentTemplate>
<div class="col-sm-12">
    <div class="col-sm-2"></div>
    <div class="col-sm-8">
  <div  class="form-group">
                            <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                  الموظفين 
                                </div>
                                <div class="panel-body">

                                    <div  class="form-group">
                                    <div class="col-sm-2">
                                        </div>
                                    <div class="col-sm-8">

                                  <div class="form-group">

                                      <div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="Label2" runat="server" Text="الرقم الوظيفي" Font-Bold="True" ></asp:Label>
        </div>
    <div class="col-sm-9">
             <asp:TextBox ID="txtEmp_no" ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
    </div>

                                                                 <div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="Label5" runat="server" Text="الموقع الوظيفي" Font-Bold="True" ></asp:Label>
        </div>
                                      <div class="col-sm-9">
                                         <asp:DropDownList ID="ddlPosition"  CssClass="form-control" runat="server" 
                                       >
                                              <asp:ListItem Text="موظف" Value="N" Selected="True"></asp:ListItem>
                                                <asp:ListItem Text="مشرف" Value="Y"></asp:ListItem>
                                    </asp:DropDownList>
                                          </div>
    </div>


<div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="lblUserNname" runat="server" Text="اسم الموظف" Font-Bold="True" ></asp:Label>
        </div>
    <div class="col-sm-9">
             <asp:TextBox ID="txtName"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
    </div>
                                      <div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="Label3" runat="server" Text="اسم المستخدم(للنظام)" Font-Bold="True" ></asp:Label>
        </div>
    <div class="col-sm-9">
             <asp:TextBox ID="txtUserId" onkeypress="return isEnglishOnly(event)"  CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
    </div>                      
                                      <div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="Label1" runat="server" Text="الحالة" Font-Bold="True" ></asp:Label>
        </div>
                                      <div class="col-sm-9">
                                         <asp:DropDownList ID="ddlEmpStatus" Enabled="false" CssClass="form-control" runat="server" AutoPostBack="True"
                                       >
                                              <asp:ListItem Text="نشط" Value="A" Selected="True"></asp:ListItem>
                                                <asp:ListItem Text="غير نشط" Value="N"></asp:ListItem>
                                    </asp:DropDownList>
                                          </div>
    </div>

     <div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="Label4" runat="server" Text="المشرف" Font-Bold="True" ></asp:Label>
        </div>
                                      <div class="col-sm-9">
                                         <asp:DropDownList ID="ddlSup" Enabled="True" CssClass="form-control" runat="server" 
                                       >
                       </asp:DropDownList>
                                          </div>
    </div>


                                           <div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="Label6" runat="server" Text="موظف جودة" Font-Bold="True" ></asp:Label>
        </div>
                                      <div class="col-sm-9">
                                         <asp:DropDownList ID="ddlQuality" Enabled="True" CssClass="form-control" runat="server" >
                                             <asp:ListItem Value="N" Text="لا" Selected="True"></asp:ListItem>
                                            <asp:ListItem Value="Y" Text="نعم"></asp:ListItem>
                                            <asp:ListItem Value="R" Text="مندوب عروض عقارية"></asp:ListItem>
                       </asp:DropDownList>
                                          </div>
    </div>

                                       <br />
                                        <div class="form-group">
                                              <br />
                                            </div>
                                           <div class="form-group">
                                           <%--    <div class="col-sm-3">
                                                   </div>--%>
                                                <div class="col-sm-4">
                                                     <asp:LinkButton  ID="btnSave" runat="server"   CssClass="btn btn-primary btn-md" OnClick="btnSave_Click"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-login&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; حفظ
                                                        " ></asp:LinkButton>
                                                  
                                                   
                                               </div>
                                                                                <div class="col-sm-4">
                                                          <asp:LinkButton ID="btnEmpCancel" runat="server"  CssClass="btn btn-primary btn-md"  Visible="false" OnClick="btnEmpCancel_Click" 
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; إلغاء
                                                        " ></asp:LinkButton>
                                             </div>
                                               </div>
  </div>




                                  </div>
                                     <div class="col-sm-2">
                                        </div>
                                        </div>

                                       <div class="form-group">
                             <%--   <div class="col-sm-2 control-label">
                                    <label>
                                        <asp:Localize ID="Localize2" runat="server" meta:resourcekey="Localize2Resource1" Text="حالة الموظف"></asp:Localize></label>
                                </div>--%>
                                <div class="col-sm-8">
                                    <asp:DropDownList ID="ddlStatus" CssClass="form-control" runat="server" AutoPostBack="True"
                                        OnSelectedIndexChanged="ddlStatus_SelectedIndexChanged" >
                                        <asp:ListItem Text="نشط" Value="A" Selected="True"></asp:ListItem>
                                                <asp:ListItem Text="غير نشط" Value="N"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                        </div>

                                    <div class="form-group">
                         <asp:gridview id="grdEmployee" 
  CssClass="table table-hover table-striped" runat="server" AllowPaging="false" AllowCustomPaging="false" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
    <Columns>
        <asp:BoundField DataField="sr_no" HeaderText="تسلسل"  />
        <asp:BoundField DataField="emp_no" HeaderText="الرقم الوظيفي"  />
        <asp:BoundField DataField="emp_name" HeaderText="الموظف"  />
        <asp:BoundField DataField="status" HeaderText="الحالة"  />
        <asp:BoundField DataField="user_id" HeaderText="اسم المستخدم" />
         <asp:BoundField DataField="sup_name" HeaderText="المشرف" />
          <asp:BoundField DataField="sup"  HeaderText="المشرف" />
             <asp:BoundField DataField="QUALITY"  HeaderText="موظف جودة" />
               
        
        


         <asp:TemplateField >
                                     <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton  ID="btnModify" runat="server" OnCommand="btnUpdate_Command"
                                                    Text="<i aria-hidden='true' class='glyphicon glyphicon-edit'></i>"
                                                    ToolTip="اضغط للتعديل" CommandName="upd" CommandArgument='<%#String.Concat(Eval("emp_no"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>


        <%--<asp:BoundField DataField="CLOSED_DATE" HeaderText="تاريخ اقفال"/>
        <asp:BoundField DataField="CLOSED_REMARKS" HeaderText="ملاحظة"/>--%>
    </Columns>
                                             <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages" BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
</asp:gridview>
                                  
     </div>

                                    </div>
                                </div>
                            </div>
       
        
    



    </div>
    <div class="col-sm-2"></div>
   

    </div>
<%--</div>--%>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>



<script>
    function isEnglishOnly(evt)
      {
        var charCode = (evt.which) ? evt.which : event.keyCode
         if(charCode == 32)
        return true;
    if(48 <= charCode && charCode <= 57)
        return true;
    if(65 <= charCode && charCode <= 90)
        return true;
    if(97 <= charCode && charCode <= 122)
        return true;
    return false;
         //if ( (charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) )
         //   return true;

        // return false;
      }
</script>

Contents of ucEmployee.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucEmployee

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtEmp_no control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtEmp_no As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label5 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlPosition control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlPosition As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''lblUserNname control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblUserNname As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtName control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtName As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtUserId control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtUserId As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlEmpStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlEmpStatus As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlSup control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlSup As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label6 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlQuality control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlQuality As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnEmpCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnEmpCancel As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''ddlStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlStatus As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''grdEmployee control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdEmployee As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucEmployee.ascx.vb:

Imports Oracle.ManagedDataAccess.Client
Imports WebClass.Sys.Classes
Imports WebClass.Sys.webclass.mainclass
Imports WebClass.Sys.Classes.clsGlobarVar
Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization

Public Class ucEmployee
    Inherits System.Web.UI.UserControl
    Dim q As String = ""
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            FillComboSelect(ddlSup, "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' AND  is_sup='Y'  ")
            loadData()
        End If
        SetGridStyle(grdEmployee)
    End Sub


    Private Sub loadData()
        q = ""
        q = q & " SELECT * FROM (   "
        q = q & "   select ROW_NUMBER() OVER (ORDER BY  e.emp_no ) as sr_no,e.sup	,s.emp_name sup_name ,e.emp_no,e.emp_name,(case when E.status_flag='A' THEN N'نشط' ELSE N'' end) as status,user_id ,(CASE WHEN E.QUALITY='Y' THEN N'نعم' ELSE N'لا' END )  AS QUALITY "
        q = q & "    from emp_mst e join  app_users u on   e.emp_no=u.emp_no  "
        q = q & "    left join emp_mst s on e.sup=s.emp_no "
        If ddlStatus.SelectedValue <> "" Then
            q = q & "   where  e.status_flag= '" & ddlStatus.SelectedValue.ToString & "' "
        End If
        q = q & "  ) A ORDER BY CAST(emp_no AS INT) "
        Dim DT = GetTable(q)

        grdEmployee.DataSource = DT
        grdEmployee.DataBind()
        SetGridStyle(grdEmployee)
        txtEmp_no.Text = Convert.ToInt32(GetFieldValue("select max(cast(emp_no as int ))+1 from emp_mst ")).ToString("0000")
    End Sub

    Protected Sub ddlStatus_SelectedIndexChanged(sender As Object, e As EventArgs)
        loadData()
    End Sub

    Protected Sub btnUpdate_Command(sender As Object, e As CommandEventArgs)

        Dim q As String = ""
        If e.CommandName = "upd" Then
            btnEmpCancel.Visible = True
            Dim sEmp_no As String
            'sWorklistID = e.CommandArgument 'wl_id
            sEmp_no = e.CommandArgument.ToString.Split(",")(0).ToString
            ViewState("sEmp_no") = sEmp_no
            Dim dt = GetTable("select e.emp_no,emp_name,s.emp_no  as sup,e.is_sup , E.status_flag,user_id,ISNULL(QUALITY,'N') QUALITY from emp_mst e  join  app_users u on   e.emp_no=u.emp_no  left join  (select emp_no from emp_mst where STATUS_FLAG='A' AND  is_sup='Y') s on e.sup=s.emp_no   where  e.emp_no='" & sEmp_no & "' ")
            txtEmp_no.Text = dt(0)("emp_no")
            txtName.Text = dt(0)("emp_name")
            txtUserId.Text = dt(0)("user_id")
            ddlEmpStatus.SelectedValue = dt(0)("status_flag")
            ddlQuality.SelectedValue = dt(0)("QUALITY")
            If dt(0)("sup").ToString <> "" Then
                ddlSup.SelectedValue = dt(0)("sup").ToString
            Else
                ddlSup.SelectedIndex = -1
            End If
            ddlPosition.SelectedValue = dt(0)("is_sup").ToString
            txtEmp_no.ReadOnly = True
            ' txtName.ReadOnly = True
            txtUserId.ReadOnly = True
            ddlEmpStatus.Enabled = True
        End If
        SetGridStyle(grdEmployee)
    End Sub

    Protected Sub btnSave_Click(sender As Object, e As EventArgs)
        If IsNothing(ViewState("sEmp_no")) Then
            ViewState("sEmp_no") = ""
        End If

        If ddlPosition.SelectedValue.ToString = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد الموقع الوظيفي")
            Exit Sub
        End If

        If txtName.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل اسم الموظف")
            Exit Sub
        End If
        If txtUserId.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل اسم المستخدم للنظام")
            Exit Sub
        End If
        If ddlEmpStatus.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر حالة الموظف")
            Exit Sub
        End If
        If ViewState("sEmp_no").ToString = "" Then
            If GetFieldValue("select user_id from app_users where upper(user_id)='" & txtUserId.Text.ToString.ToUpper & "'") <> "" Then
                ShowPopUpMsg(Me.Page, "هناك موظف اخر يحمل نفس اسم المستخدم")
                Exit Sub
            End If
        Else
            If ddlEmpStatus.SelectedValue.ToString = "N" Then
                If GetFieldValue("select status_flag from EMP_MST where EMP_NO='" & ViewState("sEmp_no").ToString & "'") <> "N" Then
                    If GetFieldValue("SELECT EMP_NO FROM EMP_MST WHERE SUP='" & ViewState("sEmp_no").ToString & "'") <> "" Then
                        ShowPopUpMsg(Me.Page, "فضلا قم بتحويل الموظفين تحت المشرف الي مشرف اخر")
                        Exit Sub
                    End If
                End If
            End If
        End If


        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        If ViewState("sEmp_no").ToString = "" Then
                            q = ""
                            q = q & "   insert into emp_mst (emp_no,emp_name,status_flag,sup,is_sup,QUALITY) "
                            q = q & "  values("
                            q = q & "  N'" & txtEmp_no.Text & "', "
                            q = q & "  N'" & txtName.Text & "', "
                            q = q & "  N'" & ddlEmpStatus.SelectedValue.ToString & "', "
                            If ddlPosition.SelectedValue.ToString = "Y" Then
                                q = q & "    N'" & txtEmp_no.Text & "', "
                            Else
                                q = q & "   N'" & ddlSup.SelectedValue.ToString & "', "
                            End If


                            q = q & "  N'" & ddlPosition.SelectedValue.ToString & "', "
                            q = q & "  N'" & ddlQuality.SelectedValue.ToString & "' "
                            q = q & "      ) "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()


                            RunInOtherDb(q)

                            If GetFieldValue(cn, cmd, "select user_id from app_users where upper(user_id)=upper('" & txtUserId.Text.ToString.ToUpper & "') AND EMP_NO <> '" & txtEmp_no.Text & "'") <> "" Then
                                Throw New Exception("هناك موظف اخر يحمل نفس اسم المستخدم")
                            End If

                            q = ""
                            q = q & " insert into app_users(emp_no,user_id,user_password,is_active,supper_user,ACTIVE_LOG)  "
                            q = q & "  values (N'" & txtEmp_no.Text & "',N'" & txtUserId.Text & "','asdf',1,0,'Y')"
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()




                            RunInOtherDb(q)


                        Else
                            Dim OldSup = GetFieldValue(cn, cmd, "SELECT SUP FROM EMP_MST WHERE EMP_NO = '" & txtEmp_no.Text & "'  ")

                            q = ""
                            q = q & " update emp_mst set emp_name=N'" & txtName.Text.ToString & "', status_flag=N'" & ddlEmpStatus.SelectedValue.ToString & "',sup=" & IIf(ddlPosition.SelectedValue.ToString = "Y", "N'" & txtEmp_no.Text.ToString & "'", "N'" & ddlSup.SelectedValue.ToString & "'") & " ,is_sup=N'" & ddlPosition.SelectedValue.ToString & "',QUALITY=N'" & ddlQuality.SelectedValue.ToString & "'  where emp_no= '" & txtEmp_no.Text & "' "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()



                            RunInOtherDb(q)

                            If OldSup <> "" And ddlPosition.SelectedValue.ToString = "N" And ddlSup.SelectedValue.ToString <> "" Then
                                q = ""
                                q = q & " update ars_request_hdr set  dept_head ='" & ddlSup.SelectedValue.ToString & "' where EMP_NO= '" & txtEmp_no.Text.ToString & "' AND STATUS='O'   "
                                cmd.CommandText = q
                                cmd.ExecuteNonQuery()


                                q = ""
                                q = q & " update APP_WORKOWNER set  OWNER ='" & ddlSup.SelectedValue.ToString & "' where OWNER='" & OldSup & "' AND   WL_ID IN (SELECT WL_ID FROM APP_WORKLIST WHERE STATUS='O' AND REF_ID IN (SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE EMP_NO='" & txtEmp_no.Text & "' AND STATUS='O') )  "
                                cmd.CommandText = q
                                cmd.ExecuteNonQuery()

                            End If

                        End If
                    End Using
                    trans.Commit()
                    saveFlag = True

                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            btnEmpCancel_Click(Nothing, Nothing)
        End If
    End Sub

    Protected Sub btnEmpCancel_Click(sender As Object, e As EventArgs)
        ViewState("sEmp_no") = ""
        'txtName.ReadOnly = False
        txtName.Text = ""
        txtUserId.ReadOnly = False
        txtUserId.Text = ""
        ddlEmpStatus.SelectedValue = "A"
        ddlEmpStatus.Enabled = False
        'ddlEmpStatus.Enabled = False
        btnEmpCancel.Visible = False
        loadData()

    End Sub
End Class

Contents of ucLogin.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucLogin.ascx.vb" Inherits="EnjazVB.ucLogin" %>
<%--<style>
        html, body {	margin-top: -1%;
                        /*top:-5%;*/
	padding: 0;}
</style>--%>
<div class="col-sm-12">
    <div class="col-sm-2"></div>
    <div class="col-sm-8">
  <div  class="form-group">
                            <div  class="panel panel-primary">
                                <div style="background:linear-gradient(TO RIGHT ,#BF953F,#FCF6BA,#B38728,#FBF5B7,#AA771C);"  class="panel-heading">
                                   تسجيل الدخول
                                </div>
                                <div class="panel-body">
                                    <div class="col-sm-2">
                                        </div>
                                    <div class="col-sm-8">

                                  <div class="form-group">

<div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="lblUserNname" runat="server" Text="اسم المستخدم" Font-Bold="True" ></asp:Label><span> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="login" ControlToValidate="txtUserName"  ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
        </div>
    <div class="col-sm-9">
             <asp:TextBox ID="txtUserName" onkeypress="return isEnglishOnly(event)"  CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
   <%-- <div class="col-sm-3"><asp:Label ID="Label2" runat="server"></asp:Label></div>--%>
    </div>
                                <%--    <br/>--%>
                                        <div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="Label1" runat="server" Text="كلمة المرور" Font-Bold="True" ></asp:Label><span> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtPassword" ValidationGroup="login"  ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
        </div>
    <div class="col-sm-9">
             <asp:TextBox ID="txtPassword" onkeypress="return isEnglishOnly(event)"  CssClass="form-control" TextMode="Password" runat="server" ></asp:TextBox>
    </div>
          <%-- <div class="col-sm-3"> </div>--%>
    </div>

<div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="lbl" runat="server" Text="ادخل الرمز" Font-Bold="True" ></asp:Label><span> <asp:CompareValidator ID="CompareValidator1" ControlToValidate="txtRandom" ControlToCompare="txtRandom_g" ForeColor="Red" ValidationGroup="login" runat="server" ErrorMessage="(تحقق من النص)"></asp:CompareValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ValidationGroup="login" ControlToValidate="txtRandom"  ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
        </div>
    <div class="col-sm-9">
             <asp:TextBox ID="txtRandom"  CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
   
    </div>

<div class="form-group">
  <div class="col-sm-6">
      <div class="form-group">
          <div class="col-sm-10">
      <asp:TextBox ID="txtRandom_g" ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>
   </div>
          <div class="col-sm-2">
              <asp:LinkButton OnClick="btnRefresh_Click" ValidationGroup="Refres"  ID="btnRefresh" CssClass="fa" runat="server"    >&#xf021;</asp:LinkButton> 
 </div>
          </div>
    </div>
    <div class="col-sm-6"></div>
    </div>


<%-- <div class="form-group">
     <div class="col-sm-4">
<div id="dvCaptcha">
</div>
<asp:TextBox ID="txtCaptcha" runat="server" Style="display: none" />
<asp:RequiredFieldValidator  ValidationGroup="login"   ID="rfvCaptcha" ErrorMessage="Captcha validation is required." ControlToValidate="txtCaptcha"
    runat="server" ForeColor="Red" Display="Dynamic" />
         </div>
     <div class="col-sm-6"></div>
      <div class="col-sm-6"></div>
</div>--%>
<br />
<br />




                                       <br />
                                        <div class="form-group">
                                              <br />
                                            </div>
                                           <div class="form-group">
                                           <%--    <div class="col-sm-3">
                                                   </div>--%>
                                               <div style="direction:ltr" class="col-sm-12">
                                                     <asp:LinkButton  ID="btnLogin" ValidationGroup="login" runat="server" style="background:#C5B358;border-color:#BF953F;"  CssClass="btn btn-primary btn-md" OnClick="btnLogin_Click"  
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-login&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; تسجيل دخول
                                                        " ></asp:LinkButton>
                                                   </div>
                                               </div>
  </div>




                                  </div>
                                     <div class="col-sm-2">
                                        </div>
                                    </div>
                                </div>
                            </div>
       
        
    



    </div>
    <div class="col-sm-2"></div>
   

    </div>
<%--</div>--%>

<script>
    function isEnglishOnly(evt) {
        var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode == 32)
            return true;
        if (48 <= charCode && charCode <= 57)
            return true;
        if (65 <= charCode && charCode <= 90)
            return true;
        if (97 <= charCode && charCode <= 122)
            return true;

        if (32 <= charCode && charCode <= 47)
            return true;
        if (58 <= charCode && charCode <= 64)
            return true;
        if (91 <= charCode && charCode <= 96)
            return true;
        if (123 <= charCode && charCode <= 126)
            return true;

        return false;
        //if ( (charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) ||(charCode > 31 && (charCode < 48 || charCode > 57)) )
        //   return true;

        //return false;
    }
</script>

<%--<script>
    function isEnglishOnly(evt)
      {
        var charCode = (evt.which) ? evt.which : event.keyCode
         if(charCode == 32)
        return true;
    if(48 <= charCode && charCode <= 57)
        return true;
    if(65 <= charCode && charCode <= 90)
        return true;
    if(97 <= charCode && charCode <= 122)
        return true;
    return false;
         //if ( (charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) )
         //   return true;

        // return false;
      }
</script>--%>

<%--<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" asyncdefer></script>
<script type="text/javascript">
     var onloadCallback = function () {
        grecaptcha.render('dvCaptcha', {
            'sitekey': '<%=ReCaptcha_Key %>',
            'callback': function (response) {
                $.ajax({
                    type: "POST",
                   url: "login.aspx/VerifyCaptcha",
                    data: "{response: '" + response + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (r) {
                        var captchaResponse = jQuery.parseJSON(r.d);
                        if (captchaResponse.success) {
                            $("[id*=txtCaptcha]").val(captchaResponse.success);
                            $("[id*=rfvCaptcha]").hide();
                        } else {
                            $("[id*=txtCaptcha]").val("");
                            $("[id*=rfvCaptcha]").show();
                            var error = captchaResponse["error-codes"][0];
                            $("[id*=rfvCaptcha]").html("RECaptcha error. " + error);
                        }
                    }
                });
            }
        });
    };
</script>--%>

Contents of ucLogin.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucLogin

    '''<summary>
    '''lblUserNname control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblUserNname As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator1 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtUserName control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtUserName As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator2 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtPassword control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPassword As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lbl control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lbl As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''CompareValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents CompareValidator1 As Global.System.Web.UI.WebControls.CompareValidator

    '''<summary>
    '''RequiredFieldValidator3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator3 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtRandom control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRandom As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''txtRandom_g control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRandom_g As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnRefresh control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnRefresh As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnLogin control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnLogin As Global.System.Web.UI.WebControls.LinkButton
End Class

Contents of ucLogin.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Imports System.Net
Imports System.Web.Services


Public Class ucLogin
    Inherits System.Web.UI.UserControl

    Protected Shared ReCaptcha_Key As String = "6LcbzggmAAAAAFUmeszsx5xbvAh3aGITWrUsW0Ab"
    Protected Shared ReCaptcha_Secret As String = "6LcbzggmAAAAAGZ8tbtUhz56LmotpSGbk9rUiaFP"


    Public Property logcnt As Integer
        Get
            Return Session("logcnt")
        End Get
        Set(value As Integer)
            Session("logcnt") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            'If Not (Request.QueryString("L")) Is Nothing
            ' sEmpNo = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(EmpNo))
            ' docno = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(Request.QueryString("ID").ToString))
            If (Not (Request.QueryString("L")) Is Nothing Or Not (Request.QueryString("ccode")) Is Nothing) Then
                Dim L = "", ccode = ""
                Try
                    If Not (Request.QueryString("L")) Is Nothing Then
                        L = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(Request.QueryString("L").ToString))
                    End If

                    If Not (Request.QueryString("ccode")) Is Nothing Then
                        ccode = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(Request.QueryString("ccode").ToString))
                    End If
                Catch
                    RedirectURL("../Pages/HomePage.aspx")
                End Try

                If L = "XxX" Or ccode = "@enJazaQar" Then
                Else
                    RedirectURL("../Pages/HomePage.aspx")
                End If

            Else
                RedirectURL("../Pages/HomePage.aspx")
            End If
            'Dim ccode = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes("@enJazaQar"))
            If IsNothing(logcnt) Then
                If Not IsNothing(Session("loginCnt")) Then
                    logcnt = 0
                    Session("loginCnt") = 0
                Else
                    logcnt = Session("loginCnt")
                End If

            End If
            logcnt = Session("loginCnt")
            If logcnt >= 3 Then

                btnLogin.Enabled = False
                ClosePage(Me.Page)
            End If
            Dim previous As String = ""
            If Not Request.UrlReferrer Is Nothing Then
                Dim previousPageUrl As String = Request.UrlReferrer.AbsoluteUri
                previous = System.IO.Path.GetFileName(Request.UrlReferrer.AbsolutePath)
            End If

            If Not (Request.QueryString("L")) Is Nothing Then
                txtRandom_g.Text = CreateRandomPassword()
                Session.Clear()
                Session.Abandon()
            Else
                If Not Session("emp_no") Is Nothing And Not Session("supper_user") Is Nothing Then
                    RedirectURL("../pages/Worklist.aspx")
                Else
                    txtRandom_g.Text = CreateRandomPassword()
                End If
            End If
            If Not Session("trususer") Is Nothing Then
                btnLogin.Enabled = False
                RedirectURL("../Pages/HomePage.aspx")
                Session("trususer") = ""
            End If
            'If previous = "HomePage.aspx" And Not Session("emp_no") Is Nothing And Not Session("supper_user") Is Nothing Then
            '    RedirectURL("../pages/Worklist.aspx")
            'Else
            '    txtRandom_g.Text = CreateRandomPassword()
            '    Session.Clear()
            '    Session.Abandon()
            'End I/



        End If

    End Sub

    Private Sub UpdateLog()
        Dim cn As New SqlConnection
        Dim cmd As New SqlCommand
        Dim trans As SqlTransaction
        Dim q = ""
        cn = OpenConnection()
        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        cmd.Connection = cn
        cmd.Transaction = trans

        SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Try

            Dim user_id = GetFieldValue(cn, cmd, "select user_id from  app_users where upper(user_id)=upper('" & txtUserName.Text & "')   COLLATE SQL_Latin1_General_CP1_CS_AS   ")
            If user_id <> "" Then

                q = ""
                q = q & " update app_users set active_log='N' where USER_ID='" & user_id & "'  "
                cmd.CommandText = q
                cmd.ExecuteNonQuery()
                trans.Commit()
                saveFlag = True
            End If
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
            trans.Rollback()

        Finally
            cmd.Dispose()
            trans.Dispose()
            cn.Close()
            cn.Dispose()
        End Try
    End Sub


    Public Shared Function CreateRandomPassword() As String
        Dim strPasswordCharacters As String = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ123456789"
        Dim randomNum As New Random()
        Dim chars As Char() = New Char(6 - 1) {}
        Try
            For i As Integer = 0 To 6 - 1
                chars(i) = strPasswordCharacters(CInt((strPasswordCharacters.Length) * randomNum.NextDouble()))
            Next
        Catch
            For i As Integer = 0 To 6 - 1
                chars(i) = strPasswordCharacters(CInt((strPasswordCharacters.Length) * randomNum.NextDouble()))
            Next
        End Try

        Return New String(chars)
    End Function

    Protected Sub btnRefresh_Click(sender As Object, e As EventArgs)
        txtRandom_g.Text = CreateRandomPassword()
    End Sub

    Protected Sub btnLogin_Click(sender As Object, e As EventArgs)
        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        'Dim saveFlag As Boolean = False
        If Session("trususer") Is Nothing Then
            If txtUserName.Text.Contains("'") Or (txtUserName.Text).ToUpper.Contains("DELETE") Or (txtUserName.Text).ToUpper.Contains("UPDATE") Or (txtUserName.Text).ToUpper.Contains("DROP") Or (txtUserName.Text).ToUpper.Contains("INSERT") Or (txtUserName.Text).ToUpper.Contains("TRUNCATE") Or
             txtPassword.Text.Contains("'") Or (txtPassword.Text).ToUpper.Contains("DELETE") Or (txtPassword.Text).ToUpper.Contains("UPDATE") Or (txtPassword.Text).ToUpper.Contains("DROP") Or (txtPassword.Text).ToUpper.Contains("INSERT") Or (txtPassword.Text).ToUpper.Contains("TRUNCATE") Then
                btnLogin.Enabled = False
                Session("trususer") = ""
            Else

                Try

                    ' Dim dt = GetTable("select e.emp_no,emp_name,user_id,supper_user,u.user_password from emp_mst e join app_users u on  e.emp_no=u.emp_no left join default_t t on 1=1  where  u.user_id+t.user_ex='" & txtUserName.Text.ToString & "' and u.user_password='" & txtPassword.Text & "' and e.status_flag='A' AND U.ACTIVE_LOG='Y'  COLLATE SQL_Latin1_General_CP1_CS_AS    ")
                    Dim dt
                    Dim Q = "select e.emp_no,emp_name,user_id,supper_user,u.user_password from emp_mst e  WITH (NOLOCK)   join app_users u  WITH (NOLOCK)   on  e.emp_no=u.emp_no left join default_t t  WITH (NOLOCK)   on 1=1  where  u.user_id+t.user_ex=@usid and u.user_password=@uspass and e.status_flag='A' AND U.ACTIVE_LOG='Y'  COLLATE SQL_Latin1_General_CP1_CS_AS    "
                    Using cn As SqlConnection = New SqlConnection(GetConnString)
                        Using cmd As New SqlCommand(Q, cn)
                            cmd.Parameters.Add("@usid", SqlDbType.VarChar, 50).Value = txtUserName.Text.ToString
                            cmd.Parameters.Add("@uspass", SqlDbType.VarChar, 50).Value = txtPassword.Text
                            Dim _da As New SqlDataAdapter()
                            dt = New DataTable()
                            _da = New SqlDataAdapter(cmd)
                            _da.Fill(dt)
                            _da.Dispose()
                        End Using
                    End Using
                    If Not dt Is Nothing Then
                        If dt.Rows.Count > 0 Then
                            Dim r As DataRow = dt.rows(0)
                            Session("emp_no") = r("emp_no").ToString
                            Session("emp_name") = r("emp_name").ToString
                            Session("user_id") = r("user_id").ToString
                            Session("supper_user") = r("supper_user").ToString
                            Session("password") = r("user_password").ToString
                            Session("encpass") = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(r("user_password").ToString))
                            ' Response.Redirect("..\pages\")
                            RedirectURL("../pages/Worklist.aspx")

                        Else
                            logcnt = logcnt + 1
                            txtRandom_g.Text = CreateRandomPassword()
                            ShowPopUpMsg(Me.Page, "اسم المستخدم او كلمة السر غير صحية")
                        End If
                    End If
                    Session("loginCnt") = logcnt
                    If logcnt >= 3 Then
                        UpdateLog()
                        btnLogin.Enabled = False
                    End If

                    'q = ""
                    'q = q & " update ars_request_hdr set emp_no='" & ddlEmployee.SelectedValue.ToString & "' where doc_no= '" & requestId & "'   "
                    'cmd.CommandText = q
                    'cmd.ExecuteNonQuery()

                    'trans.Commit()
                    'saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    ' trans.Rollback()

                Finally
                    ''cmd.Dispose()
                    ''trans.Dispose()
                    ''cn.Close()
                    ''cn.Dispose()
                End Try

            End If

        End If


        'If saveFlag = True Then
        '    RedirectURL("../pages/Worklist.aspx")
        'End If
    End Sub


    '<WebMethod()>
    'Public Shared Function VerifyCaptcha(response As String) As String
    '    Dim url As String = "https://www.google.com/recaptcha/api/siteverify?secret=" & ReCaptcha_Secret & "&response=" & response
    '    Return (New WebClient()).DownloadString(url)
    'End Function

End Class




Contents of ucMainPage.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucMainPage.ascx.vb" Inherits="EnjazVB.ucMainPage" %>
<html>
<head>
      <meta name="keywords" content="تمويل,قروض,عقار,عقارات,فلل,قروض شخصية,شراء عقار,بيع عقار,موقع عقاري,فلل للبيع,الصندوق العقاري">
<meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
* {box-sizing: border-box;}

/*body { 
  font-family: Arial, Helvetica, sans-serif;
   height: 100%;
    margin: 0;
    padding: 0;
 }*/

.header {
  overflow: hidden;
  background-color: #f1f1f1;
  padding: 1% 1%;
}

.header a {
  float: left;
  color: black;
  text-align: center;
  padding: 1%;
  text-decoration: none;
  font-size: 1%; 
  line-height: 1%;
  border-radius: 1%;
}

.header a.logo {
  font-size: 1.5vw;
  font-weight: bold;
}

.header a:hover {
  background-color: #ddd;
  color: black;
}

.header a.active {
  background-color: dodgerblue;
  color: white;
}

.header-right {
  float: right;
}

/*@media screen and (max-width: 500px) {
  .header a {
    float: none;
    display: block;
    text-align: left;
  }
  
  .header-right {
    float: none;
  }
}*/

div.shadow {
    position:absolute;
    max-width:45%;
    max-height:45%;
    top:30%;
    left:27%;
    overflow:visible;
}
img.logo {
    position:relative;
    max-width:100%;
    max-height:100%;
    margin-top:-50%;
    margin-left:-50%;
    color:DodgerBlue;
        top: 0px;
        left: -1px;
    }

div.getmoney {
    position:absolute;
 width:30%;
    max-height:10%;
    top:55%;
    left:35%;
    font-size:large;
    overflow:visible;
}

div.contact {
    position:absolute;
    width:30%;
    max-height:10%;
    top:90%;
    left:35%;
    overflow:visible;
}

.btn {
  /*background-color: DodgerBlue;*/
  /*background-color:#8A6E2F;*/
  background:linear-gradient(TO RIGHT ,#BF953F,#FCF6BA,#B38728,#FBF5B7,#AA771C);
      /*background: radial-gradient(ellipse farthest-corner at right bottom, #FEDB37 0%, #FDB931 8%, #9f7928 30%, #8A6E2F 40%, transparent 80%),
                radial-gradient(ellipse farthest-corner at left top, #FFFFFF 0%, #FFFFAC 8%, #D1B464 25%, #5d4a1f 62.5%, #5d4a1f 100%);*/
  border: none;
  color:black;
  padding: 12px 16px;
  font-size: 2.5vw;

    width:100%;
    font-weight: bold;
  cursor: pointer;
    display: block;
    text-align:right;

}

/* Darker background on mouse-over */
.btn:hover {
  /*background-color: RoyalBlue;*/
   background-color:#5d4a1f ;
}

img.logoM {
    position:relative;
    /*max-width:50%;
    max-height:50%;*/
    max-width:70vw;
    max-height:30vh;
    display: block;
    margin-left: auto;
    margin-right: auto;
    /*margin-top:-50%;
    margin-left:-50%;*/
    color:DodgerBlue;
}
</style>
</head>
    <body>
<div>
<%--<div class="header">
  <a href="../pages/Login.aspx" class="logo">Login/ دخول موظفين</a>
  <div class="header-right">
    <a class="active" href="#home">Home</a>
    <a href="#contact">Contact</a>
    <a href="#about">About</a>
  </div>
</div>--%>

        <%--<div>
        <div class="shadow"><img class="logo" src="../Images/logo.png"/></div>
            </div>--%>

                                <div class="form-group">
                     <div class="col-sm-4">
                         </div>
      
                         <div class="col-sm-4">
            <img class="logoM" src="../Images/logo.png"/>
</div>
                         <div class="col-sm-4">
                             </div>
       
</div>

        <br />
        <div class="getmoney">
            <a class="btn" href="../pages/CreateRequest.aspx"><i class="fa fa-money"></i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تقدم بطلب تمويل&nbsp;&nbsp;&nbsp;</a>
        </div>
     <%--   <div class="contact">
              <a class="btn"><i class="fa fa-phone"></i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تواصل معنا&nbsp;&nbsp;&nbsp;</a>
 </div>--%>

<%--<div style="padding-left:20px">
<asp:Image ID="ilogo" runat="server" ImageUrl="~/Images/logo.png" />
</div>--%>
</div>
</body>
</html>

Contents of ucMainPage.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On



Partial Public Class ucMainPage
End Class

Contents of ucMainPage.ascx.vb:

Public Class ucMainPage
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

End Class

Contents of ucNotes.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucNotes.ascx.vb" Inherits="EnjazVB.ucNotes" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <ContentTemplate>
        <fieldset>
            <legend class="noLegend"></legend>
            <div class="panel panel-primary">
                <div class="panel-heading text-center">
                    <h3 id="H2" class="panel-title" runat="server"><asp:Localize ID="locEOS_Details" runat="server" Text="الملاحظات"></asp:Localize></h3>
                    <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i>
                    </span>
                </div>
                <div class="panel-body">
                  
                    <div class="container-fluid">
                        <div class="form-horizontal">



                                <div>  
    <asp:Repeater ID="RepterDetails" runat="server">
        <ItemTemplate>  
           
            <div style="background-color:#EBEFF0;border:1px dotted #df5015;" class="form-group">

          <div  class="form-group">

            <div class="col-sm-3">
         <asp:Label ID="Label14" runat="server" Text="رقم الطلب" Font-Bold="True" ></asp:Label>
         <asp:TextBox ID="txtDoc" Text='<%#Eval("DOC_NO") %>'  ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
         </div>
       <div class="col-sm-3">
     <asp:Label ID="Label9" runat="server" Text="الموضوع" Font-Bold="True" ></asp:Label>
      <asp:TextBox ID="txtSubject"  Text='<%#Eval("SUBJECT") %>'  ReadOnly="true"    CssClass="form-control" runat="server" ></asp:TextBox>
      </div>
                    <div class="col-sm-3">
         <asp:Label ID="Label2" runat="server" Text="محول من " Font-Bold="True" ></asp:Label>
         <asp:TextBox ID="txtTransFrom" Text='<%#Eval("TRANS_FROM") %>'  ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
         </div>
       <div class="col-sm-3">
     <asp:Label ID="Label3" runat="server" Text="محول الى" Font-Bold="True" ></asp:Label>
      <asp:TextBox ID="txtTransTo"  Text='<%#Eval("TRANS_TO") %>'  ReadOnly="true"    CssClass="form-control" runat="server" ></asp:TextBox>
      </div>

                                                 </div>

               
               <div class="form-group">

            <div class="col-sm-3">
         <asp:Label ID="Label4" runat="server" Text="اسم العميل" Font-Bold="True" ></asp:Label>
         <asp:TextBox ID="txtCustomer" Text='<%#Eval("customer") %>'  ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
         </div>
       <div class="col-sm-3">
     <asp:Label ID="Label5" runat="server" Text="تاريخ التحويل" Font-Bold="True" ></asp:Label>
      <asp:TextBox ID="txtTranDate"  Text='<%#Eval("trans_date") %>'  ReadOnly="true"    CssClass="form-control" runat="server" ></asp:TextBox>
      </div>
                        <div class="col-sm-3">
     <asp:Label ID="Label1" runat="server" Text="جوال العميل" Font-Bold="True" ></asp:Label>
      <asp:TextBox ID="txtPhone"  Text='<%#Eval("Phone") %>'  ReadOnly="true"    CssClass="form-control" runat="server" ></asp:TextBox>
      </div>
                                   <div class="col-sm-3">
     <asp:Label ID="Label6" runat="server" Text="تاريخ الطلب" Font-Bold="True" ></asp:Label>
      <asp:TextBox ID="TextBox1"  Text='<%#Eval("req_date") %>'  ReadOnly="true"    CssClass="form-control" runat="server" ></asp:TextBox>
      </div>

                                                 </div>
                </div>
             

           </ItemTemplate>


<%--  <HeaderTemplate>  
    <table style="border:1px solid #0000FF;text-align:right;direction:rtl;" cellpadding="0">  
  
    </HeaderTemplate>  
    <ItemTemplate>  
    <tr style="background-color:#EBEFF0">  
    <td>  
    <table style="background-color:#EBEFF0;border-top:1px dotted #df5015;direction:rtl; width:90VW;" >  
    <tr> 
    <td >  
        <div class="col-sm-10">
            <asp:Label ID="Label14" runat="server" Text="رقم الطلب" Font-Bold="True" ></asp:Label>
 <asp:TextBox ID="txtDoc" Text='<%#Eval("DOC_NO") %>'  ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox> 
    </div>
            </td> 
    <td >  
          <div class="col-sm-10">
    <asp:Label ID="Label9" runat="server" Text="الموضوع" Font-Bold="True" ></asp:Label>
      <asp:TextBox ID="txtSubject"  Text='<%#Eval("SUBJECT") %>'  ReadOnly="true"    CssClass="form-control" runat="server" ></asp:TextBox>
      
          </div>
              </td> 
        
    </tr>  
    </table>  
    </td>  
    </tr>  
    <tr> 
       <td>  
    <table style="background-color:#EBEFF0;border-top:1px dotted #df5015;direction:rtl; width:85VW;" >  
     <tr> 
    <td>  
         محول من    :
    <asp:Label ID="lbl" runat="server" Text='<%#Eval("TRANS_FROM") %>'/>  
    </td> 
    <td>  
        محول الى   :
    <asp:Label ID="lblComment" runat="server" Text='<%#Eval("TRANS_TO") %>'/>  
    </td> 
     </tr>   
</table>
           </td>
    </tr>  
    <tr>  
    <td>  
    <table style="background-color:#EBEFF0;border-top:1px dotted #df5015;border-bottom:1px solid #df5015;direction:rtl; width:85VW;" >  
    <tr>  
    <td >     اسم العميل  :<asp:Label ID="lblUser" runat="server" Font-Bold="true" Text='<%#Eval("customer") %>'/></td>  
    <td > تاريخ التحويل   :<asp:Label ID="lblDate" runat="server" Font-Bold="true" Text='<%#Eval("trans_date") %>'/></td>  
    </tr>  
    </table>  
    </td>  
    </tr>  
    <tr>  
    <td colspan="2"> </td>  
    </tr>  
    </ItemTemplate>  
    <FooterTemplate>  
    </table>  
    </FooterTemplate>  
   --%>
        </asp:Repeater>  
    </div>  





                            </div>
                        </div>
                    </div>
                </div>
            </fieldset>
       </ContentTemplate>
    </asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>

Contents of ucNotes.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucNotes

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''H2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H2 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''locEOS_Details control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents locEOS_Details As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''RepterDetails control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RepterDetails As Global.System.Web.UI.WebControls.Repeater

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucNotes.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization

Public Class ucNotes
    Inherits System.Web.UI.UserControl
    Dim q As String = ""
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            q = ""
            q = q & "  SELECT DOC_NO,N'نحويل طلب'  AS SUBJECT , E2.EMP_NAME AS TRANS_FROM , FORMAT(h.DOC_DATE,'dd/MM/yyyy') AS REQ_DATE,  "
            q = q & "  E.EMP_NAME TRANS_TO , FORMAT(W.WL_DATE,'dd/MM/yyyy') as trans_date,req_by  as customer,h.contact_no as phone "
            q = q & "  FROM  ARS_REQUEST_HDR H JOIN  APP_WORKLIST W ON W.REF_ID=H.DOC_NO  "
            q = q & "  JOIN  APP_WORKOWNER O  ON  W.WL_ID=O.WL_ID JOIN EMP_MST E ON H.EMP_NO=E.EMP_NO  "
            q = q & "  LEFT JOIN EMP_MST E2 ON W.SUBPROC2=E2.EMP_NO   "
            q = q & "  WHERE  W.NEXT_PROCESS_ID='" & AppProcess.ProcTrans.ToString.ToUpper & "'  "
            q = q & "   AND O.OWNER='" & Session("emp_no").ToString & "' AND  H.TRAN_TYPE='R'   "
            q = q & "    order by wl_Date desc   "
            Dim dt = GetTable(q)

            Dim dt2 = GetTableCon(q, "Enjazcon")
            dt.Merge(dt2)
            Dim sortedResults = From row In dt.AsEnumerable()
                                Order By CDate(row.Field(Of String)("trans_date")) Descending

            dt = dt.Clone() ' Clone the structure (columns) of the original table
            ' Import each sorted row into the new DataTable
            'Dim rowNumber As Integer = 1
            For Each row In sortedResults
                dt.ImportRow(row)
            Next
            dt.AcceptChanges()


            RepterDetails.DataSource = dt
            RepterDetails.DataBind()
            '  SetGridStyle(RepterDetails)

            CLOSEOPENWORKLIST()

        End If
    End Sub

    Protected Sub CLOSEOPENWORKLIST()
        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        q = ""
                        q = q & " update app_worklist  set status='C' WHERE  NEXT_PROCESS_ID='" & AppProcess.ProcTrans.ToString.ToUpper & "' AND STATUS='P' AND WL_ID IN (SELECT WL_ID FROM APP_WORKOWNER WHERE OWNER='" & Session("emp_no").ToString & "' ) "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()

                        RunInOtherDb(q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
    End Sub

End Class

Contents of ucNotificationAttachment.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucNotificationAttachment.ascx.vb" Inherits="EnjazVB.ucNotificationAttachment" %>
  <asp:UpdatePanel ID="UpdatePanelnotif"  runat="server">
    <ContentTemplate> 
<div class="form-group">
                         <asp:gridview id="grdNotAttachment" 
  CssClass="table table-hover table-striped" runat="server" AllowPaging="false" AllowCustomPaging="false" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="لايوجد سجلات" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
    <Columns>
        <asp:BoundField DataField="sr_no" HeaderText="تسلسل"  />
        <asp:BoundField DataField="att_desc" HeaderText="المرفق"  />
       <%-- <asp:BoundField DataField="attach_id" HeaderText="عن طريق الموظف" />--%>
<%--        <asp:BoundField DataField="emp_name" HeaderText="ارفق بواسطة" />
                <asp:BoundField DataField="attach_date" HeaderText="التاريخ" />--%>
         <asp:BoundField DataField="FILENAME" Visible="false" HeaderText="FILENAME" />
        
          <asp:TemplateField Visible="false" >
                                     <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                            <asp:UpdatePanel ID="upnlBtnAdd" runat="server">    
                                        <ContentTemplate>
                                                <asp:LinkButton ID="btnStep" runat="server" OnCommand="btnStep_Command" data-backdrop="static" 
                                                     Text='<%# Bind("action") %>'
                                                    ToolTip="اضغط للارفاق" CommandName="Step" CommandArgument='<%# string.Concat(Eval("doc_type"), ",", Eval("ref_id"), ",", Eval("att_desc"), ",", Eval("action2"), ",", Eval("FILENAME"))%>'    />
                                          </ContentTemplate>
                                            </asp:UpdatePanel>
                                         </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>


<asp:TemplateField HeaderText=""  >
    <ItemTemplate>
        <asp:HyperLink ID="HyperLink1" NavigateUrl=<%# String.Format("javascript:void(window.open('../ImageStorage/" & Eval("FILENAME") + "' , 'popup_window', 'width=600,height=500,left=100,top=100,resizable=yes'))", Eval("ACTION")) %> runat="server"><%# Eval("ACTION")%></asp:HyperLink>
    </ItemTemplate>
</asp:TemplateField>
      <%--   <asp:TemplateField >
                                     <ItemTemplate>
                                              <asp:LinkButton Visible='<%#Eval("FILENAME").ToString() <> "" %>' ID="btnDel" runat="server" OnCommand="btnDel_Command"
                                                                                         OnClientClick="if (confirm('هل تريد حذف الملف بالفعل ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                     Text="<i aria-hidden='true' class='glyphicon glyphicon-trash'></i>"
                                                    ToolTip="اضغط للحذف" CommandName="Del" CommandArgument='<%#String.Concat(Eval("doc_type"), ",", Eval("ref_id"), ",", Eval("att_desc"), ",", Eval("action2"), ",", Eval("FILENAME"), ",", Eval("sr_no"), ",", Eval("emp_no"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>


        <%--<asp:BoundField DataField="CLOSED_DATE" HeaderText="تاريخ اقفال"/>
        <asp:BoundField DataField="CLOSED_REMARKS" HeaderText="ملاحظة"/>--%>
    </Columns>
                                             <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
</asp:gridview>
                                  
     </div>
        </ContentTemplate>
      </asp:UpdatePanel>

<script>
    $(function () {
        $(".HyperLink1").click(function () {
            var dinfo = $(this).text();
            //alert(dinfo);
            window.open('ViewPictures.aspx?BY=dinfoNo&amp;InfoNum=' + dinfo, 'docview', 'left=725,top=50,width=1300,height=975,toolbar=no,location=no,directories=no,menubar=no,resizable=no,scrollbars=no');
            return false;
        })
    })
</script>

Contents of ucNotificationAttachment.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucNotificationAttachment

    '''<summary>
    '''UpdatePanelnotif control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanelnotif As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''grdNotAttachment control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdNotAttachment As Global.System.Web.UI.WebControls.GridView
End Class

Contents of ucNotificationAttachment.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Public Class ucNotificationAttachment
    Inherits System.Web.UI.UserControl
    Dim q As String = ""

    Public Property requestId As String
        Get
            Return ViewState("requestId")
        End Get
        Set(value As String)
            ViewState("requestId") = value
            loadAttachment()
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        SetGridStyle(grdNotAttachment)
    End Sub
    Private Sub loadAttachment()
        q = ""
        q = q & " SELECT * FROM (   "
        q = q & "   select	'" & requestId & "' as ref_id,TYPE_ABBR, type_category doc_type,(case when doc_type='DCOTHERS' AND DOC_DESC IS NOT NULL AND DOC_DESC <> ''  then DOC_DESC ELSE  type_Desc END ) as att_desc,SR_NO,e.emp_no, emp_name,FORMAT(up.sys_date,'dd/MM/yyyy')attach_date,up.FILENAME, "
        q = q & "    Case when up.FILENAME Is null then N'ارفاق' else N'عرض' end as action,case when up.FILENAME is null then N'ATT' else N'DIS' end as action2   from   "
        q = q & "    (select * from type_mst  where type_code='DC') t  join (select * from APP_UPLOAD_MST where DOC_NO='" & requestId & "' ) up on t.TYPE_CATEGORY=up.doc_type "
        q = q & "     join  (select * from  NOTIFICATIONS  where E_ID='" & requestId & "'  )h on up.DOC_NO=h.E_ID "
        q = q & "     join app_users u on up.SYS_USERID=u.user_id "
        q = q & "     join emp_mst e on u.emp_no=e.emp_no  "
        'q = q & "   UNION "
        'q = q & "   Select '" & requestId & "' as ref_id ,TYPE_ABBR, type_category doc_type,type_Desc as att_desc,NULL AS SR_NO , NULL AS emp_no, NULL AS emp_name,NULL AS attach_date,NULL AS FILENAME, "
        'q = q & "   N'ارفاق' AS action,N'ATT' AS action2 FROM TYPE_MST WHERE TYPE_CODE='DC' AND TYPE_CATEGORY='DCOTHERS' "
        q = q & "  ) A ORDER BY CAST(TYPE_ABBR AS INT) "
        Dim DT = GetTable(q)

        grdNotAttachment.DataSource = DT
        grdNotAttachment.DataBind()
        SetGridStyle(grdNotAttachment)
    End Sub
    Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O" 'rblWLStatus.SelectedValue.ToString

        'Dim rowIndex As Integer = Convert.ToInt32(e.CommandArgument)


        'Reference the GridView Row.
        ' Dim row As GridViewRow = grdAttachment.Rows(rowIndex)




        If e.CommandName = "Step" Then

            Dim sDOC_TYPE As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
            Dim sArgRefID As String = ""
            Dim sDOC_DESC As String
            Dim sAction As String
            Dim sFileName As String
            'sWorklistID = e.CommandArgument 'wl_id
            sDOC_TYPE = e.CommandArgument.ToString.Split(",")(0).ToString
            sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString
            sDOC_DESC = e.CommandArgument.ToString.Split(",")(2).ToString
            sAction = e.CommandArgument.ToString.Split(",")(3).ToString
            sFileName = e.CommandArgument.ToString.Split(",")(4).ToString
            'sFileName = row.Cells(4).Text.ToString
            Dim url As String
            Dim s As String
            If sAction.ToString.ToUpper = "DIS" Then
                url = "../ImageStorage/" & sFileName & " "
                s = "window.open('" & url + "', 'popup_window', 'width=600,height=500,left=100,top=100,resizable=yes');"
            Else
                url = "../Pages/UploadFiles.aspx?docno=" & sArgRefID & "&doctype=" & sDOC_TYPE & "&docdesc=" & sDOC_DESC & " "
                s = "window.open('" & url + "', 'popup_window', 'width=400,height=200,left=100,top=100,resizable=yes');"
            End If



            'ClientScript.RegisterStartupScript(Me.GetType(), "script", s, True)
            ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "script", s, True)

        End If
        SetGridStyle(grdNotAttachment)
    End Sub


    Protected Sub btnDel_Command(sender As Object, e As CommandEventArgs)

        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O"
        If e.CommandName = "Del" Then

            Dim sDOC_TYPE As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
            Dim sArgRefID As String = ""
            Dim sDOC_DESC As String
            Dim sAction As String
            Dim sFileName As String
            Dim sSr_no As String
            Dim sEmp_no As String
            'sWorklistID = e.CommandArgument 'wl_id
            sDOC_TYPE = e.CommandArgument.ToString.Split(",")(0).ToString
            sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString
            sDOC_DESC = e.CommandArgument.ToString.Split(",")(2).ToString
            sAction = e.CommandArgument.ToString.Split(",")(3).ToString
            sFileName = e.CommandArgument.ToString.Split(",")(4).ToString
            sSr_no = e.CommandArgument.ToString.Split(",")(5).ToString
            sEmp_no = e.CommandArgument.ToString.Split(",")(6).ToString
            'sFileName = row.Cells(4).Text.ToString
            Dim url As String
            Dim s As String

            If Session("supper_user").ToString = "True" Or Session("emp_no").ToString = sEmp_no Then


                Dim cn As New SqlConnection
                Dim cmd As New SqlCommand
                Dim trans As SqlTransaction

                cn = OpenConnection()
                trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
                cmd.Connection = cn
                cmd.Transaction = trans

                SetDateSession(cn, cmd)
                Dim saveFlag As Boolean = False
                Try
                    q = "delete from app_upload_mst where doc_no='" & sArgRefID & "' and sr_no='" & sSr_no & "' and doc_type='" & sDOC_TYPE & "'"
                    cmd.CommandText = q
                    cmd.ExecuteNonQuery()
                    trans.Commit()
                    saveFlag = True
                    Dim PathFileName = Server.MapPath("~/ImageStorage/" & sFileName)
                    System.IO.File.Delete(PathFileName)

                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
                If saveFlag = True Then


                    'ClientScript.RegisterStartupScript(Me.GetType(), "script", s, True)
                    ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "script", s, True)
                    loadAttachment()
                End If
            Else
                ShowPopUpMsg(Me.Page, "لايمكنك حذف ملف لم تقم بارفاقه ")
            End If

        End If
        'SetGridStyle(grdAttachment)

    End Sub

End Class

Contents of ucNotificationDetails.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucNotificationDetails.ascx.vb" Inherits="EnjazVB.ucNotificationDetails" %>
   <%@ Register Src="~/Controls/ucNotificationAttachment.ascx" TagPrefix="uc1" TagName="ucNotificationAttachment" %>
<div  class="form-group" >
 <div class="col-sm-12">

    
      <div class="col-sm-2"></div>
       <div class="col-sm-6">
              <asp:Label ID="lblSend" runat="server" Text="المرسل" Font-Bold="True" ></asp:Label>
           <asp:TextBox  CssClass="form-control"  runat="server" ReadOnly="true" ID="txtFrom" ></asp:TextBox>
              <asp:DropDownList ID="ddlTO" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
</div>
      <div class="col-sm-2">
             <asp:Label ID="Label1" runat="server" Text="التاريخ" Font-Bold="True" ></asp:Label>
       <asp:TextBox CssClass="form-control" runat="server" ReadOnly="true" ID="txtDate" ></asp:TextBox>
   </div>
          <div class="col-sm-2"></div>
      
     </div>
       </div>

      <%-- <div runat="server" visible="false" id="divTo"  class="form-group" >
 <div class="col-sm-12">
  <div class="row justify-content-center">
         <div class="col-sm-2"></div>
   <div class="col-sm-8">
           <asp:ListBox runat="server" ID="lsTo" ></asp:ListBox>     
 </div>
               <div class="col-sm-2"></div>
      </div>
     </div>
           </div>--%>


         <div  class="form-group" >
 <div class="col-sm-12">
  <div class="row justify-content-center">
         <div class="col-sm-2"></div>
       <div class="col-sm-8">
              <asp:Label ID="Label2" runat="server" Text="الموضوع" Font-Bold="True" ></asp:Label>
            <asp:TextBox ID="txtSubject" ReadOnly="true"  CssClass="form-control" runat="server"></asp:TextBox>
                                         </div>
         <div class="col-sm-2"></div>
     

  </div>
     </div>
            </div>
   

     <div  class="form-group" >
 <div class="col-sm-12">
       <div class="row justify-content-center">
              <div class="col-sm-2"></div>
              <div class="col-sm-8">
                     <asp:Label ID="Label3" runat="server" Text="نص التعميم" Font-Bold="True" ></asp:Label>
     <asp:TextBox  ReadOnly="true" ID="txtMessage" TextMode="MultiLine" Rows="15" Width="100%" style="overflow:auto;"   CssClass="form-control" runat="server"></asp:TextBox>
    </div>
              <div class="col-sm-2"></div>
                  </div>
       </div>
         </div>
  <div  class="form-group" >
 <div class="col-sm-12">
       <div class="row justify-content-center">
              <div class="col-sm-2"></div>
              <div class="col-sm-8">
                     <asp:Label ID="Label4" runat="server" Text="المرفقات" Font-Bold="True" ></asp:Label>
    <div  class="form-group" >
        <div style="height:150px;overflow:auto">
                   <asp:UpdatePanel ID="NotificationUpdatePanel" runat="server">
                    <ContentTemplate>
                                        <uc1:ucNotificationAttachment runat="server" id="ucNotificationAttachment" />
                                       </ContentTemplate>
                       </asp:UpdatePanel>
                        </div>
        </div>
    </div>
              <div class="col-sm-2"></div>
                  </div>
       </div>
         </div>

Contents of ucNotificationDetails.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucNotificationDetails

    '''<summary>
    '''lblSend control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblSend As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtFrom control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtFrom As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''ddlTO control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlTO As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtDate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDate As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtSubject control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtSubject As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtMessage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtMessage As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''NotificationUpdatePanel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents NotificationUpdatePanel As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''ucNotificationAttachment control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucNotificationAttachment As Global.EnjazVB.ucNotificationAttachment
End Class

Contents of ucNotificationDetails.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Public Class ucNotificationDetails
    Inherits System.Web.UI.UserControl
    Dim q As String = ""

    Public Property notType As String
        Get
            Return Session("notType")
        End Get
        Set(value As String)
            Session("notType") = value
        End Set
    End Property

    Public Property E_ID As String
        Get
            Return Session("E_ID")
        End Get
        Set(value As String)
            Session("E_ID") = value
            loadData()
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then

        End If
    End Sub
    Private Sub loadData()
        If notType = "SEND" Then
            ddlTO.Visible = True
            txtFrom.Visible = False
            q = "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE EMP_NO  IN (SELECT E_TO FROM NOTIFICATIONS_TO WHERE E_ID= '" & E_ID & "' ) "
            FillCombo(ddlTO, q)
            lblSend.Text = "المرسل اليه"
            ' FillListBox(lsTo, q)
        Else
            txtFrom.Visible = True
            ddlTO.Visible = False
            lblSend.Text = "المرسل"
        End If
        ucNotificationAttachment.requestId = E_ID
        q = ""
        q = "  SELECT E_ID,EMP_NAME AS E_FROM ,E_SUBJECT,N.E_BODY,FORMAT(SYS_DATE,'dd/MM/yyyy') AS E_DATE FROM NOTIFICATIONS N, EMP_MST E "
        q = q & "  WHERE  N.E_FROM=E.EMP_NO "
        q = q & "  AND N.E_ID='" & E_ID & "' "
        Dim dt = GetTable(q)
        If dt.Rows.Count > 0 Then
            txtFrom.Text = dt(0)("E_FROM").ToString
            txtDate.Text = dt(0)("E_DATE").ToString
            txtSubject.Text = dt(0)("E_SUBJECT").ToString
            txtMessage.Text = dt(0)("E_BODY").ToString
        End If
    End Sub
End Class

Contents of ucNotifications.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucNotifications.ascx.vb" Inherits="EnjazVB.ucNotifications" %> 

       <asp:UpdatePanel ID="UpdatePanelnotif"  runat="server">
    <ContentTemplate>
   <div  class="form-group" >
 <div class="col-sm-12">
  <div class="row justify-content-center">
      <%-- <div class="col-sm-1">
       </div>--%>
      <div class="col-sm-2"></div>
       <div class="col-sm-8">
           <asp:ListBox   SelectionMode="Multiple"   CssClass="form-control"  runat="server" ID="lsTo" ></asp:ListBox>
          
 </div>
          <div class="col-sm-2"></div>
      </div>
     </div>
       </div>

     

         <div  class="form-group" >
 <div class="col-sm-12">
  <div class="row justify-content-center">
         <div class="col-sm-2"></div>
       <div class="col-sm-8">
            <asp:TextBox ID="txtSubject" placeholder="الموضوع" CssClass="form-control" runat="server"></asp:TextBox>
                                         </div>
         <div class="col-sm-2"></div>
     

  </div>
     </div>
            </div>
     <br />

     <div  class="form-group" >
 <div class="col-sm-12">
       <div class="row justify-content-center">
              <div class="col-sm-2"></div>
              <div class="col-sm-8">
     <asp:TextBox Height="300" ID="txtMessage" TextMode="MultiLine" placeholder="نص الرسالة" CssClass="form-control" runat="server"></asp:TextBox>
    </div>
              <div class="col-sm-2"></div>
                  </div>
       </div>
         </div>
          <div runat="server"   class="form-group" >
 <div class="col-sm-12">
       <div class="row justify-content-center">
              <div class="col-sm-2"> </div>
              <div class="col-sm-8">
                  <div  class="form-group" >
                      <div class="col-sm-3">
                          <asp:Label ID="lblSend" runat="server" Text="مرفقات" Font-Bold="True" ></asp:Label>
                          </div>

                      <div class="col-sm-6">
                          <asp:Label ID="lblImageName" Visible="false"  runat="server" ForeColor="#FF3300"></asp:Label>
                 <asp:UpdatePanel ID="UpdatePanelUp" UpdateMode="Conditional" runat="server">
    <ContentTemplate>
                     <asp:FileUpload ID="up" runat="server"  AllowMultiple="True" CssClass="btn btn-default btn-md" Width="100%" meta:resourcekey="upResource1" />
    </ContentTemplate>
             
                     </asp:UpdatePanel>
        </div>

                      <div class="col-sm-3">
                          <asp:TextBox ID="txtDesc" runat="server" placeholder="Enter upload description ..." CssClass="form-control" meta:resourcekey="txtDescResource1"></asp:TextBox>
                          </div>
                      </div>
                 
</div>
              <div class="col-sm-2">
                   
              </div>
                  </div>
       </div>
         </div>

       <br />
      

     <div  class="form-group" >
          <div class="col-sm-12">
       <div class="row justify-content-center">
              <div class="col-sm-2"></div>
             
<div class="col-sm-8">
     <asp:LinkButton ID="btnSend" OnClick="btnSend_Click"  runat="server"    CssClass="btn btn-primary btn-md" 
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-send&quot;&gt;&lt;/i&gt;&nbsp;&nbsp; ارسال
                                                        "></asp:LinkButton>
       </div>
  <div class="col-sm-2"></div>
   </div>
 </div>
       </div>
      

            </ContentTemplate>
           <Triggers>  
   <asp:PostBackTrigger ControlID="btnSend"/>  
</Triggers>  
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress2" AssociatedUpdatePanelID="UpdatePanelnotif" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>

Contents of ucNotifications.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucNotifications

    '''<summary>
    '''UpdatePanelnotif control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanelnotif As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''lsTo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lsTo As Global.System.Web.UI.WebControls.ListBox

    '''<summary>
    '''txtSubject control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtSubject As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''txtMessage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtMessage As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblSend control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblSend As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''lblImageName control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblImageName As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''UpdatePanelUp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanelUp As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''up control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents up As Global.System.Web.UI.WebControls.FileUpload

    '''<summary>
    '''txtDesc control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDesc As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnSend control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSend As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress2 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucNotifications.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Public Class ucNotifications
    Inherits System.Web.UI.UserControl
    Dim q As String = ""

    Public Property isSupper As Boolean
        Get
            Return Session("isSupper")
        End Get
        Set(value As Boolean)
            Session("isSupper") = value
        End Set
    End Property

    Public Property isQulity As Boolean
        Get
            Return Session("isQulity")
        End Get
        Set(value As Boolean)
            Session("isQulity") = value
        End Set
    End Property

    Public Property isAccountant As Boolean
        Get
            Return Session("isAccountant")
        End Get
        Set(value As Boolean)
            Session("isAccountant") = value
        End Set
    End Property

    Public Property isSupvisor As Boolean
        Get
            Return Session("isSupvisor")
        End Get
        Set(value As Boolean)
            Session("isSupvisor") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load



        If Not IsPostBack Then
            Session("File") = Nothing
            isSupper = IIf(Session("supper_user").ToString = "True", True, False)
            isSupvisor = IIf(GetFieldValue("SELECT IS_SUP FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
            isQulity = IIf(GetFieldValue("SELECT QUALITY FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
            isAccountant = IIf(GetFieldValue("SELECT EMP_NO FROM APP_PROCESS_OWNER WHERE EMP_NO='" & Session("emp_no").ToString & "' AND PROCESS_ID='" & AppProcess.PROCRECEIPTCONFIRM.ToString.ToUpper & "'") <> "", True, False)
            If isSupper Or isAccountant Then
                q = "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A'  AND EMP_NO <>'" & Session("emp_no").ToString & "'  "
            Else
                q = "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' AND SUP='" & Session("emp_no").ToString & "'   "
            End If
            FillListBox(lsTo, q)

        Else
            If Session("File") IsNot Nothing Then
                Dim file As HttpPostedFile = (TryCast(Session("File"), HttpPostedFile))
                Dim FileName As String = file.FileName
                lblImageName.Text = FileName
            End If
        End If


    End Sub

    Protected Sub btnSend_Click(sender As Object, e As EventArgs)

        If up.HasFile Then
            Session("File") = up.PostedFile
            lblImageName.Text = up.PostedFile.FileName
        Else
            Session("File") = Nothing
            lblImageName.Text = String.Empty
        End If

        If txtSubject.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الموضوع")
            Exit Sub
        End If

        If txtMessage.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل نص التعميم")
            Exit Sub
        End If


        Dim cn As New SqlConnection
        Dim cmd As New SqlCommand
        Dim trans As SqlTransaction

        cn = OpenConnection()
        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        cmd.Connection = cn
        cmd.Transaction = trans

        SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Try
            btnSend.Enabled = False
            Dim E_ID = Session("emp_no").ToString & CDate(GetServerDate(cn, cmd)).ToString("yyyyMMdd") & CreateRandomValue()
            q = ""
            q = q & " INSERT INTO NOTIFICATIONS  "
            q = q & " ( "
            q = q & "      E_ID, "
            q = q & "      E_FROM, "
            q = q & "      E_SUBJECT, "
            q = q & "      E_BODY) "
            q = q & "      VALUES ( "
            q = q & "     '" & E_ID & "' ,  "
            q = q & "     '" & Session("emp_no").ToString & "' ,    "
            q = q & "      N'" & txtSubject.Text.ToString & "' ,   "
            q = q & "       N'" & txtMessage.Text.ToString & "'  "
            q = q & "       ) "
            cmd.CommandText = q
            cmd.ExecuteNonQuery()

            q = ""
            q = q & " INSERT INTO NOTIFICATIONS_TO  "
            q = q & " ( "
            q = q & "      E_ID, "
            q = q & "      E_TO) "
            q = q & "   SELECT   '" & E_ID & "' AS E_ID,EMP_NO FROM EMP_MST WHERE STATUS_FLAG='A'  AND EMP_NO <> '" & Session("emp_no").ToString & "'   "
            If ToInList(lsTo).ToString <> "ALL" Then
                q = q & "  AND EMP_NO IN (" & ToInList(lsTo).ToString & " )   "
            Else
                If isSupper Then

                Else
                    q = q & "  AND SUP='" & Session("emp_no").ToString & "'   "
                End If
            End If
            cmd.CommandText = q
            cmd.ExecuteNonQuery()


            Dim g As String = ""
            Dim UpOK As Boolean = False
            Dim NewFile As String = ""
            Dim imgPath As String = ""

            Dim imgSize As Integer = 0

            Dim i As Integer = 0
            'If up.HasFiles Then
            If up.FileName <> String.Empty Then
                For Each postedFile As HttpPostedFile In up.PostedFiles

                    imgSize = up.PostedFile.ContentLength
                    g = Guid.NewGuid().ToString
                    NewFile = g & Mid(up.FileName, up.FileName.LastIndexOf(".") + 1, 4)

                    If postedFile.ContentLength > 4000000 Then
                        Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "Alert", "alert('File is too big.')", True)
                    Else
                        postedFile.SaveAs(Server.MapPath("~/ImageStorage/" & NewFile))
                    End If

                    Dim q As String = ""


                    q = " insert into app_upload_mst (doc_type, "
                    q = q & "                         doc_no, "
                    q = q & "                         sr_no, "
                    q = q & "                         doc_desc, "
                    q = q & "                         filename, sys_date, sys_userid) "
                    q = q & "   values   ('DCOTHERS', "
                    q = q & "             '" & E_ID & "', "
                    q = q & "             (select isnull(max(sr_no),0) + 1 from APP_UPLOAD_MST where doc_no='" & E_ID & "'), "
                    q = q & "             N'" & txtDesc.Text & "', "
                    q = q & "             '" & NewFile & "', EnjazVB.GetServerDate(),'" & Session("user_id") & "') "

                    cmd.CommandText = q
                    cmd.ExecuteNonQuery()
                    i = i + 1

                Next

            End If



            trans.Commit()
            saveFlag = True
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
            trans.Rollback()
            btnSend.Enabled = True
        Finally
            cmd.Dispose()
            trans.Dispose()
            cn.Close()
            cn.Dispose()
        End Try
        If saveFlag = True Then
            'RedirectURL("../pages/Worklist.aspx")
            txtMessage.Text = ""
            txtSubject.Text = ""
            ' RedirectURL("../pages/Notifications.aspx")
            Dim message As String = "تم ارسال التعميم"

            ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType(), "Alert", "<script type = 'text/javascript'>window.onload=new function(){setTimeout(""alert('" + message + "');window.location='/../pages/Notifications.aspx';"", 1000)};</script>", False)
        End If

    End Sub


    Public Shared Function CreateRandomValue() As String
        Dim strPasswordCharacters As String = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ123456789"
        Dim randomNum As New Random()
        Dim chars As Char() = New Char(4 - 1) {}
        Try
            For i As Integer = 0 To 4 - 1
                chars(i) = strPasswordCharacters(CInt((strPasswordCharacters.Length) * randomNum.NextDouble()))
            Next
        Catch
            For i As Integer = 0 To 4 - 1
                chars(i) = strPasswordCharacters(CInt((strPasswordCharacters.Length) * randomNum.NextDouble()))
            Next
        End Try

        Return New String(chars)
    End Function
End Class

Contents of ucNotificationsList.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucNotificationsList.ascx.vb" Inherits="EnjazVB.ucNotificationsList" %>
 <%@ Register Src="~/Controls/ucNotificationDetails.ascx" TagPrefix="uc1" TagName="ucNotificationDetails" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>                
                <div class="form-horizontal">
                  

                   
                    <div  class="form-group">
                                <div class="col-sm-3">
                                    <asp:DropDownList ID="ddlNotType" CssClass="form-control" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlNotType_SelectedIndexChanged" 
                                         >
                                        <asp:ListItem Text="-فضلا اختر -" ></asp:ListItem>
                                         <asp:ListItem Text="تعاميم واردة" Value="RECEIVE" ></asp:ListItem>
                                        <asp:ListItem Text="تعاميم صادرة" Value="SEND" ></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                        </div>
                          <div class="form-group">
                        <div style="overflow: auto;">
                            <div style="direction:rtl;" class="table-responsive">
                                <asp:GridView ID="grdWL"   CssClass="table table-hover table-striped" runat="server" AllowPaging="false" AllowCustomPaging="false" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%" meta:resourcekey="grdWLResource1">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource1">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnRefresh" runat="server" CssClass="btn btn-primary btn-sm pull-right"  ToolTip="Refresh" meta:resourcekey="btnRefreshResource1" Text="
                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-refresh&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblSrNo" runat="server" Text='<%# Eval("srno") %>' meta:resourcekey="lblSrNoResource1"></asp:Label>
<%--                                                <asp:HiddenField ID="hwl_days" runat="server" Value='<%# Eval("wl_days") %>' />--%>
                                            </ItemTemplate>
                                           
                                        </asp:TemplateField>  
                                        
                                        

                                  <asp:TemplateField HeaderText="الموضوع" >
                                           <ItemTemplate>
                                                                                             <asp:LinkButton ID="btnStep" runat="server" OnCommand="btnStep_Command"
                                                     Text='<%# Bind("E_SUBJECT") %>'
                                                    ToolTip="Click to open the details" CommandName="Step" CommandArgument='<%# string.Concat(Eval("E_id"), ",", Eval("E_id"))%>'    />
                                            </ItemTemplate>
                                            
                                        </asp:TemplateField>
 <asp:TemplateField HeaderText="التاريخ"  >
                                           <ItemTemplate>
                                                <asp:Label ID="lblDate" runat="server" Text='<%# Eval("E_DATE") %>' ></asp:Label>
                                            </ItemTemplate>
                                            
                                        </asp:TemplateField>



                                        <asp:TemplateField HeaderText="مرسل من"  >
                                          <ItemTemplate>
                                                <asp:Label ID="lblSendFrom" runat="server" Text='<%# Eval("E_FROM") %>' ></asp:Label>
                                            </ItemTemplate>
                                            
                                        </asp:TemplateField>
                                    </Columns>
                                    <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                
                    </div>

                  <div id="NotificationModal" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="t4" class="modal-title" runat="server">
                            <asp:Localize ID="Localize3" runat="server" meta:resourcekey="Localize3Resource1" Text="تفاصيل الطلب"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         <div class="form-group">
                             <div class="col-sm-12">
                        <uc1:ucNotificationDetails runat="server" id="ucNotificationDetails" />
                       </div>
                             </div>
                      
                         <hr />
                        <br />
                        
                        
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>
                    </div>

                </div>
            </div>
        </div>
                </ContentTemplate>
    </asp:UpdatePanel>

Contents of ucNotificationsList.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucNotificationsList

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''ddlNotType control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlNotType As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''grdWL control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdWL As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''t4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents t4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize3 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucNotificationDetails control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucNotificationDetails As Global.EnjazVB.ucNotificationDetails
End Class

Contents of ucNotificationsList.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Public Class ucNotificationsList
    Inherits System.Web.UI.UserControl
    Dim q As String = ""
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then

        End If
        SetGridStyle(grdWL)
    End Sub
    Private Sub loadData()
        Dim Q As String = ""
        If ddlNotType.SelectedValue = "SEND" Then
            Q = ""
            Q = "  SELECT  ROW_NUMBER() OVER (ORDER BY  SYS_DATE DESC) as srno, N.E_ID,'' AS E_FROM ,E_SUBJECT,N.E_BODY,FORMAT(SYS_DATE,'dd/MM/yyyy') AS E_DATE FROM NOTIFICATIONS N "
            Q = Q & "  WHERE  N.E_FROM='" & Session("emp_no").ToString & "'  "
            grdWL.Columns(3).Visible = False
        ElseIf ddlNotType.SelectedValue = "RECEIVE" Then
            Q = ""
            Q = "  SELECT  ROW_NUMBER() OVER (ORDER BY  SYS_DATE DESC) as srno, N.E_ID,EMP_NAME AS E_FROM ,E_SUBJECT,N.E_BODY,FORMAT(SYS_DATE,'dd/MM/yyyy') AS E_DATE FROM NOTIFICATIONS N, EMP_MST E ,NOTIFICATIONS_TO T"
            Q = Q & "  WHERE  N.E_FROM=E.EMP_NO "
            Q = Q & "  AND N.E_ID=T.E_ID "
            Q = Q & "  AND T.E_TO='" & Session("emp_no").ToString & "'  ORDER BY SYS_DATE DESC  "
        Else
            Q = ""
        End If
        If Q <> "" Then
            Dim DT = GetTable(Q)
            grdWL.DataSource = dt
            grdWL.DataBind()
            SetGridStyle(grdWL)
        Else
            grdWL.DataSource = Nothing
            grdWL.DataBind()
            SetGridStyle(grdWL)
        End If
    End Sub
    Protected Sub ddlNotType_SelectedIndexChanged(sender As Object, e As EventArgs)
        loadData()
    End Sub

    Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
        Dim q As String = ""
        Dim E_ID As String

        'sWorklistID = e.CommandArgument 'wl_id
        E_ID = e.CommandArgument.ToString.Split(",")(0).ToString
        ucNotificationDetails.notType = ddlNotType.SelectedValue.ToString
        ucNotificationDetails.E_ID = E_ID
        OpenModal(Me.Page, "NotificationModal")
    End Sub
End Class

Contents of ucOfferDtl.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucOfferDtl.ascx.vb" Inherits="EnjazVB.ucOfferDtl" %>
<div class="form-group">
                              <div class="col-sm-3">
                                            <asp:Label ID="lbl" runat="server" Text="رقم العرض" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtOfferId" MaxLength="6"  ReadOnly="true"  placeholder="فضلا ادخل رقم العرض" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>

                               <div class="col-sm-3">
                         <asp:Label ID="Label1" runat="server" Text="نوع العقار" Font-Bold="True" ></asp:Label>
                          <asp:DropDownList ID="ddlRealEstate" Enabled="false"    runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>
                              </div>

        <div class="col-sm-3">
                                            <asp:Label ID="Label2" runat="server" Text="المدينة" Font-Bold="True"></asp:Label>
                          <asp:DropDownList ID="ddlCity" Enabled="false" AutoPostBack="true" OnSelectedIndexChanged="ddlCity_SelectedIndexChanged"   runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>
                                        </div>

      <div class="col-sm-3">
                         <asp:Label ID="Label3" runat="server" Text="الحي" Font-Bold="True" ></asp:Label>
                          <asp:DropDownList ID="ddlDistrict"  Enabled="false"  runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>
                              </div>

                            </div>


                           


                                   <div class="form-group">
                              <div class="col-sm-3">
                                            <asp:Label ID="Label4" runat="server" Text="المالك" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtOwnerName"  ReadOnly="true"  placeholder="فضلا ادخل اسم المالك" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>

                               <div class="col-sm-3">
                         <asp:Label ID="Label5" runat="server" Text="رقم الجوال" Font-Bold="True" ></asp:Label>
              <asp:TextBox ID="txtPhone" MaxLength="10"   ReadOnly="true"  placeholder="05xx فضلا ادخل جوال المالك" CssClass="form-control" runat="server"></asp:TextBox>
                              </div>

                                         <div class="col-sm-3">
                         <asp:Label ID="Label7" runat="server" Text="الحالة" Font-Bold="True" ></asp:Label>
                          <asp:DropDownList ID="ddlstatus" Enabled="false"  runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>
                              </div>
                            </div>

                         <div class="form-group">
                              <div class="col-sm-12">
                                            <asp:Label ID="Label6" runat="server" Text="وسف مختصر" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtRemarks" ReadOnly="true" TextMode="MultiLine" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                             </div>

Contents of ucOfferDtl.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucOfferDtl

    '''<summary>
    '''lbl control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lbl As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtOfferId control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtOfferId As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlRealEstate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlRealEstate As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCity control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCity As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlDistrict control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlDistrict As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtOwnerName control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtOwnerName As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label5 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtPhone control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPhone As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlstatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlstatus As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label6 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRemarks As Global.System.Web.UI.WebControls.TextBox
End Class

Contents of ucOfferDtl.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports WebClass.Sys.Classes
Public Class ucOfferDtl
    Inherits System.Web.UI.UserControl
    Dim q = ""


    Public Property OfferId As String
        Get
            Return ViewState("OfferId")
        End Get
        Set(value As String)
            ViewState("OfferId") = value
            loadData(value)
        End Set
    End Property
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub


    Private Sub loadData(Offer_id As String)
        q = "SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='RT'  "
        FillComboSelect(ddlRealEstate, q)

        q = "SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='CT'  "
        FillComboSelect(ddlCity, q)

        q = "SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='OS'  "
        FillComboSelect(ddlstatus, q)

        LoadOfferDetails(Offer_id)
    End Sub

    Public Sub LoadOfferDetails(ByVal Offer_id As String)
        q = " SELECT * FROM REAL_OFFERS WHERE OFFER_ID='" & Offer_id & "'"
        Dim DT = GetTable(q)
        If DT.Rows.Count = 0 Then
            DT = GetTableCon(q, "Enjazcon")
        End If
        If DT.Rows.Count > 0 Then
            Dim dr = DT(0)
            txtOfferId.Text = dr("OFFER_ID").ToString
            ddlRealEstate.SelectedValue = dr("REALESTATE").ToString
            ddlCity.SelectedValue = dr("CITY").ToString
            ddlCity_SelectedIndexChanged(Nothing, Nothing)
            ddlDistrict.SelectedValue = dr("DISTRICT").ToString
            txtOwnerName.Text = dr("OWNER_NAME").ToString
            txtPhone.Text = dr("OWNER_PHONE").ToString
            txtRemarks.Text = dr("REMARKS").ToString
            ddlstatus.SelectedValue = dr("STATUS").ToString

        End If
    End Sub


    Protected Sub ddlCity_SelectedIndexChanged(sender As Object, e As EventArgs)

        q = " SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='DS' AND TYPE_ABBR='" & ddlCity.SelectedValue.ToString & "' ORDER BY PERCENTAGE  "
        FillComboSelect(ddlDistrict, q)
    End Sub

End Class

Contents of ucPendingRequests.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucPendingRequests.ascx.vb" Inherits="EnjazVB.ucPendingRequests" %>
  <%@ Register Src="~/Controls/ucCustomerInfo.ascx" TagPrefix="uc1" TagName="ucCustomerInfo" %>
<%@ Register Src="~/Controls/ucApprovals.ascx" TagPrefix="uc1" TagName="ucApprovals" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>                
                <div class="form-horizontal">
                  
                    <div class="form-group">
                   <div class="col-sm-4">
<asp:CheckBox  ID="ChAll" runat="server" AutoPostBack="true" OnCheckedChanged="ChAll_CheckedChanged"    Text="عرض كل الطلبات المؤجلة" />
                    </div>
                        </div>
                          <div class="form-group">
                        <div style="overflow: auto;">
                            <div style="direction:rtl;" class="table-responsive">
                                <asp:GridView ID="grdWL"   CssClass="table table-hover table-striped" runat="server" AllowPaging="false" AllowCustomPaging="false" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%" meta:resourcekey="grdWLResource1">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource1">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnRefresh" runat="server" CssClass="btn btn-primary btn-sm pull-right"  ToolTip="Refresh" meta:resourcekey="btnRefreshResource1" Text="
                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-refresh&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblSrNo" runat="server" Text='<%# Eval("srno") %>' meta:resourcekey="lblSrNoResource1"></asp:Label>
<%--                                                <asp:HiddenField ID="hwl_days" runat="server" Value='<%# Eval("wl_days") %>' />--%>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>  
                                        
                                        <asp:TemplateField HeaderText="رقم الطلب" SortExpression="doc_no" >
                                       <HeaderTemplate>
                                                <asp:LinkButton ID="lbldoc_no" runat="server" Text="رقم الطلب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="ref_id" ></asp:LinkButton>
                                                <asp:TextBox ID="ref_id" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton ID="btnStep" runat="server" OnCommand="btnStep_Command"
                                                     Text='<%# Bind("ref_id") %>'
                                                    ToolTip="Click to open the details" CommandName="Step" CommandArgument='<%# string.Concat(Eval("ref_id"), ",", Eval("ref_id"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <%-- Enabled='<%# IIf(isSupper Or isSupvisor, True, False) %>'--%>
                                             

 <asp:TemplateField HeaderText="العميل" SortExpression="customer" >
       <HeaderTemplate>
                                                <asp:LinkButton ID="lblFcustomer" runat="server" Text="العميل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="customer" ></asp:LinkButton>
                                                <asp:TextBox ID="customer" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                           <ItemTemplate>
                                                <asp:Label ID="lblcustomer" runat="server" Text='<%# Eval("customer") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                          

                                        <asp:TemplateField HeaderText="هوية العميل" SortExpression="cust_id" >
                                           <HeaderTemplate>
                                                <asp:LinkButton ID="lblcust_id" runat="server" Text="هوية العميل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="cust_id" ></asp:LinkButton>
                                                <asp:TextBox ID="cust_id" AutoPostBack="True" CssClass="form-control input-sm" OnTextChanged="txtFWL_TextChanged" runat="server" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblcust_id" runat="server" Text='<%# Eval("cust_id") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>



                                        <asp:TemplateField HeaderText="موظف البنك" SortExpression="initempbank" >
                                           <HeaderTemplate>
                                                <asp:LinkButton ID="lblinitempbank" runat="server" Text="موظف البنك" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="EvalEmpBank" ></asp:LinkButton>
                                                <asp:TextBox ID="initempbank" AutoPostBack="True" CssClass="form-control input-sm" OnTextChanged="txtFWL_TextChanged" runat="server"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lbllinitempbank" runat="server" Text='<%# Eval("initempbank") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

      <asp:TemplateField HeaderText="الموظف المتابع" SortExpression="emp_name" >
              <HeaderTemplate>
                                                <asp:LinkButton ID="lblEmployee" runat="server" Text="الموظف المتابع" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="emp_name" ></asp:LinkButton>
                                                <asp:TextBox ID="emp_name" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                          <ItemTemplate>
                                                <asp:Label ID="lblemp_name" runat="server" Text='<%# Eval("emp_name") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>


 <asp:TemplateField HeaderText="بنك التمويل" SortExpression="INV_bank"  >
          <HeaderTemplate>
                                                <asp:LinkButton ID="lblINV_bank" runat="server" Text="بنك التمويل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="inv_bank" ></asp:LinkButton>
                                                <asp:TextBox ID="inv_bank" AutoPostBack="True" CssClass="form-control input-sm" runat="server" ></asp:TextBox>
                                            </HeaderTemplate>

                                         <ItemTemplate>
                                                <asp:Label ID="lblINV_bank" runat="server" Text='<%# Eval("INV_bank") %>' meta:resourcekey="lblPriorityResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                            <%--  <asp:TemplateField HeaderText="بنك الراتب" SortExpression="salary_bank"  >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblBank" runat="server" Text="بنك الراتب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="salary_bank" ></asp:LinkButton>
                                                <asp:TextBox ID="salary_bank" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblBank" runat="server" Text='<%# Eval("salary_bank") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>



                                        <asp:TemplateField HeaderText="تاريخ الطلب" SortExpression="doc_date" meta:resourcekey="TemplateFieldResource3">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWDate" runat="server" Text="تاريخ الطلب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="doc_date" ></asp:LinkButton>
                                                <asp:TextBox ID="doc_date" AutoPostBack="True" CssClass="form-control input-sm" TextMode="Date" runat="server" OnTextChanged="txtFWL_TextChanged" meta:resourcekey="wl_dateResource1"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblDate" runat="server" Text='<%# Eval("doc_date") %>' meta:resourcekey="lblDateResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        

                                      <%--   <asp:TemplateField HeaderText="حالة الطلب" SortExpression="status" >
                                         <HeaderTemplate>
                                                <asp:LinkButton ID="lblfstatus" runat="server" Text="حالة الطلب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="status" ></asp:LinkButton>
                                                <asp:TextBox ID="status" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                             <ItemTemplate>
                                                <asp:Label ID="lblstatus" runat="server" Text='<%# Eval("status") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>


                                         <asp:TemplateField HeaderText="سبب التاجيل" SortExpression="status" >
                                         <HeaderTemplate>
                                                <asp:LinkButton ID="lblReason" runat="server" Text="سبب التاجيل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="HOLD_REASON" ></asp:LinkButton>
                                                <asp:TextBox ID="HOLD_REASON" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                             <ItemTemplate>
                                                <asp:Label ID="lblHold_reason" runat="server" Text='<%# Eval("HOLD_REASON") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        


                                            <asp:TemplateField HeaderText="اخر تحديث"  >
                                          <%--  <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWLID" runat="server" Text="تسلسل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="wl_id" ></asp:LinkButton>
                                                <asp:TextBox ID="wl_id" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" meta:resourcekey="wl_idResource1"></asp:TextBox>
                                            </HeaderTemplate>--%>
                                            <ItemTemplate>
                                                <asp:Label ID="lblWlID" runat="server" Text='<%# Eval("last_update") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

<%--                                        <asp:BoundField DataField="next_process_id" HeaderText="NextProcessID" Visible="False"  />
                                        <asp:BoundField DataField="process_id" HeaderText="ProcessID" Visible="False"  />--%>

                                  <%--      <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource13">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnpending" runat="server" CssClass="btn btn-primary btn-sm pull-right" ToolTip="Pending List"  Text="
                                                        &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-right&quot;&gt;&lt;/i&gt;
                                                " ></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:LinkButton ID="btnPending" runat="server"
                                                    ToolTip="Add to Pending" CssClass="btn btn-primary btn-sm pull-right" CommandName="addpending" CommandArgument='<%# Eval("wl_id") %>'  OnClientClick="javascript:return confirm('Are you sure add to pending?');" meta:resourcekey="btnPendingResource2" Text="
                                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-left&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>
                                    </Columns>
                                    <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                
                    </div>
                <div id="myModal" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="t4" class="modal-title" runat="server">
                            <asp:Localize ID="Localize3" runat="server" meta:resourcekey="Localize3Resource1" Text="تفاصيل الطلب"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         <div class="form-group">
                             <div class="col-sm-12">
                        <uc1:ucCustomerInfo runat="server" id="ucCustomerInfo" />
                       </div>
                             </div>
                         
                         <div class="form-group">
                               <div class="col-sm-12">
                         <asp:Label ID="Label7" runat="server" Text="الموافقات" Font-Bold="True" ></asp:Label>
                        <div class="form-group">
                                  <div style="height:350px;overflow:auto">
                                 <uc1:ucApprovals runat="server" id="ucApprovals" />
                                      </div>
                                </div>
                                   </div>
                             </div>
                         <hr />
                        <br />
                        
                        <div runat="server" visible="false" id="divPending" class="form-group">
                               <div class="col-sm-3">
        <asp:Label ID="Label36" runat="server" Text="سبب التأجيل" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlReason" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>
                                <div class="col-sm-3">
           <asp:Label ID="Label37" runat="server" Text="مدة التأجيل" Font-Bold="True" ></asp:Label>
           <asp:DropDownList ID="ddlTime" runat="server" CssClass="form-control input-sm" Width="100%">
              <%--<asp:ListItem Value="" Text="-فضلا اخترالمدة-"></asp:ListItem>
               <asp:ListItem Value="7" Text="اسبوع"></asp:ListItem>
               <asp:ListItem Value="15" Text="اسبوعين"></asp:ListItem>
               <asp:ListItem Value="21" Text="ثلاثة اسابيع"></asp:ListItem>
               <asp:ListItem Value="30" Text="شهر "></asp:ListItem>--%>
           </asp:DropDownList>
      </div>

                               <div class="col-sm-2">
                                              <asp:Label ID="Label2" runat="server" Text="." Font-Bold="True" ></asp:Label>
                                                <asp:LinkButton ID="btnPending" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnPending_Click"
                                       OnClientClick="return  ValidatePending()"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;تأجيل الطلـــــب 
                                                        " ></asp:LinkButton>
                                              </div>

                            <div runat="server" class="col-sm-2">
                                                  <asp:Label ID="lblStatus" runat="server" Text="حالة الطلب" Font-Bold="True" ></asp:Label>
                                               <asp:DropDownList ID="ddlStatus" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                        <%-- <asp:TextBox ID="txtEmployee"   ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>--%>
                                                </div>
                             <div class="col-sm-2">
                                              <asp:Label ID="Label1" runat="server" Text="." Font-Bold="True" ></asp:Label>
                                                <asp:LinkButton ID="btnUpdateStatus" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnUpdateStatus_Click"
                                       OnClientClick="return  ValidateStatus()"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;تعـديل حالة الطلب  
                                                        " ></asp:LinkButton>
                                              </div>
                             </div>

                        <br />
                         <div runat="server" visible="false" id="NotesDiv" class="form-group">
                                <div class="col-sm-10">
                                                   <asp:Label ID="Label21" runat="server" Text="تحديث الحالة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtRemarks"    CssClass="form-control" runat="server" ></asp:TextBox>
                                               </div>
                               <div class="col-sm-2">
                                              <asp:Label ID="Label22" runat="server" Text="." Font-Bold="True" ></asp:Label>
                                                <asp:LinkButton ID="btnAddRemarks" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnAddRemarks_Click" 
                                       OnClientClick="if (confirm('هل تريد تحديث الحالة ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;تحديث  حالة  الطلب
                                                        " ></asp:LinkButton>
                                              </div>
                             </div>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>
                    </div>

                </div>
            </div>
        </div>

                </ContentTemplate>
            </asp:UpdatePanel>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>
  
   <script type="text/javascript">
    function ValidateStatus() {
        var ddlStatus = document.getElementById("<%=ddlStatus.ClientID %>");
        if (ddlStatus.value == "") {
            //If the "Please Select" option is selected display error.
            alert("فضلا اختر الحالة");
            return false;
        }
        return true;
       }

       function ValidatePending() {
           var ddlReason = document.getElementById("<%=ddlReason.ClientID %>");
           var ddlTime = document.getElementById("<%=ddlTime.ClientID %>");
           if (ddlReason.value == "") {
                  //If the "Please Select" option is selected display error.
                  alert("فضلا اختر سبب التأجيل");
                  return false;
           }
           if (ddlTime.value == "") {
               //If the "Please Select" option is selected display error.
               alert("فضلا اختر مدة التأجيل");
               return false;
           }
              return true;
          }
   </script>   

Contents of ucPendingRequests.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucPendingRequests

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''ChAll control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ChAll As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''grdWL control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdWL As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''t4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents t4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize3 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucCustomerInfo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucCustomerInfo As Global.EnjazVB.ucCustomerInfo

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ucApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucApprovals As Global.EnjazVB.ucApprovals

    '''<summary>
    '''divPending control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divPending As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label36 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label36 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlReason control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlReason As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label37 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label37 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlTime control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlTime As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnPending control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnPending As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''lblStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblStatus As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlStatus As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnUpdateStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnUpdateStatus As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''NotesDiv control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents NotesDiv As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label21 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label21 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRemarks As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label22 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label22 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnAddRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnAddRemarks As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucPendingRequests.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports WebClass.Sys.Classes
Public Class ucPendingRequests
    Inherits System.Web.UI.UserControl

    Dim sSql As String = ""


    Private Property PendingFlag As String
        Get
            Return Session("PendingFlag")
        End Get
        Set(value As String)
            Session("PendingFlag") = value
        End Set
    End Property


    Public Property isSupper As Boolean
        Get
            Return Session("isSupper")
        End Get
        Set(value As Boolean)
            Session("isSupper") = value
        End Set
    End Property

    Public Property isSupvisor As Boolean
        Get
            Return Session("isSupvisor")
        End Get
        Set(value As Boolean)
            Session("isSupvisor") = value
        End Set
    End Property

    Private Property RpWLFilterCondition As String
        Get
            Return Session("RpWLFilterCondition")
        End Get
        Set(value As String)
            Session("RpWLFilterCondition") = value
        End Set
    End Property

    Private Property pWLFilterValue As String
        Get
            Return Session("pWLFilterValue")
        End Get
        Set(value As String)
            Session("pWLFilterValue") = value
        End Set
    End Property

    Public Property requestId As String
        Get
            Return ViewState("requestId")
        End Get
        Set(value As String)
            ViewState("requestId") = value
        End Set
    End Property

    Public Property requestOwner As String
        Get
            Return ViewState("requestOwner")
        End Get
        Set(value As String)
            ViewState("requestOwner") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If
        Try


            If Not IsPostBack Then
                ' grdWL.VirtualItemCount = GetOpenWL(Session("EmpNo").ToString, False)
                ' grdWL.VirtualItemCount = GetOpenWL(Session("emp_no").ToString, False)
                PendingFlag = "N"
                isSupper = IIf(Session("supper_user").ToString = "True", True, False)
                isSupvisor = IIf(GetFieldValue("SELECT IS_SUP FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
                FillPendingDays(ddlTime)
                GetPageData(0, 10)
            End If
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)
        End Try
        SetGridStyle(grdWL)
    End Sub

    Protected Sub ddlStatus_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Private Sub GetPageData(pgIndex As Integer, pgSize As Integer)

        Try
            Dim dt As New DataTable
            'If pWLFilterCondition <> "" Then

            sSql = "             "
            sSql = sSql & "   SELECT  ROW_NUMBER() OVER (ORDER BY  Convert(date,doc_date,103) DESC) as srno,a.* FROM (  "
            sSql = sSql & "   select h.doc_no AS REF_ID ,format(h.doc_date,'dd/MM/yyyy')doc_date, REQ_BY AS customer ,h.initempbank,h.CUST_ID, BK.TYPE_DESC AS salary_bank, W.TYPE_dESC AS SEC,H.CONTACT_NO ,s.type_desc as status ,H.STATUS  AS STATUS_CODE,H.ref_procid,ISNULL(H.REF_DOCNO,'O')REF_DOCNO ,H.refcomp_code,ISNULL(H.SERVICE,'F') AS SERVICE,"
            sSql = sSql & "   IK.TYPE_DESC  as INV_bank,h.other5 as investment_amt,h.other6 as readEstateAmt,h.other7 as corporate,e.emp_name,H.EMP_NO,H.dept_head,N.TYPE_DESC AS HOLD_REASON,H.last_update  "
            sSql = sSql & "   from ARS_REQUEST_HDR h WITH (NOLOCK) left join  emp_mst e WITH (NOLOCK)  on h.emp_no=e.emp_no inner join (select * from type_mst WITH (NOLOCK) where type_code='RS') S on h.status=s.type_category  "
            sSql = sSql & "   left join (select * from type_mst WITH (NOLOCK) where type_Code='BK') BK ON H.OTHER1=BK.TYPE_cATEGORY "
            sSql = sSql & "   left join (select * from type_mst WITH (NOLOCK) where type_Code='BK') IK ON H.OTHER4=IK.TYPE_cATEGORY "
            sSql = sSql & "   left join (select * from type_mst WITH (NOLOCK) where type_Code='WE')W ON H.OTHER3=W.TYPE_CATEGORY "
            sSql = sSql & "   left join (select * from type_mst WITH (NOLOCK) where type_Code='HD')N ON H.hold_reason=N.TYPE_CATEGORY     "
            'sSql = sSql & "   LEFT JOIN  APP_WORKLIST L WITH (NOLOCK)  ON L.WL_ID=(SELECT TOP 1 WL_ID FROM APP_WORKLIST WHERE CLOSED_DATE IS NOT NULL AND  REF_ID=H.DOC_NO  ORDER BY CLOSED_DATE DESC)"
            'sSql = sSql & "   OUTER APPLY (SELECT TOP 1 CLOSED_REMARKS, CLOSED_DATE  FROM APP_WORKLIST WITH (NOLOCK) WHERE CLOSED_DATE IS NOT NULL  and ref_id=H.DOC_NO   ORDER BY CLOSED_DATE DESC)  L  "


            sSql = sSql & "      WHERE  1=1 AND  H.TRAN_TYPE='R'  "
            If ChAll.Checked = True Then
            Else
                sSql = sSql & "      AND    CONVERT(DATE,H.hold_time,103) <=CONVERT(DATE,EnjazVB.GetServerDate(),103)  "
            End If


            sSql = sSql & "      AND  H.STATUS  ='N'  AND ISNULL(HOLD_REASON,'')<>''   "

            sSql = sSql & "     )a    "

            sSql = sSql & "   where 1=1 "
            If Session("supper_user").ToString = "True" Then
            Else
                sSql = sSql & " and  (emp_no='" & Session("emp_no").ToString & "' OR  dept_head='" & Session("emp_no").ToString & "'  )  "
            End If
            If RpWLFilterCondition <> "" Then
                sSql = sSql & " And " & RpWLFilterCondition
            End If
            ' sSql = sSql & " and  (emp_no='" & Session("emp_no").ToString & "'  )  "
            sSql = sSql & " ORDER BY emp_name "










            '    sSql = "SELECT WL.*  FROM ("
            '    sSql = sSql & " SELECT ROW_NUMBER() OVER (ORDER BY  WL_DAYS DESC, CAST(WL_ID AS NUMERIC(38, 10)) DESC) SRNO, A.* FROM VOPENWORKLIST A WHERE 1=1 "
            '    sSql = sSql & " AND OWNER='" & Session("emp_no").ToString & "' AND PENDING_FLAG='" & PendingFlag & "'"
            '    sSql = sSql & " AND " & pWLFilterCondition
            '    sSql = sSql & " ) WL"
            '    sSql = sSql & "  WHERE SRNO BETWEEN ((" & pgIndex & "*10)+1) AND ((" & pgIndex & "+1)*" & pgSize & ")"
            '    sSql = sSql & " ORDER BY SRNO"
            'Else
            '    sSql = " SELECT WL.* FROM ("
            '    sSql = sSql & " SELECT ROW_NUMBER() OVER (ORDER BY  WL_DAYS DESC, CAST(WL_ID AS NUMERIC(38, 10)) DESC) SRNO, A.* FROM VOPENWORKLIST A WHERE 1=1"
            '    sSql = sSql & " AND OWNER='" & Session("emp_no").ToString & "' AND PENDING_FLAG='" & PendingFlag & "'"
            '    sSql = sSql & ") WL"
            '    sSql = sSql & " WHERE  "
            '    sSql = sSql & "  SRNO BETWEEN ((" & pgIndex & "*10)+1) AND ((" & pgIndex & "+1)*" & pgSize & ")"
            '    sSql = sSql & " ORDER BY SRNO"
            'End If

            dt = GetTable(sSql)
            Dim dt2 = GetTableCon(sSql, "Enjazcon")

            dt.Merge(dt2)
            Dim sortedResults = From row In dt.AsEnumerable()
                                Order By (row.Field(Of String)("emp_name")) Ascending

            dt = dt.Clone() ' Clone the structure (columns) of the original table
            ' Import each sorted row into the new DataTable
            Dim rowNumber As Integer = 1
            For Each row In sortedResults
                row("SRNO") = rowNumber
                dt.ImportRow(row)
                rowNumber += 1
            Next
            dt.AcceptChanges()

            If dt.Rows.Count = 0 Then
                Dim nr As DataRow = dt.NewRow
                'dinesh(17-04-23) add empty values as error rais null values to slect color
                'nr("priority") = ""
                nr("srno") = 0
                dt.Rows.Add(nr)
                dt.AcceptChanges()
            End If
            grdWL.DataSource = dt
            grdWL.DataBind()
            SetGridStyle(grdWL)
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)

        End Try
        RpWLFilterCondition = ""
    End Sub

    Protected Sub grdWL_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles grdWL.PageIndexChanging
        grdWL.PageIndex = e.NewPageIndex
        GetPageData(e.NewPageIndex, 10)
        SetGridStyle(grdWL)
    End Sub


    Protected Sub txtFWL_TextChanged(sender As Object, e As EventArgs)
        Dim strText As String = "", strName As String = ""
        strText = CType(sender, TextBox).Text.ToString
        strName = CType(sender, TextBox).ID.ToString

        pWLFilterValue = strText
        RpWLFilterCondition = ""


        If strText <> "" Then
            If strName = "doc_date" Or strName = "ref_date" Then
                strText = CDate(strText).ToString("dd/MM/yyyy")
                RpWLFilterCondition = " format(" & strName & ") = format('" & strText & "','DD/MM/YYYY')"
            Else
                strText = "N'%" & strText.ToUpper & "%'"
                RpWLFilterCondition = " upper(" & strName & ") Like " & strText
            End If
        End If

        GetPageData(0, 10)
        SetGridStyle(grdWL)
    End Sub


    Private Sub grdWL_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles grdWL.RowDataBound
        If IsNothing(RpWLFilterCondition) Then
            RpWLFilterCondition = ""
        End If

        If e.Row.RowType = DataControlRowType.Header Then
            If RpWLFilterCondition.ToLower.ToString.Contains("(ref_id") Then
                CType(e.Row.FindControl("ref_id"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(customer") Then
                CType(e.Row.FindControl("customer"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(contact_no") Then
                CType(e.Row.FindControl("contact_no"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(sec") Then
                CType(e.Row.FindControl("sec"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(inv_bank") Then
                CType(e.Row.FindControl("inv_bank"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(salary_bank") Then
                CType(e.Row.FindControl("salary_bank"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(doc_date") Then
                'CType(e.Row.FindControl("wl_date"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", CDate(Session("pWLFilterValue")).ToString("yyyy-mm-dd"))
                CType(e.Row.FindControl("doc_date"), TextBox).Text = CDate(Session("pWLFilterValue")).ToString("yyyy-MM-dd")
            End If

            If RpWLFilterCondition.ToLower.ToString.Contains("(emp_name") Then
                CType(e.Row.FindControl("emp_name"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(status") Then
                CType(e.Row.FindControl("status"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If

        End If


        If e.Row.RowType = DataControlRowType.DataRow Then



        End If


        SetGridStyle(grdWL)
    End Sub



    Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O" 'rblWLStatus.SelectedValue.ToString


        Dim sWorklistID As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
        Dim sArgRefID As String = ""
        'sWorklistID = e.CommandArgument 'wl_id
        sWorklistID = e.CommandArgument.ToString.Split(",")(0).ToString
        sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString
        requestId = sArgRefID
        requestOwner = GetFieldValue("select emp_no from ars_request_hdr where doc_no='" & requestId & "'")
        If requestOwner = "" Then
            requestOwner = GetFieldValueCon("select emp_no from ars_request_hdr where doc_no='" & requestId & "'", "Enjazcon")
        End If
        sRefID = ""
        sCurrentProcessCode = ""
        sNextProcessCode = ""
        sPageLink = ""
        If requestOwner = Session("emp_no").ToString Then
            NotesDiv.Visible = True
            divPending.Visible = True
        Else
            NotesDiv.Visible = False
            divPending.Visible = False
        End If
        FillComboSelectText(ddlReason, "SELECT type_category , type_desc FROM type_mst WHERE type_code='HD' ", "فضلا اختر السبب")
        FillComboSelect(ddlStatus, "select type_category, type_Desc from type_mst where type_code='RS' and type_category IN ('O','D')")
        'q = "SELECT MODULE_ID,PROCESS_ID,REF_ID,NEXT_PROCESS_ID,PAGELINK FROM APP_WORKLIST WHERE WL_ID='" & sWorklistID & "' AND STATUS='" & wlStatus & "' "


        'Dim dtr = GetTable(q)
        'For Each rdr As DataRow In dtr.Rows
        '    sRefID = rdr("ref_id").ToString
        '    sCurrentProcessCode = rdr("process_id").ToString
        '    sNextProcessCode = rdr("next_process_id").ToString
        '    sPageLink = rdr("pagelink").ToString
        '    sModuleID = rdr("module_id").ToString
        '    Exit For
        'Next

        ' RedirectURL("../pages/ReqDetails.aspx?p1=" & sArgRefID)
        If e.CommandName = "Step" Then
            ucCustomerInfo.DocNo = sArgRefID
            ucApprovals.DocNo = sArgRefID
            ''requestOwner = GetFieldValue("select emp_no from ars_request_hdr where doc_no='" & sArgRefID & "'")
            ''Dim ReqStatus = GetFieldValue("select status from ars_request_hdr where doc_no='" & sArgRefID & "'")
            ''Dim UploadDocStep = GetFieldValue("select WL_ID from APP_WORKLIST where REF_ID='" & sArgRefID & "' AND NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "' AND STATUS='O'")
            ''If requestOwner = Session("emp_no").ToString And ReqStatus <> "D" And ReqStatus <> "C" And (ReqStatus = "N" Or UploadDocStep <> "") Then
            ''    NotesDiv.Visible = True
            ''Else
            ''    NotesDiv.Visible = False
            ''End If
            '''NotesDiv.Visible = True
            OpenModal(Me.Page, "myModal")
            '  OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)
        ElseIf e.CommandName = "Detail" Then

            OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)


            'If sPageLink <> "" Then
            '    ' sPageLink = "../../../" & sModuleID & "/" & Session("Language") & "/" & Replace(sPageLink, "../", "") 'format for the new system
            '    sPageLink = "../../../" & Replace(sPageLink, "../", "") 'format for the new system

            '    If Not sPageLink.ToUpper.Contains(".ASPX") Then
            '        ' clsGenClass.OpenTab(Me.Page, sPageLink & "&ViewMode=" & rblWLStatus.SelectedValue.ToString)
            '        'tkID = clsGenClass.InsertToken("N")
            '        'clsGenClass.OpenTab(Me.Page, sModuleLink & "default.aspx?token=" & tkID.ToString & "&div=" & Session("CompCode") & "&lnk=" & Server.UrlEncode(Replace(sPageLink, "..", Session("Language").ToString) & "&ViewMode=" & rblWLStatus.SelectedValue.ToString))
            '        OpenWorklistPage(Me.Page, sWorklistID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, sPageLink)
            '    Else
            '        OpenTab(Me.Page, sPageLink & "&ViewMode=" & wlStatus, sWorklistID)
            '    End If
            'End If
        ElseIf e.CommandName = "addpending" Then
            ' AddtoPending(e.CommandArgument)
            'AddtoPending(e.CommandArgument.ToString.Split(",")(0).ToString)
            'GetPageData(0, 10)
        End If
        SetGridStyle(grdWL)
    End Sub

    Protected Sub ddlStep_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub btnAddRemarks_Click(sender As Object, e As EventArgs)
        If txtRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل ملاحظة اكمال المستندات")
            Exit Sub
        End If

        Dim cn As New SqlConnection
        Dim cmd As New SqlCommand
        Dim trans As SqlTransaction

        cn = OpenConnection()
        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        cmd.Connection = cn
        cmd.Transaction = trans

        SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Try

            Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
            AppWl.WL03ProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
            AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
            AppWl.WL05RefID = requestId
            ' AppWl.WL99RefWLID = ViewState("p1")
            AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
            AppWl.WL121ClosedRemarks = txtRemarks.Text.ToString
            AppWl.WL11ClosedDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
            AppWl.WL12ClosedBy = Session("user_id").ToString

            AppWl.WL07Priority = "N"
            AppWl.WL08CompCode = AppWl.WL08CompCode
            AppWl.WL09SysUserID = AppWl.WL09SysUserID
            AppWl.WL13Status = "C"

            AppWl.WL14NextProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
            AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
            AppWl.WL16RefStationID = ""
            AppWl.WL17RefTask = ""
            AppWl.WL18RefOther = "R"
            AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper


            ' AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
            AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
            AppWl.WL98OnlyOwner = Session("emp_no").ToString

            'AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
            'AppWl.WL98OnlyOwner = ddlEmployee.SelectedValue.ToString
            AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
            AppWl.WL99ModuleID = "R"
            AppWl.WL99ApprLevel = "0"
            InsertRemarks(cn, cmd, AppWl)
            'InsertNewRemarks(cn, cmd, AppWl)

            'InsertWorklist(cn, cmd, AppWl)

            trans.Commit()
            saveFlag = True
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
            trans.Rollback()

        Finally
            cmd.Dispose()
            trans.Dispose()
            cn.Close()
            cn.Dispose()
        End Try
        If saveFlag = True Then
            txtRemarks.Text = ""
            CloseModal(Me.Page, "myModal")
            '  RedirectURL("../pages/Worklist.aspx")
            ' ucApprovals.DocNo = requestId
        End If
        GetPageData(0, 0)
    End Sub

    Protected Sub ddlCompPay_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub ddlCustomService_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub btnPending_Click(sender As Object, e As EventArgs)

        If ddlReason.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد سبب التاجيل")
            Exit Sub
        End If

        If ddlTime.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد مدة التأجيل")
            Exit Sub
        End If
        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)
                        Dim q As String = ""

                        q = ""
                        q = q & " update ars_request_hdr set status='N',hold_reason='" & ddlReason.SelectedValue.ToString() & "',hold_time=DATEADD(DAY, " & ddlTime.SelectedValue.ToString & ",EnjazVB.GetServerDate())  where doc_no= '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()

                        RunInOtherDb(q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    '  cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            'RedirectURL("../pages/Worklist.aspx")
            CloseModal(Me.Page, "myModal")
        End If
        GetPageData(0, 0)
    End Sub

    Protected Sub btnUpdateStatus_Click(sender As Object, e As EventArgs)
        If ddlStatus.SelectedItem.Value = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر الحالة")
            Exit Sub
        End If
        Dim Q As String = ""

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)
                        btnUpdateStatus.Enabled = False

                        If ddlStatus.SelectedValue = "O" Then
                            Q = ""
                            Q = Q & " update ars_request_hdr set status='" & ddlStatus.SelectedItem.Value.ToString & "' where doc_no= '" & requestId & "'   "
                            cmd.CommandText = Q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(Q)

                            Q = ""
                            Q = Q & " update app_worklist set status='" & ddlStatus.SelectedItem.Value.ToString & "' where ref_id= '" & requestId & "'   AND WL_ID = (SELECT TOP 1  O.WL_ID FROM APP_WORKOWNER O, APP_WORKLIST W WHERE O.WL_ID=W.WL_ID AND W.REF_ID= '" & requestId & "' AND   O.OWNER='" & Session("emp_no").ToString & "' AND  NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "' ORDER BY WL_DATE DESC  )   "
                            cmd.CommandText = Q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(Q)
                        Else


                            Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                            AppWl.WL03ProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper
                            AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                            AppWl.WL05RefID = requestId
                            ' AppWl.WL99RefWLID = ViewState("p1")
                            AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                            AppWl.WL07Priority = "N"
                            AppWl.WL08CompCode = AppWl.WL08CompCode
                            AppWl.WL09SysUserID = AppWl.WL09SysUserID
                            AppWl.WL13Status = "O"
                            AppWl.WL14NextProcessCode = AppProcess.ProcCancelConfirm.ToString.ToUpper
                            AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                            AppWl.WL16RefStationID = ""
                            AppWl.WL17RefTask = ""
                            AppWl.WL18RefOther = "R"
                            AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                            '  AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                            AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.Predefined
                            AppWl.WL99Owners = GetTable(cn, cmd, "SELECT EMP_NO FROM APP_PROCESS_OWNER  WHERE PROCESS_ID='" & AppWl.WL14NextProcessCode & "' UNION SELECT DEPT_HEAD FROM ARS_REQUEST_HDR WHERE DOC_NO='" & requestId & "' AND DEPT_HEAD <> ''  ")
                            AppWl.WL99PageLink = "../Pages/CancelConfirm.aspx"
                            AppWl.WL99ModuleID = "R"
                            AppWl.WL99ApprLevel = "0"
                            InsertWorklist(cn, cmd, AppWl)

                            Q = ""
                            Q = Q & " update app_worklist set status='C' where ref_id= '" & requestId & "'   AND WL_ID = (SELECT TOP 1  O.WL_ID FROM APP_WORKOWNER O, APP_WORKLIST W WHERE O.WL_ID=W.WL_ID AND W.REF_ID= '" & requestId & "' AND   O.OWNER='" & Session("emp_no").ToString & "' AND  NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "' ORDER BY WL_DATE DESC  )   "
                            cmd.CommandText = Q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(Q)

                            Q = ""
                            Q = Q & " update ars_request_hdr set status='O' where doc_no= '" & requestId & "'   "
                            cmd.CommandText = Q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(Q)
                        End If

                    End Using



                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()
                    btnUpdateStatus.Enabled = True
                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            CloseModal(Me.Page, "myModal")
            GetPageData(0, 0)
        End If
    End Sub

    Protected Sub ChAll_CheckedChanged(sender As Object, e As EventArgs)
        GetPageData(0, 0)
    End Sub
End Class

Contents of ucPrivacyPolicy.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucPrivacyPolicy.ascx.vb" Inherits="EnjazVB.ucPrivacyPolicy" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <ContentTemplate>
            <div style="direction:rtl !important;"  class="col-sm-12">
        <div  class="form-group" >
            <div class="col-sm-12">
                <h2>
          مقدمة
        </h2>
                <p>
                  تلتزم إنجاز الأملاك العقارية باحترام خصوصيتك وحماية معلوماتك الشخصية
                </p>
                <ul>
                    <li>الالتزام التام بالشفافية ازاء البيانات التي نقوم بجمعها.</li>
                    <li> استخدام البيانات  لتقديم الخدمة المطلوبة فقط. </li>
                    <li>حماية البيانات الخاصة بك.</li>
                </ul>
                </div>
            </div>
          <div  class="form-group" >
            <div class="col-sm-12">
                <h2>
          المعلومات التي يتم جمعها
        </h2>
                  <p>
                 نقوم بجمع البيانات الاساسية والشخصية التي  تزودنا بها  , لتقديم الخدمة المطلوبة 
                      مثل الاسم والعمر وجهة العمل وبيانات الاتصال
                </p>
                </div>
              </div>
                 <div  class="form-group" >
            <div class="col-sm-12">
                <h2>
         كيفيةاستخدام المعلومات ؟
        </h2>
                  <p>
يتم استخدام المعلومات لغرض تقديم الخدمة المطلوبة فقط وذلك  بالتنسق مع جهة التمويل. 
                </p>
                </div>
              </div>

       <div  class="form-group" >
            <div class="col-sm-12">
                <h2>
         هل يتم جمع بيانات شخصية حساسة؟
        </h2>
                  <p>
لانقوم بجمع اي بيانات شخصية حساسة علي الاطلاق , فقط بيانات اساسية.
                </p>
                </div>
              </div>
              <div  class="form-group" >
            <div class="col-sm-12">
                <h2>
         فترة الاحتفاظ بالمعلومات الشخصية
        </h2>
                  <p>
سنحتفظ بمعلوماتك الشخصية طالما ما زلنا بحاجة لها من أجل تقديم الخدمة المطلوبة                

                  </p>
                </div>
              </div>
        <div  class="form-group" >
            <div class="col-sm-12">
                <h2>
        مشاركة المعلومات مع طرف ثالث
        </h2>
                  <p>
                      تتم مشاركة المعلومات مع جهة التمويل فقط , غير ذلك لا تتم مشاركة المعلومات مع اي جهة اخرى.
                  </p>
                </div>
              </div>

         <div  class="form-group" >
            <div class="col-sm-12">
                <h2>
       للاتصال والتواصل معنا
        </h2>
                  <ul class="list-inline">
              <li>
                <p>العنوان : الرياض</p>
              </li>
             <li>
                  <p>المونسية - شارع النجاح</p>
              </li>
              <li>
                 <p>جوال : 0530222283 </p>
              </li>
              <li>
                <p>بريد الكتروني : EnjazAlamlak.C@gmail.com </p>
              </li>
            </ul>
                </div>
              </div>
      </div>
       </ContentTemplate>
    </asp:UpdatePanel>

Contents of ucPrivacyPolicy.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucPrivacyPolicy

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel
End Class

Contents of ucPrivacyPolicy.ascx.vb:

Public Class ucPrivacyPolicy
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

End Class

Contents of ucProcessingPage.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucProcessingPage.ascx.vb" Inherits="EnjazVB.ucProcessingPage" %>
<%@ Register Src="~/Controls/ucCustomerInfo.ascx" TagPrefix="uc1" TagName="ucCustomerInfo" %>
<%@ Register Src="~/Controls/ucApprovals.ascx" TagPrefix="uc1" TagName="ucApprovals" %>
<%@ Register Src="~/Controls/ucAttachment.ascx" TagPrefix="uc1" TagName="ucAttachment" %>
<%@ Register Src="~/Controls/ucOfferDtl.ascx" TagPrefix="uc1" TagName="ucOfferDtl" %>
<style>

    .tablink {
  background-color: #555;
  color: white;
  float: right;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 16px;
  font-size: 17px;
  width: 25%;
}

.tablink:hover {
  background-color: #777;
}

/* Style the tab content (and add height:100% for full page content) */
.tabcontent {
  color: white;
 /* display:none;*/
  padding: 100px 20px;
  height: 100%;
}

</style>


<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <%-- <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>--%>
    <ContentTemplate>
        <fieldset>
            <legend class="noLegend"></legend>
            <div class="panel panel-primary">
                <div class="panel-heading text-center">
                    <h2 id="H2" class="panel-title" runat="server"><asp:Localize ID="loc_Details" runat="server" Text=""></asp:Localize></h2>
                    <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i>
                    </span>
                </div>
                <div class="panel-body">
                  
                    <div class="container-fluid">
                        <div class="form-horizontal">
                                <uc1:ucCustomerInfo runat="server" id="ucCustomerInfo" />
                            <hr />

  <div class="form-group">
  <uc1:ucOfferDtl runat="server" id="ucOfferDtl" />
</div>
                                                <div runat="server" id="InstallDiv" class="form-group">

                                                      <div class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                  المتابعة واكمال المستندات 
                                </div>
                                <div class="panel-body">




                                    <div class="form-group">
                                         <div class="col-sm-3">
        <asp:Label ID="Label1" runat="server" Text="الحسبة علي اي بنك" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlInvestmentAgency" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>
                                        
                                          <%--  <div class="col-sm-3">
                                                  <asp:Label ID="Label2" runat="server" Text="مبلغ الحسبة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtInvestmentIntialAmt" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>--%>
                                        <div class="col-sm-3">
                                             <div class="form-group">
                                                           <div class="col-sm-6">
                                                  <asp:Label ID="Label14" runat="server" Text="موظف البنك" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtInitBankEmp"    CssClass="form-control" runat="server" ></asp:TextBox>
                                               </div>
                                                  <div class="col-sm-6">
                                                  <asp:Label ID="Label9" runat="server" Text="المدة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtInitLong" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                              </div>
                                                 </div>
                                                               </div>


                                               <div class="col-sm-3">
                                                 
                                                <span>
                                                    <div class="form-group">
                                                           <div class="col-sm-6">
                                                                <asp:Label ID="Label8" runat="server" Text="التمويل العقاري" Font-Bold="True" ></asp:Label>
                                                   <asp:TextBox ID="txtInitReal" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                 </div>
                                                          <div class="col-sm-6">
                                                                                                                              <asp:Label ID="Label11" runat="server" Text="التمويل الشخصي" Font-Bold="True" ></asp:Label>
                                                    <asp:TextBox ID="txtInitPersonal" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                           </div>
                                                              </div>
                                                        </span>
                                                   </div>

      <div class="col-sm-3">
                                                 
   <span>
       <div class="form-group">
            <div class="col-sm-6">
                 <asp:Label ID="Label10" runat="server" Text="القسط" Font-Bold="True" ></asp:Label>
       <asp:TextBox ID="txtInitInstall" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox> 
  </div>
              <div class="col-sm-6">
                   <asp:Label ID="Label12" runat="server" Text="قسط الدعم" Font-Bold="True" ></asp:Label>
                <asp:TextBox ID="txtInitSuppInstall" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
</div>
</div>
  </span>
          </div>
         












                                
                                    
                           
                                
                                </div>

                                   
                                    
                                    
                                    
                                    <div class="form-group">
                                         <div class="col-sm-3">
                                              <asp:Label ID="Label15" runat="server" Text="الخدمة المطلوبة" Font-Bold="True" ></asp:Label>
                                       <asp:DropDownList ID="ddlService" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                             </div>

                                                <div class="col-sm-3">
                                                    <div class="form-group">
                                                         <div class="col-sm-6">
                                                <asp:Label ID="Label16" runat="server" Text="نوع العقار" Font-Bold="True" ></asp:Label>
                                                 <asp:DropDownList ID="ddlRealEstate" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                                </div>

                                                         <div class="col-sm-6">
                                                                <asp:Label ID="lblRealEstatValue" runat="server" Text="قيمة العقار الاصلي" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtRealValue" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                               </div>
                                               
                                                        </div>
                                               
                                                    </div>

                                           <div class="col-sm-1">
                                                  <asp:Label ID="Label3" runat="server" Text="يوجد متضامن" Font-Bold="True" ></asp:Label>
                                               <div class="col-sm-12">
<%-- <span><asp:CheckBoxList runat="server" ID ="chlist" RepeatDirection="Horizontal">
     <asp:ListItem Value="Y" Text="نعم" onclick="MutExChkList(this);"></asp:ListItem>
      <asp:ListItem Value="N" Text="لا" onclick="MutExChkList(this);"></asp:ListItem>
       </asp:CheckBoxList></span>--%>
                                           <span><asp:CheckBox  ID="ChYes" runat="server"    Text="نعم" onclick="MutExChkList(this);" /></span>
                                               <span><asp:CheckBox  ID="CheNo" runat="server"  Text="لا" onclick="MutExChkList(this);" /></span>
                                              </div>
                                               </div>

                                              <div class="col-sm-2">
                                                  <asp:Label ID="Label28" runat="server" Text="هوية العميل" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtCustomId"    CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                        <div class="col-sm-3">
                                            <div class="form-group">
                                                 <div class="col-sm-6">
                                                 <asp:Label ID="Label29" runat="server" Text="المشرف" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtSup"   ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>
                                           </div>
                                                <div class="col-sm-6">
                                                     <asp:Label ID="Label7" runat="server" Text="الموظف المتابع للطلب" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtEmployee"   ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>
                                           </div>
                                                    </div>    
                                        </div>
                                        
                                        </div>


  <div class="form-group">
                                         <div class="col-sm-3">
                                              <asp:Label ID="Label23" runat="server" Text="جوال المالك" Font-Bold="True" ></asp:Label>
                                        <asp:TextBox ID="txtCusPhone" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                             </div>

      <div class="col-sm-3">
                                              <asp:Label ID="Label24" runat="server" Text="مدينة العقار" Font-Bold="True" ></asp:Label>
                                       <asp:DropDownList ID="ddlCity" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                             </div>

      <div class="col-sm-3">
                                              <asp:Label ID="Label25" runat="server" Text="معرفة العميل بالشركة" Font-Bold="True" ></asp:Label>
                                       <asp:DropDownList ID="ddlWayOfKnow" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                             </div>

      </div>

                                    
                                     <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label26" runat="server" Text="شرح حالة العميل" Font-Bold="True" ></asp:Label>                 <span>
                                       <asp:LinkButton ID="BtnSaveInitRemarks" runat="server"  CssClass="btn btn-primary btn-md"  OnClick="BtnSaveInitRemarks_Click"
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;حفظ
                                                        " ></asp:LinkButton>
                                                  </span>
                                   <asp:TextBox ID="txtCustom_status" CssClass="form-control" runat="server" TextMode="MultiLine" ></asp:TextBox>
                                </div>
                                        </div>

                                    
                                      <div id="divDocUploadRemarks" visible="false" runat="server" class="form-group">
                                           <div class="col-sm-10">
                                                   <asp:Label ID="Label21" runat="server" Text="تحديث الحالة - اكمال المستندات (حقل اختياري)" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtDocUploadRemarks"    CssClass="form-control" runat="server" ></asp:TextBox>
                                               </div>
                                          <div class="col-sm-2">
                                              <asp:Label ID="Label22" runat="server" Text="." Font-Bold="True" ></asp:Label>
                                                <asp:LinkButton ID="btnDocUploadRemarks" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnDocUploadRemarks_Click"
                                       OnClientClick="if (confirm('هل تريد تحديث الحالة ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تحديث  حالة  الطلب
                                                        " ></asp:LinkButton>
                                              </div>
                                          </div>
                                   




                      <%--              <div class="form-group">--%>




                                                  <div runat="server" id="div1" class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                    <h3 id="H3" class="panel-title" runat="server"><asp:Localize ID="Localize1" runat="server" Text="الموظف مسؤول عن صحة ادخال البيانات"></asp:Localize></h3>
                                </div>
                                <div class="panel-body">
                                            <div class="form-group">
            <div class="col-sm-4">
                                        
                                            <span>
                                       <asp:LinkButton ID="btnInitEdit" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnInitEdit_Click" 
                                        Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-edit&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تعديل
                                                        " ></asp:LinkButton>
                                                </span>
                                              <span>
                                       <asp:LinkButton ID="btnInitSave" runat="server"  CssClass="btn btn-primary btn-md" Visible="false" OnClick="btnInitSave_Click"  
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;حفظ
                                                        " ></asp:LinkButton>
                                                  </span>

                                                                                   <span>
           <asp:LinkButton ID="btnInitCancel" runat="server"  CssClass="btn btn-primary btn-md"  Visible="false" OnClick="btnInitCancel_Click"
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; إلغاء
                                                        " ></asp:LinkButton>
                                                  </span>

                                      
               
                
            
            
            
            
            
            </div>
                                                </div>
                                    </div>
        </div>
                                                      </div>











                                       <%-- </div>--%>
          

                            
                                    
                                </div>
                            </div>
</div>
                                                 
                                                    <div runat="server" id="divEval" class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                 اجراءات التقييم 
                                </div>
                                <div class="panel-body">
  <div class="form-group">
       <div class="col-sm-3">
                                                  <asp:Label ID="Label4" runat="server" Text="مبلغ التقييم" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtEvalutionAmt" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
       </div>

                                          <div class="col-sm-3">
        <asp:Label ID="Label13" runat="server" Text="جهة التمويل" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlFinanceEntity" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>

      <div class="col-sm-3">
           <asp:Label ID="Label30" runat="server" Text="سير المعاملة" Font-Bold="True" ></asp:Label>
           <asp:DropDownList ID="ddlProcType" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
      </div>
        <div runat="server" visible="false" class="col-sm-3">
                                                  <asp:Label ID="Label2" runat="server" Text="موظف البنك" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtEvalBankEmp"    CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>



                                        </div>

                                      <div class="form-group">
                                                                             <div class="col-sm-3">
                                 
                                                  <asp:Label ID="Label32" runat="server" Text="يوجد التزامات " Font-Bold="True" ></asp:Label>
                                              
                                              <asp:DropDownList ID="ddlInstall" AutoPostBack="true" OnSelectedIndexChanged="ddlInstall_SelectedIndexChanged" runat="server" CssClass="form-control input-sm" Width="100%">
                                                  <asp:ListItem Text="لا يوجد" Value="N"></asp:ListItem>
                                                  <asp:ListItem Text="يوجد" Value="Y"></asp:ListItem>
                                              </asp:DropDownList>
  <%--                                            <br />
  <asp:CheckBox  ID="ChInstallYes" runat="server"    Text="نعم" AutoPostBack="true" OnCheckedChanged="ChInstallYes_CheckedChanged"  onclick="MutExChkList(this);" />
 <span><asp:CheckBox  ID="ChInstallNo" runat="server" AutoPostBack="true"  OnCheckedChanged="ChInstallNo_CheckedChanged"   Text="لا" onclick="MutExChkList(this);" /></span>
             --%>                                 

                                               </div>

                                          <div runat="server" id="divCompPay" visible="false" class="col-sm-3">
                                  <asp:Label ID="Label34" runat="server" Text="جهة السداد " Font-Bold="True" ></asp:Label>
                                            <asp:DropDownList ID="ddlCompPay" runat="server" CssClass="form-control input-sm" Width="100%">
                                                <asp:ListItem Text="-اختر طريقة السداد-" Value=""></asp:ListItem>
                                                <asp:ListItem Text="سداد عن طريق الشركة" Value="C"></asp:ListItem>
                                                <asp:ListItem Text="سداد من خارج الشركة" Value="O"></asp:ListItem>
                                            </asp:DropDownList>
                                              </div>
                                          <div class="col-sm-1">
                             <asp:Label ID="Label41" runat="server" Text=".  ." Font-Bold="True" ></asp:Label>
      <asp:LinkButton ID="btnSaveEval" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnSaveEval_Click"
Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;حفظ التقييم
                                                        " ></asp:LinkButton>

                                          </div>

                                         

                                          </div>

    <div runat="server" visible="false"  id="divInstallments" class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                    <h3 id="H4" class="panel-title" runat="server"><asp:Localize ID="Localize2" runat="server" Text="">بيانات الالتزامات المالية</asp:Localize></h3>
                                </div>
                                <div class="panel-body">
                                         


                          
                                      <div class="form-group">
                                          <div class="col-sm-12">
                                            
                                                 <div class="form-group">
    <div class="col-sm-3">
        <asp:Label ID="Label31" runat="server" Text="سداد مبكر" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtInstallAmt" TextMode="Number"    CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
 
   
 <div class="col-sm-3">
      <asp:Label ID="Label38" runat="server" Text="نوع القرض" Font-Bold="True" ></asp:Label>
     <asp:TextBox ID="txtInstallType"    CssClass="form-control" runat="server" ></asp:TextBox>
    </div>

   <div class="col-sm-3">
       <asp:Label ID="Label39" runat="server" Text="جهة القرض" Font-Bold="True" ></asp:Label>
      <asp:TextBox ID="txtInstallmentFinanceEntity"    CssClass="form-control" runat="server" ></asp:TextBox>
   </div>

  <div class="col-sm-3">
        <asp:Label ID="Label33" runat="server" Text="حالة القرض" Font-Bold="True" ></asp:Label>
         <div class="input-group">
 <asp:DropDownList ID="ddlInstallStatus" runat="server" CssClass="form-control input-sm" Width="100%">
</asp:DropDownList>
    <span class="input-group-addon" id="basic-addon2">
                        <asp:LinkButton ID="btnAddInstall"  ToolTip="اضافة القسط" OnClick="btnAddInstall_Click"
                            runat="server" CausesValidation="False" >
                        <i aria-hidden="true" class="glyphicon glyphicon-plus-sign"></i>
                        </asp:LinkButton>

         <asp:LinkButton ID="btnUpdateInstall"  ToolTip="تعديل القسط" Visible="false" OnClick="btnUpdateInstall_Click" 
                            runat="server" CausesValidation="False" >
                        <i aria-hidden="true" class="glyphicon glyphicon-edit"></i>

                        </asp:LinkButton>
                  </span>
         
         </div>
         </div>

   

            </div>

                                                
                                         <div class="form-group">
                                              <div style="height:150px;overflow:auto">
                                                        <asp:GridView ID="grdInstall" runat="server" CssClass="table table-hover table-striped" AutoGenerateColumns="False" 
                        CellPadding="4" ForeColor="#333333" EmptyDataText="لا يوجد سجلات" GridLines="None" Width="100%" ShowFooter="True" >
                        <AlternatingRowStyle BackColor="White" />

                        <Columns>
                          
                             <asp:BoundField DataField="SR_NO" Visible="false" HeaderText="تسلسل" >
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:BoundField>

                            <asp:BoundField DataField="installAmt" DataFormatString="{0:d}" HeaderText="المبلغ" meta:resourcekey="BoundFieldResource1">
                                <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" />
                            </asp:BoundField>

                             <asp:BoundField DataField="INSTALL_TYPE" HeaderText="نوع القرض" >
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:BoundField>

          <asp:BoundField DataField="InstallmentEntity" HeaderText="الجهة" >
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:BoundField>

                             <asp:BoundField DataField="INSTALL_STATUS" HeaderText="حالة القرض" >
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:BoundField>

                              <asp:BoundField DataField="STATUS_CODE" Visible="false" HeaderText="حالة القرض" >
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:BoundField>

                             <asp:TemplateField HeaderText="تعديل">
                                <ItemTemplate>
                                    <asp:LinkButton ID="lnKEdit" Enabled= '<%# If(EnableBt = True, True, False) %>'  runat="server" OnCommand="lnKEdit_Command" CommandArgument='<%#String.Concat(Eval("SR_NO"))%>' ToolTip="تعديل"  Text="
                                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-edit&quot;&gt;&lt;/i&gt;
                                "></asp:LinkButton>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" CssClass="gridBtn" />
                            </asp:TemplateField>

 <asp:TemplateField HeaderText="إزالة">
                                <ItemTemplate>
                                    <asp:LinkButton ID="lnkDel" Enabled= '<%# If(EnableBt = True, True, False) %>'  runat="server" OnCommand="imgInstallDel_Command" CommandArgument='<%#String.Concat(Eval("SR_NO"))%>' ToolTip="Delete" meta:resourcekey="lnkDel" Text="
                                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-trash&quot;&gt;&lt;/i&gt;
                                "></asp:LinkButton>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" CssClass="gridBtn" />
                            </asp:TemplateField>
                        </Columns>

                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                        <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                                         </div>
                                             </div>
                                      </div>
                                      </div>


                                    </div>
        </div>  
</div>



                                      <div id="divEvalRemarks" visible="false" runat="server" class="form-group">
                                           <div class="col-sm-10">
                                                   <asp:Label ID="Label17" runat="server" Text="ملاحظة التقييم (حقل اختياري)" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtEvalRemarks"    CssClass="form-control" runat="server" ></asp:TextBox>
                                               
                                               </div>
                                          <div class="col-sm-2">
                                              <asp:Label ID="Label20" runat="server" Text="." Font-Bold="True" ></asp:Label>
                                                <asp:LinkButton ID="btnSaveEvalRemarks" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnSaveEvalRemarks_Click" 
                                       OnClientClick="if (confirm('هل تريد اضافة الملاحظة ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;اضافة ملاحظة التقييم
                                                        " ></asp:LinkButton>
                                              </div>
                                          </div>
                                   
                                    </div>
        </div>
</div>

<div runat="server" id="divFinalApprove" class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                الموافقة النهائية 
                                </div>
                                <div class="panel-body">
  <div class="form-group">
       <div class="col-sm-3">
                                                  <asp:Label ID="lblPersonal" runat="server" Text="التمويل الشخصي" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtPersonalFin" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
             <div class="col-sm-3">
                                                  <asp:Label ID="lblRealEstate" runat="server" Text="التمويل العقاري" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtRealEstateFin" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
      <div class="col-sm-3">
                                                  <asp:Label ID="lblInstallment" runat="server" Text="القسط" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtInstallment" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
            <div class="col-sm-3">
                                                  <asp:Label ID="lblSupportInst" runat="server" Text="قسط الدعم" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtSupportInst" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                        </div>

                                      <div class="form-group">
                                          <div class="col-sm-3">
                                                  <asp:Label ID="lblLongtime" runat="server" Text="المدة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtLong" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
                                            <div class="col-sm-3">
                                                  <asp:Label ID="lblTax" runat="server" Text="الضريبة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtTax" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                            <div class="col-sm-3">
                                                  <asp:Label ID="lblPatch" runat="server" Text="الدفعة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtPatch" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                           <div class="col-sm-3">
                                                  <asp:Label ID="Label5" runat="server" Text="قيمة الشيك" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtChequAmt" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
                                         

 </div>

                                    <div class="form-group">
                                     <div class="col-sm-3">
                                                  <asp:Label ID="lblcommition" runat="server" Text="سعي من العميل" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtCustomerCommition" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                           <div class="col-sm-3">
                                                  <asp:Label ID="Label6" runat="server" Text="سعي من البنك" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtBankCommition" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

       

                                          <div runat="server" visible="false" class="col-sm-3">
                                              <div id="divFinalApproveRemarks" runat="server" class="form-group">
                                                   <div class="col-sm-9">
                                                   <asp:Label ID="Label18" runat="server" Text="تحديث الحالة - الموافقة النهائية (حقل اختياري)" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtFinalApprovalRemarks"    CssClass="form-control" runat="server" ></asp:TextBox>
                                               
                                               </div>
                                          <div class="col-sm-3">
                                               <asp:Label ID="Label19" runat="server" Text="." Font-Bold="True" ></asp:Label>
                                                <asp:LinkButton ID="btnAddApprovalRemarks" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnAddApprovalRemarks_Click" 
                                       OnClientClick="if (confirm('هل تريد تحديث حالة الطلب ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;تحديث حالة الطلب 
                                                        " ></asp:LinkButton>
                                              </div>
                                              </div>
                                              </div>

                                        </div>




                                       <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label27" runat="server" Text="ملاحظة او شرح" Font-Bold="True" ></asp:Label>
                                   <asp:TextBox ID="txtFinalStatus" CssClass="form-control" runat="server" TextMode="MultiLine" ></asp:TextBox>
                                </div>
                                        </div>

                                      <div class="form-group">
                                        <div class="col-sm-4">
                                            <span>
                                       <asp:LinkButton ID="btFinalEdit" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btFinalEdit_Click" 
                                        Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-edit&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تعديل
                                                        " ></asp:LinkButton>
                                                </span>
                                              <span>
                                       <asp:LinkButton ID="btFinalSave" runat="server"  CssClass="btn btn-primary btn-md" Visible="false" OnClick="btFinalSave_Click" 
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;حفظ
                                                        " ></asp:LinkButton>
                                                  </span>
                                                                                                                                                 <span>
           <asp:LinkButton ID="btFinalCancel" runat="server"  CssClass="btn btn-primary btn-md"  Visible="false" OnClick="btFinalCancel_Click"
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; إلغاء
                                                        " ></asp:LinkButton>
                                                  </span>
                                       </div>
                                        </div>


                                    </div>
        </div>
</div>

               


<%-- <div style="direction:rtl">
  <button class="tablink" onclick="openPage('Home', this, 'red')">الموافقات</button>
<button class="tablink"  onclick="openPage('News', this, 'green')" id="defaultOpen">المرفقات</button>


<div id="Home" class="tabcontent">
  <div class="form-group">
   <uc1:ucApprovals runat="server" id="ucApprovals" />
 </div>
</div>

<div id="News" class="tabcontent">
  <h3>News</h3>
  <p>Some news this fine day!</p> 
</div>
                                                    </div>--%>


                                                                            <div id="divInfoTabs" runat="server" class="form-group">
                            <div class="col-sm-12">
                                <ul class="nav nav-tabs">

                                           <li class="active"><a data-toggle="tab" href="#Attachment"><asp:Localize ID="lblApprovals" runat="server" Text="المرفقات" ></asp:Localize></a></li>
                                    <li><a data-toggle="tab" href="#Approvals"><asp:Localize ID="lblClearance" runat="server" Text="الموافقات" ></asp:Localize></a></li>


                                       </ul>
                                <div class="well tab-content">
                                    <div id="Attachment" class="tab-pane fade in active">
                                         <div style="height:350px;overflow:auto">
                                        <uc1:ucAttachment runat="server" id="ucAttachment" />
                                             </div>
                                    </div>
                                    <div id="Approvals" class="tab-pane fade">
                                         <div style="height:350px;overflow:auto">
                                       <uc1:ucApprovals runat="server" id="ucApprovals" />
                                             </div>
                                    </div>
                                    </div>
                                </div>
                                                                                </div>

       



                    <%--        <div class="form-group">
                                  <div style="height:350px;overflow:auto">
                                 <uc1:ucApprovals runat="server" id="ucApprovals" />
                                      </div>
                                </div>
                                                    <div class="form-group">
                                <div style="height:350px;overflow:auto">
                                     <uc1:ucAttachment runat="server" id="ucAttachment" />--%>
<%--                                                 <asp:gridview id="grdAttachment" 
  CssClass="table table-hover table-striped" runat="server" AllowPaging="True" AllowCustomPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
    <Columns>
        <asp:BoundField DataField="sr_no" HeaderText="تسلسل"  />
        <asp:BoundField DataField="att_desc" HeaderText="المرفق"  />
      
        <asp:BoundField DataField="emp_name" HeaderText="ارفق بواسطة" />
                <asp:BoundField DataField="attach_date" HeaderText="التاريخ" />
         <asp:BoundField DataField="FILENAME" Visible="false" HeaderText="FILENAME" />
        
          <asp:TemplateField >
                                     <ItemTemplate>
                                             
                                              <asp:LinkButton ID="btnStep" runat="server" OnCommand="btnStep_Command"
                                                     Text='<%# Bind("action") %>'
                                                    ToolTip="اضغط للارفاق" CommandName="Step" CommandArgument='<%# string.Concat(Eval("doc_type"), ",", Eval("ref_id"), ",", Eval("att_desc"), ",", Eval("action2"), ",", Eval("FILENAME"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

   </Columns>
                                             <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages" BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
</asp:gridview>--%>
                                 
                                    </div>
</div>





                                            <div runat="server" visible="false" id="divCancel" class="form-group">
  <div class="col-sm-3">
        <asp:Label ID="Label40" runat="server" Text="سبب الإلغاء" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlCancelReason" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>
                                                </div>

                        <div runat="server" visible="false" id="divHold" class="form-group">
  <div class="col-sm-3">
        <asp:Label ID="Label36" runat="server" Text="سبب التأجيل" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlReason" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>

      <div class="col-sm-3">
           <asp:Label ID="Label37" runat="server" Text="مدة التأجيل" Font-Bold="True" ></asp:Label>
           <asp:DropDownList ID="ddlTime" runat="server" CssClass="form-control input-sm" Width="100%">
             <%-- <asp:ListItem Value="" Text="-فضلا اخترالمدة-"></asp:ListItem>
               <asp:ListItem Value="7" Text="اسبوع"></asp:ListItem>
               <asp:ListItem Value="15" Text="اسبوعين"></asp:ListItem>
               <asp:ListItem Value="21" Text="ثلاثة اسابيع"></asp:ListItem>
               <asp:ListItem Value="30" Text="شهر "></asp:ListItem>--%>
           </asp:DropDownList>
      </div>

      </div>



                                     <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="LabelRemarks" runat="server" Text="ملاحظة او تعليق" Font-Bold="True" ></asp:Label>
                                          
                                    
                                    <asp:TextBox ID="txtProcRemarks" CssClass="form-control" runat="server" TextMode="MultiLine" ></asp:TextBox>
                                </div>
                                        </div>

                        <br />
                        <hr />
                        <br />
                        



                                           <div runat="server" id="divProcButtons" class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                    <h3 id="H1" class="panel-title" runat="server"><asp:Localize ID="locProcButtons" runat="server" Text=""></asp:Localize></h3>
                                </div>
                                <div class="panel-body">
           <div id="DivPay" visible="false" runat="server" class="form-group">
            <div class="col-sm-12">
                  <div class="col-sm-6">
                       <div class="col-sm-3">
                                                  <asp:Label ID="Label35" runat="server" Text="المرور بمرحلة السداد" Font-Bold="True" ></asp:Label>
                                             </div> 
                           <div class="col-sm-9">

                                           <span><asp:CheckBox  ID="chkPayYes" runat="server"    Text="نعم" AutoPostBack="true" OnCheckedChanged="chkPayYes_CheckedChanged"  /></span>
                                               <span><asp:CheckBox  ID="chkPayNO" runat="server"  Text="لا" AutoPostBack="true" OnCheckedChanged="chkPayNO_CheckedChanged"  /></span>
                                              </div>
                                               </div>
                </div>
             </div>

                                    <div id="DivCollect" visible="false" runat="server" class="form-group">
            <div class="col-sm-12">
                  <div class="col-sm-6">
                       <div class="col-sm-3">
                                                  <asp:Label ID="Label42" runat="server" Text="المرور بمرحلة التحصيل" Font-Bold="True" ></asp:Label>
                                             </div> 
                           <div class="col-sm-9">

                                           <span><asp:CheckBox  ID="ChbCollectYes" runat="server"    Text="نعم" AutoPostBack="true" OnCheckedChanged="ChbCollectYes_CheckedChanged"   /></span>
                                               <span><asp:CheckBox  ID="ChbCollectNO" runat="server"  Text="لا" AutoPostBack="true" OnCheckedChanged="ChbCollectNO_CheckedChanged"  /></span>
                                              </div>
                                               </div>
                </div>
             </div>

                                            <div class="form-group">
            <div class="col-sm-8">
               
                                  <asp:LinkButton ID="btnSave" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnSave_Click"
                                       OnClientClick="if (confirm('هل تريد الموافقة بالفعل ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                        " ></asp:LinkButton>
                     
                  
                                  <asp:LinkButton ID="btnCancel" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnCancel_Click"
                                                                             OnClientClick="if (confirm('هل تريد إلغاء الطلب بالفعل ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; الغاء
                                                        " ></asp:LinkButton>
                    
              
                  <asp:LinkButton ID="btReturn" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btReturn_Click" 
                       OnClientClick="if (confirm('هل تريد ارجاع الطلب بالفعل ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-share-alt&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ارجاع
                                                        " ></asp:LinkButton>
               
                     <asp:LinkButton ID="btSetPending" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btSetPending_Click"
                          OnClientClick="if (confirm('هل تريد تأجيل الطلب بالفعل ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-pause&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; تأجيل
                                                        " ></asp:LinkButton>

                 <asp:LinkButton ID="btnStumbled" Visible="false" OnClick="btnStumbled_Click" runat="server"  CssClass="btn btn-primary btn-md" 
                          OnClientClick="if (confirm('هل تريد تغيير حالة الطلب بالفعل ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-warning-sign&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; متعثر
                                                        " ></asp:LinkButton>
            
                 </div>
                                                </div>
                                    </div>
        </div>  
</div>








                        </div>
                   
                            
                        
                        
                        </div>
                </div>
           </fieldset>
        </ContentTemplate>
    </asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>



<script type = "text/javascript">
    function MutExChkList(chk)
    {
        var chkList = chk.parentNode.parentNode.parentNode;
        var chks = chkList.getElementsByTagName("input");
        for(var i=0;i<chks.length;i++)
        {
            if(chks[i] != chk && chk.checked)
            {
                chks[i].checked=false;
            }
        }
    }
</script>

<%--<script>
function openPage(pageName,elmnt,color) {
  var i, tabcontent, tablinks;
  tabcontent = document.getElementsByClassName("tabcontent");
  for (i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }
  tablinks = document.getElementsByClassName("tablink");
  for (i = 0; i < tablinks.length; i++) {
    tablinks[i].style.backgroundColor = "";
  }
  document.getElementById(pageName).style.display = "block";
  elmnt.style.backgroundColor = color;
}

// Get the element with id="defaultOpen" and click on it
document.getElementById("defaultOpen").click();
</script>--%>

Contents of ucProcessingPage.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucProcessingPage

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''H2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H2 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''loc_Details control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents loc_Details As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucCustomerInfo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucCustomerInfo As Global.EnjazVB.ucCustomerInfo

    '''<summary>
    '''ucOfferDtl control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucOfferDtl As Global.EnjazVB.ucOfferDtl

    '''<summary>
    '''InstallDiv control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents InstallDiv As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlInvestmentAgency control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlInvestmentAgency As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label14 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label14 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitBankEmp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitBankEmp As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label9 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label9 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitLong control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitLong As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label8 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label8 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitReal control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitReal As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label11 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label11 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitPersonal control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitPersonal As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label10 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label10 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitInstall As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label12 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label12 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitSuppInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitSuppInstall As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label15 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label15 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlService control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlService As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label16 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label16 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlRealEstate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlRealEstate As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''lblRealEstatValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblRealEstatValue As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRealValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ChYes control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ChYes As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''CheNo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents CheNo As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''Label28 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label28 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCustomId control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCustomId As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label29 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label29 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtSup control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtSup As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtEmployee control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtEmployee As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label23 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label23 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCusPhone control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCusPhone As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label24 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label24 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCity control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCity As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label25 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label25 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlWayOfKnow control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlWayOfKnow As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label26 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label26 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''BtnSaveInitRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents BtnSaveInitRemarks As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''txtCustom_status control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCustom_status As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divDocUploadRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divDocUploadRemarks As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label21 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label21 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtDocUploadRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDocUploadRemarks As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label22 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label22 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnDocUploadRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnDocUploadRemarks As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''div1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents div1 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''H3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H3 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize1 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''btnInitEdit control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnInitEdit As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnInitSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnInitSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnInitCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnInitCancel As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''divEval control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divEval As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtEvalutionAmt control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtEvalutionAmt As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label13 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label13 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlFinanceEntity control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlFinanceEntity As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label30 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label30 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlProcType control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlProcType As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtEvalBankEmp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtEvalBankEmp As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label32 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label32 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlInstall As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divCompPay control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCompPay As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label34 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label34 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCompPay control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCompPay As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label41 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label41 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnSaveEval control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSaveEval As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''divInstallments control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divInstallments As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''H4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize2 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''Label31 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label31 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInstallAmt control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInstallAmt As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label38 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label38 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInstallType control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInstallType As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label39 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label39 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInstallmentFinanceEntity control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInstallmentFinanceEntity As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label33 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label33 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlInstallStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlInstallStatus As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''btnAddInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnAddInstall As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnUpdateInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnUpdateInstall As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''grdInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdInstall As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''divEvalRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divEvalRemarks As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label17 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label17 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtEvalRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtEvalRemarks As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label20 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label20 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnSaveEvalRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSaveEvalRemarks As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''divFinalApprove control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divFinalApprove As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lblPersonal control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblPersonal As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtPersonalFin control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPersonalFin As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblRealEstate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblRealEstate As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRealEstateFin control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRealEstateFin As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblInstallment control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblInstallment As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInstallment control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInstallment As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblSupportInst control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblSupportInst As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtSupportInst control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtSupportInst As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblLongtime control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblLongtime As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtLong control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtLong As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblTax control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblTax As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtTax control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtTax As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblPatch control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblPatch As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtPatch control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPatch As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label5 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtChequAmt control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtChequAmt As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblcommition control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblcommition As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCustomerCommition control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCustomerCommition As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label6 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtBankCommition control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtBankCommition As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divFinalApproveRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divFinalApproveRemarks As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label18 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label18 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtFinalApprovalRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtFinalApprovalRemarks As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label19 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label19 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnAddApprovalRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnAddApprovalRemarks As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''Label27 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label27 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtFinalStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtFinalStatus As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btFinalEdit control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btFinalEdit As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btFinalSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btFinalSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btFinalCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btFinalCancel As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''divInfoTabs control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divInfoTabs As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lblApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblApprovals As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''lblClearance control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblClearance As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucAttachment control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucAttachment As Global.EnjazVB.ucAttachment

    '''<summary>
    '''ucApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucApprovals As Global.EnjazVB.ucApprovals

    '''<summary>
    '''divCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCancel As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label40 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label40 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCancelReason control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCancelReason As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divHold control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divHold As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label36 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label36 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlReason control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlReason As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label37 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label37 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlTime control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlTime As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''LabelRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRemarks As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtProcRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtProcRemarks As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divProcButtons control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divProcButtons As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''H1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H1 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''locProcButtons control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents locProcButtons As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''DivPay control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents DivPay As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label35 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label35 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''chkPayYes control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents chkPayYes As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''chkPayNO control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents chkPayNO As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''DivCollect control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents DivCollect As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label42 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label42 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ChbCollectYes control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ChbCollectYes As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''ChbCollectNO control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ChbCollectNO As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnCancel As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btReturn control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btReturn As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btSetPending control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btSetPending As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnStumbled control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnStumbled As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucProcessingPage.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization

Public Class ucProcessingPage
    Inherits System.Web.UI.UserControl
    Dim q As String = ""
    Dim dtInstallment As New DataTable

    Public Property requestId As String
        Get
            Return ViewState("requestId")
        End Get
        Set(value As String)
            ViewState("requestId") = value
        End Set
    End Property

    Public Property ProcessId As String
        Get
            Return ViewState("ProcessId")
        End Get
        Set(value As String)
            ViewState("ProcessId") = value
        End Set
    End Property

    Public Property PROC As String
        Get
            Return ViewState("PROC")
        End Get
        Set(value As String)
            ViewState("PROC") = value
        End Set
    End Property



    Public Property worklistId As String
        Get
            Return ViewState("worklistId")
        End Get
        Set(value As String)
            ViewState("worklistId") = value
        End Set
    End Property

    Public Property EnableBt As Boolean
        Get
            Return Session("EnableBt")
        End Get
        Set(value As Boolean)
            Session("EnableBt") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If
        If Not IsPostBack Then

            ' btnSave.Visible = IIf(clsGenClass.GetFieldValue("select status from app_worklist where wl_id='" & ViewState("p1") & "'").Equals("C"), False, True)

            If Not (Request.QueryString("p1")) Is Nothing Then
                ViewState("p1") = Request.QueryString("p1").ToString
                ViewState("p2") = Request.QueryString("p2").ToString
                worklistId = ViewState("p1").ToString
                ProcessId = Request.QueryString("p2").ToString

                If ProcessId.ToString <> AppProcess.ProcUploadDoc.ToString.ToUpper And
                        ProcessId.ToString <> AppProcess.ProcCreate.ToString.ToUpper And
                        ProcessId.ToString <> AppProcess.ProcCheck.ToString.ToUpper And
                        ProcessId.ToString <> AppProcess.ProcCancelConfirm.ToString.ToUpper And
                         ProcessId.ToString <> AppProcess.ProcUploadReq.ToString.ToUpper And
                        ProcessId.ToString <> AppProcess.ProcAssign.ToString.ToUpper Then
                    btnStumbled.Visible = True
                Else
                    btnStumbled.Visible = False
                End If
                requestId = GetFieldValue("select ref_id from app_worklist where wl_id='" & ViewState("p1").ToString & "'")
                If requestId = "" Then
                    requestId = GetFieldValueCon("select ref_id from app_worklist where wl_id='" & ViewState("p1").ToString & "'", "Enjazcon")
                End If
                FillComboSelect(ddlInvestmentAgency, "SELECT type_category , type_desc FROM type_mst WHERE type_code='BK' ")
                FillComboSelect(ddlFinanceEntity, "SELECT type_category , type_desc FROM type_mst WHERE type_code='BK' ")
                FillComboSelect(ddlProcType, "SELECT type_category , type_desc FROM type_mst WHERE type_code='PT' ")
                FillComboSelect(ddlService, "SELECT type_category , type_desc FROM type_mst WHERE type_code='SR' ")
                FillComboSelect(ddlRealEstate, "SELECT type_category , type_desc FROM type_mst WHERE type_code='RT' ")

                FillComboSelect(ddlCity, "SELECT type_category , type_desc FROM type_mst WHERE type_code='CT' ")
                FillComboSelect(ddlWayOfKnow, "SELECT type_category , type_desc FROM type_mst WHERE type_code='WN' ")
                FillComboSelect(ddlInstallStatus, " SELECT TYPE_CATEGORY , TYPE_DESC FROM TYPE_MST WHERE TYPE_CODE='IS'  ")
                FillComboSelectText(ddlReason, "SELECT type_category , type_desc FROM type_mst WHERE type_code='HD' ", "فضلا اختر السبب")
                FillComboSelectText(ddlCancelReason, "SELECT type_category , type_desc FROM type_mst WHERE type_code='CR' ORDER BY TYPE_ABBR ", "فضلا اختر السبب")

                FillPendingDays(ddlTime)
                ucCustomerInfo.DocNo = requestId
                If ucCustomerInfo.OFFER_ID <> "" Then
                    ucOfferDtl.OfferId = ucCustomerInfo.OFFER_ID
                    ucOfferDtl.Visible = True
                Else
                    ucOfferDtl.Visible = False
                End If
                ucApprovals.DocNo = requestId
                ucAttachment.requestId = requestId
                EnableBt = True
                loadData()
                'loadAttachment()

            End If
        End If
        SetGridStyle(grdInstall)
    End Sub

    Private Sub loadData()
        ''q = ""
        ''q = q & " select h.doc_no,format(h.doc_date,'dd/MM/yyyy')doc_date, h.refcomp_code AS installments ,ISNULL(REF_DOCNO,'O')AS INSTALL_PAY, "
        ''q = q & " h.other4 as bank,h.other5 as investment_amt,h.other6 as readEstateAmt,h.other7 as corporate,e.emp_name ,s.emp_name as sup,p.process_desc,w.next_process_id,w.closed_remarks, "
        ''q = q & " h.other9 as financeEntity, h.other10 as  EvalutionAmt,h.other11 as PersonalFin, h.other12 as RealEstateFin, h.other13 as  Installment,    "
        ''q = q & " h.other14 as SupportInst,h.other15 as Longtime,h.other16 as Tax, h.other17 Patch, h.other18 as chequeAmt,h.other19 as CustomerCommition,h.other20 as BankCommition,  "
        ''q = q & " h.initPersonal,h.initReal,h.initInstall,h.initInSuppInstall,h.initLong,h.initEmpBank,h.EvalEmpBank,h.service_req,h.realEstate_req "
        ''q = q & " ,h.CUSTOM_PHONE,h.CITY,h.WAY,h.CUSTOM_STATUS,h.FINAL_STATUS,h.req_type,H.PAY_TRANCODE  "
        ''q = q & " from ARS_REQUEST_HDR h left join  emp_mst e  on h.emp_no=e.emp_no "
        ''q = q & " left join app_worklist  w  on h.doc_no=w.ref_id  "
        ''q = q & " left join app_processes p on w.next_process_id=p.process_id "
        ''q = q & " left join emp_mst s on h.dept_head=s.emp_no  "
        ''q = q & " where w.wl_id= '" & worklistId & "' "

        q = ""
        q = q & " select h.doc_no,format(h.doc_date,'dd/MM/yyyy')doc_date, h.refcomp_code AS installments ,ISNULL(REF_DOCNO,'O')AS INSTALL_PAY, "
        q = q & " h.other4 as bank,h.other5 as investment_amt,h.other6 as readEstateAmt,h.other7 as corporate,e.emp_name ,s.emp_name as sup, "
        q = q & " h.other9 as financeEntity, h.other10 as  EvalutionAmt,h.other11 as PersonalFin, h.other12 as RealEstateFin, h.other13 as  Installment,    "
        q = q & " h.other14 as SupportInst,h.other15 as Longtime,h.other16 as Tax, h.other17 Patch, h.other18 as chequeAmt,h.other19 as CustomerCommition,h.other20 as BankCommition,  "
        q = q & " h.initPersonal,h.initReal,h.initInstall,h.initInSuppInstall,h.initLong,h.initEmpBank,h.EvalEmpBank,h.service_req,h.realEstate_req "
        q = q & " ,h.CUSTOM_PHONE,h.CITY,h.WAY,h.CUSTOM_STATUS,h.FINAL_STATUS,h.req_type,H.PAY_TRANCODE  "
        q = q & " from ARS_REQUEST_HDR h left join  emp_mst e  on h.emp_no=e.emp_no "
        'q = q & " left join app_worklist  w  on h.doc_no=w.ref_id  "
        'q = q & " left join app_processes p on w.next_process_id=p.process_id "
        q = q & " left join emp_mst s on h.dept_head=s.emp_no  "
        q = q & " where H.DOC_NO= '" & requestId & "' "

        Dim dt = GetTable(q)
        If dt.Rows.Count = 0 Then
            dt = GetTableCon(q, "Enjazcon")
        End If
        If dt.Rows.Count > 0 Then
            q = "SELECT P.PROCESS_DESC,W.NEXT_PROCESS_ID,W.CLOSED_REMARKS"
            q = q & " FROM  app_worklist  w    "
            q = q & " left join app_processes p on w.next_process_id=p.process_id "
            q = q & " where w.wl_id= '" & worklistId & "' "
            Dim dtWL = GetTable(q)
            If dtWL.Rows.Count = 0 Then
                dtWL = GetTableCon(q, "Enjazcon")
            End If
            loc_Details.Text = dtWL(0)("process_desc").ToString
            locProcButtons.Text = "انتبه الان !!!  :" & dtWL(0)("process_desc").ToString
            If ucCustomerInfo.BUYING_TYPE = "C" Then
                InstallDiv.Visible = False
            Else
                InstallDiv.Visible = True
            End If
            If dt(0)("bank").ToString <> "" Then
                ddlInvestmentAgency.SelectedValue = dt(0)("bank").ToString
                'txtInvestmentIntialAmt.Text = dt(0)("investment_amt").ToString
                txtInitBankEmp.Text = dt(0)("initEmpBank").ToString
                txtRealValue.Text = dt(0)("readEstateAmt").ToString
                txtCustomId.Text = dt(0)("req_type").ToString
                txtInitReal.Text = dt(0)("initReal").ToString
                txtInitPersonal.Text = dt(0)("initPersonal").ToString
                txtInitInstall.Text = dt(0)("initInstall").ToString
                txtInitSuppInstall.Text = dt(0)("initInSuppInstall").ToString
                txtInitLong.Text = dt(0)("initLong").ToString

                If dt(0)("corporate").ToString = "Y" Then
                    ChYes.Checked = True
                Else
                    CheNo.Checked = True
                End If

                txtEvalutionAmt.Text = dt(0)("EvalutionAmt").ToString
                txtEvalBankEmp.Text = dt(0)("EvalEmpBank").ToString

                If dt(0)("financeEntity").ToString <> "" Then
                    ddlFinanceEntity.SelectedValue = dt(0)("financeEntity").ToString
                End If

                If dt(0)("PAY_TRANCODE").ToString <> "" Then
                    ddlProcType.SelectedValue = dt(0)("PAY_TRANCODE").ToString
                End If




                If dt(0)("service_req").ToString <> "" Then
                    ddlService.SelectedValue = dt(0)("service_req").ToString
                End If
                If dt(0)("realEstate_req").ToString <> "" Then
                    ddlRealEstate.SelectedValue = dt(0)("realEstate_req").ToString
                End If


                If dt(0)("CITY").ToString <> "" Then
                    ddlCity.SelectedValue = dt(0)("CITY").ToString
                End If
                If dt(0)("WAY").ToString <> "" Then
                    ddlWayOfKnow.SelectedValue = dt(0)("WAY").ToString
                End If

                txtCusPhone.Text = dt(0)("CUSTOM_PHONE").ToString
                txtFinalStatus.Text = dt(0)("FINAL_STATUS").ToString
                txtCustom_status.Text = dt(0)("CUSTOM_STATUS").ToString

                txtSup.Text = dt(0)("sup").ToString

                txtPersonalFin.Text = dt(0)("PersonalFin").ToString
                txtRealEstateFin.Text = dt(0)("RealEstateFin").ToString
                txtInstallment.Text = dt(0)("Installment").ToString
                txtSupportInst.Text = dt(0)("SupportInst").ToString
                txtLong.Text = dt(0)("Longtime").ToString
                txtTax.Text = dt(0)("Tax").ToString
                txtPatch.Text = dt(0)("Patch").ToString
                txtChequAmt.Text = dt(0)("chequeAmt").ToString
                txtCustomerCommition.Text = dt(0)("CustomerCommition").ToString
                txtBankCommition.Text = dt(0)("BankCommition").ToString


                If ProcessId = AppProcess.ProcEval.ToString.ToUpper Then
                    EnableBt = True
                    btnSaveEval.Visible = True
                Else
                    ' EnableBt = False  12/08/2022
                    EnableBt = True
                    btnSaveEval.Visible = False
                End If
                If dt(0)("installments").ToString = "Y" Then
                    ddlInstall.SelectedValue = "Y"
                    txtInstallAmt.ReadOnly = False   '== 12/08/2022
                    txtInstallmentFinanceEntity.ReadOnly = False '== 12/08/2022

                    'ChInstallYes.Checked = True
                    'ChInstallNo.Checked = False

                    GetInstall(requestId)

                    ddlCompPay.SelectedValue = dt(0)("INSTALL_PAY").ToString
                    divInstallments.Visible = True
                    divCompPay.Visible = True
                Else
                    txtInstallAmt.ReadOnly = True   '== 12/08/2022
                    txtInstallmentFinanceEntity.ReadOnly = True '== 12/08/2022
                    ddlInstall.SelectedValue = "N"
                    divInstallments.Visible = False
                    divCompPay.Visible = False
                End If


                txtEmployee.Text = dt(0)("emp_name").ToString
                If dt(0)("emp_name").ToString <> "" Then
                    txtEmployee.Visible = True
                Else
                    txtEmployee.Visible = False
                End If

            End If
            txtCustom_status.Text = dt(0)("CUSTOM_STATUS").ToString
            If ProcessId.ToString <> AppProcess.ProcUploadDoc.ToString.ToUpper Then
                ddlInvestmentAgency.Enabled = False
                ddlRealEstate.Enabled = False
                ddlService.Enabled = False
                ' txtInvestmentIntialAmt.ReadOnly = True
                txtInitBankEmp.ReadOnly = True
                txtRealValue.ReadOnly = True
                txtCustomId.ReadOnly = True

                txtInitReal.ReadOnly = True
                txtInitPersonal.ReadOnly = True
                txtInitInstall.ReadOnly = True
                txtInitSuppInstall.ReadOnly = True
                txtInitLong.ReadOnly = True
                divDocUploadRemarks.Visible = False

                ddlCity.Enabled = False
                ddlWayOfKnow.Enabled = False
                txtCustom_status.ReadOnly = True
                txtCusPhone.ReadOnly = True


                ChYes.Enabled = False
                CheNo.Enabled = False
                btReturn.Visible = True
                btnInitEdit.Visible = False
                BtnSaveInitRemarks.Visible = False
            Else
                btReturn.Visible = False
                divEval.Visible = False
                divFinalApprove.Visible = False
                If dt(0)("initReal").ToString <> "" Then
                    btnInitEdit.Visible = True
                    btnInitSave.Visible = False
                    BtnSaveInitRemarks.Visible = False
                Else
                    btnInitEdit.Visible = False
                    btnInitSave.Visible = True
                    BtnSaveInitRemarks.Visible = True
                End If

            End If

            If ProcessId = AppProcess.ProcUploadReq.ToString.ToUpper Then
                btnCancel.Visible = False
                ' btReturn.Visible = False
                divEval.Visible = False
                divFinalApprove.Visible = False
                'Else
                '    btnCancel.Visible = True
                '    btReturn.Visible = True
            End If
            If ProcessId = AppProcess.ProcEval.ToString.ToUpper Then
                btnCancel.Visible = False
                ' btReturn.Visible = False
                divFinalApprove.Visible = False
                ddlInstall.Enabled = True
                ddlCompPay.Enabled = True
                'btnAddInstall.Enabled = True  '== 12/08/2022
                txtInstallAmt.ReadOnly = False
                txtInstallmentFinanceEntity.ReadOnly = False
                EnableBt = True
                DivPay.Visible = True
            Else
                txtEvalutionAmt.ReadOnly = True
                ddlFinanceEntity.Enabled = False
                ddlProcType.Enabled = False
                txtEvalBankEmp.ReadOnly = True
                divEvalRemarks.Visible = False
                'btnCancel.Visible = True
                'btReturn.Visible = True
                ''ddlInstall.Enabled = False
                ''EnableBt = False

                ddlInstall.Enabled = False
                ddlCompPay.Enabled = False
                ' btnAddInstall.Enabled = False '== 12/08/2022
                'txtInstallAmt.ReadOnly = True   '== 12/08/2022
                'txtInstallmentFinanceEntity.ReadOnly = True '== 12/08/2022
                ' EnableBt = False
                EnableBt = True  '12/08/2022
            End If

            If ProcessId <> AppProcess.ProcFinalAppr.ToString.ToUpper Then
                txtPersonalFin.ReadOnly = True
                txtRealEstateFin.ReadOnly = True
                txtInstallment.ReadOnly = True
                txtSupportInst.ReadOnly = True
                txtPatch.ReadOnly = True
                txtTax.ReadOnly = True
                txtLong.ReadOnly = True
                txtChequAmt.ReadOnly = True
                txtCustomerCommition.ReadOnly = True
                txtBankCommition.ReadOnly = True
                divFinalApproveRemarks.Visible = False
                txtFinalStatus.ReadOnly = True
                'btFinalEdit.Visible = False
                ' ChInstallYes.Enabled = False
                'ChInstallNo.Enabled = False

            Else
                If dt(0)("PersonalFin").ToString <> "" Then
                    btFinalEdit.Visible = True
                    btFinalSave.Visible = False
                Else
                    btFinalEdit.Visible = False
                    btFinalSave.Visible = True
                End If
                DivPay.Visible = True
            End If

            If ProcessId <> AppProcess.ProcClose.ToString.ToUpper Then
                DivCollect.Visible = False
            Else
                DivCollect.Visible = True
            End If


            txtProcRemarks.Text = dtWL(0)("closed_remarks").ToString
            ViewState("ProcessId") = ProcessId
            If IsNothing(PROC) Then
                PROC = ViewState("ProcessId")
                If ProcessId = AppProcess.ProcUploadDoc.ToString.ToUpper Then
                    '   btnSave.Text = "&lt;i aria-hidden=&quot;true&quot;class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;اكمال المستندات"
                    btnSave.Text = btnSave.Text & "اكمال المستندات"
                End If
                If ProcessId = AppProcess.ProcChkPay.ToString.ToUpper Then
                    btnSave.Text = btnSave.Text & "تم السداد"
                    ' btnSave.Text = "&lt;i aria-hidden=&quot;true&quot;class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تم رفع الطلب"
                End If
                If ProcessId = AppProcess.ProcUploadReq.ToString.ToUpper Then
                    btnSave.Text = btnSave.Text & "تم رفع الطلب"
                    ' btnSave.Text = "&lt;i aria-hidden=&quot;true&quot;class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تم رفع الطلب"
                End If
                If ProcessId = AppProcess.ProcEval.ToString.ToUpper Then
                    btnSave.Text = btnSave.Text & "تم التقييم "
                    ' btnSave.Text = "&lt;i aria-hidden=&quot;true&quot;class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تم رفع الطلب"
                End If
                If ProcessId = AppProcess.ProcFinalAppr.ToString.ToUpper Then
                    btnSave.Text = btnSave.Text & "تمت الموافقة "
                    ' btnSave.Text = "&lt;i aria-hidden=&quot;true&quot;class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تم رفع الطلب"
                End If

                If ProcessId = AppProcess.ProcContract.ToString.ToUpper Then
                    btnSave.Text = btnSave.Text & "تم التوقيع "
                    ' btnSave.Text = "&lt;i aria-hidden=&quot;true&quot;class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تم رفع الطلب"
                End If

                If ProcessId = AppProcess.ProcClose.ToString.ToUpper Then
                    btnSave.Text = btnSave.Text & "تم الافراغ "
                    ' btnSave.Text = "&lt;i aria-hidden=&quot;true&quot;class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تم رفع الطلب"
                End If

                If ProcessId = AppProcess.ProcCollect.ToString.ToUpper Then
                    btnSave.Text = btnSave.Text & "تم التحصيل "
                    ' btnSave.Text = "&lt;i aria-hidden=&quot;true&quot;class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تم رفع الطلب"
                End If

            End If

        End If
    End Sub

    Private Sub GetInstall(doc_no As String)
        q = ""
        q = q & "    SELECT DOC_NO,SR_NO,INSTALLAMT,INSTALL_TYPE,INSTALLMENTENTITY ,T.TYPE_DESC AS  INSTALL_STATUS,STATUS AS STATUS_CODE "
        q = q & "    FROM INSTALLMENTS I , (SELECT * FROM TYPE_MST WHERE TYPE_CODE='IS')T  "
        q = q & "    WHERE I.STATUS=T.TYPE_CATEGORY  "
        q = q & "    AND I.DOC_NO='" & doc_no & "' "
        dtInstallment = GetTable(q)
        ViewState("dtInstallment") = dtInstallment

        grdInstall.DataSource = dtInstallment
        grdInstall.DataBind()
        MainClass.SetGridStyle(grdInstall)

    End Sub


    Protected Sub btnInitEdit_Click(sender As Object, e As EventArgs)
        btnInitEdit.Enabled = False
        btnInitSave.Visible = True
        btnInitCancel.Visible = True
        ddlInvestmentAgency.Enabled = True
        ddlService.Enabled = True
        ddlRealEstate.Enabled = True

        ddlWayOfKnow.Enabled = True
        ddlCity.Enabled = True
        txtCustom_status.ReadOnly = False
        txtCusPhone.ReadOnly = False

        'txtInvestmentIntialAmt.ReadOnly = False
        txtInitBankEmp.ReadOnly = False
        txtInitReal.ReadOnly = False
        txtInitPersonal.ReadOnly = False
        txtInitInstall.ReadOnly = False
        txtInitSuppInstall.ReadOnly = False
        txtInitLong.ReadOnly = False
        txtRealValue.ReadOnly = False
        txtCustomId.ReadOnly = False
        CheNo.Enabled = True
        ChYes.Enabled = True
        'ddlEmployee.Enabled = True

    End Sub

    Protected Sub btnInitCancel_Click(sender As Object, e As EventArgs)
        btnInitEdit.Enabled = True
        btnInitSave.Visible = False
        btnInitCancel.Visible = False
        ddlInvestmentAgency.Enabled = False
        'txtInvestmentIntialAmt.ReadOnly = True
        txtInitBankEmp.ReadOnly = True
        txtInitReal.ReadOnly = True
        txtInitPersonal.ReadOnly = True
        txtInitInstall.ReadOnly = True
        txtInitSuppInstall.ReadOnly = True
        txtInitLong.ReadOnly = True
        txtRealValue.ReadOnly = True
        txtCustomId.ReadOnly = True
        CheNo.Enabled = False
        ChYes.Enabled = False
        'ddlEmployee.Enabled = False
        ddlRealEstate.Enabled = False
        ddlService.Enabled = False

        ddlWayOfKnow.Enabled = False
        ddlCity.Enabled = False
        txtCustom_status.ReadOnly = True
        txtCusPhone.ReadOnly = True

        loadData()
    End Sub
    Protected Sub btnInitSave_Click(sender As Object, e As EventArgs)
        If ddlInvestmentAgency.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر البنك")
            Exit Sub
        End If
        'If txtInvestmentIntialAmt.Text = "" Then
        '    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الحسبة")
        '    Exit Sub
        'End If
        If txtInitBankEmp.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل موظف البنك")
            Exit Sub
        End If

        If txtInitReal.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ التمويل العقاري")
            Exit Sub
        End If
        If txtInitPersonal.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ التمويل الشخصي")
            Exit Sub
        End If
        If txtInitInstall.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ القسط")
            Exit Sub
        End If
        If txtInitSuppInstall.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ قسط الدعم")
            Exit Sub
        End If
        If txtInitLong.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل المدة")
            Exit Sub
        End If



        If ddlService.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر الخدمة المطلوبة")
            Exit Sub
        End If

        If ddlRealEstate.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر العقار المطلوب")
            Exit Sub
        End If

        If txtRealValue.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل قيمة العقار")
            Exit Sub
        End If

        If txtCustomId.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل هوية العميل")
            Exit Sub
        End If


        If ChYes.Checked <> True And CheNo.Checked <> True Then
            ShowPopUpMsg(Me.Page, "فضلا حدد اذا هناك متضامن ام لا ")
            Exit Sub
        End If




        If ddlWayOfKnow.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد طريقة معرفة العميل بالشركة")
            Exit Sub
        End If
        If ddlCity.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد مدينة العقار")
            Exit Sub
        End If

        If txtCusPhone.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل جوال المالك")
            Exit Sub
        End If
        If txtCustom_status.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اكتب شرح لحالة العميل ")
            Exit Sub
        End If


        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        q = ""
                        q = q & " update ars_request_hdr set other4='" & ddlInvestmentAgency.SelectedValue.ToString & "',other6='" & txtRealValue.Text & "',other7='" & IIf(ChYes.Checked, "Y", "N") & "', "
                        q = q & " initPersonal ='" & txtInitPersonal.Text & "',initReal='" & txtInitReal.Text & "',initInstall='" & txtInitInstall.Text & "',initInSuppInstall='" & txtInitSuppInstall.Text & "', "
                        q = q & " initLong ='" & txtInitLong.Text & "',initEmpBank=N'" & txtInitBankEmp.Text & "',service_req='" & ddlService.SelectedValue.ToString & "',realEstate_req='" & ddlRealEstate.SelectedValue.ToString & "' "
                        q = q & " ,CUSTOM_PHONE= '" & txtCusPhone.Text & "',CITY='" & ddlCity.SelectedValue.ToString & "' ,WAY='" & ddlWayOfKnow.SelectedValue.ToString & "',CUSTOM_STATUS= N'" & txtCustom_status.Text.ToString & "',req_type=N'" & txtCustomId.Text & "' "
                        q = q & " where doc_no = '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()

                        RunInOtherDb(q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()
                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            btnInitCancel_Click(Nothing, Nothing)
            loadData()
        End If


    End Sub




    'Private Sub loadAttachment()
    '    q = ""
    '    q = q & "   select	'" & requestId & "' as ref_id , type_category doc_type,type_Desc as att_desc,SR_NO, emp_name,FORMAT(up.sys_date,'dd/MM/yyyy')attach_date,up.FILENAME, "
    '    q = q & "    Case when up.FILENAME Is null then N'ارفاق' else N'عرض' end as action,case when up.FILENAME is null then N'ATT' else N'DIS' end as action2   from   "
    '    q = q & "    (select * from type_mst  where type_code='DC') t left join APP_UPLOAD_MST up on t.TYPE_CATEGORY=up.doc_type "
    '    q = q & "     left outer join  (select * from  ARS_REQUEST_HDR  where DOC_NO='" & requestId & "'  )h on up.DOC_NO=h.doc_no "
    '    q = q & "   left join app_users u on up.SYS_USERID=u.user_id "
    '    q = q & "    left join emp_mst e on u.emp_no=e.emp_no  "
    '    Dim DT = GetTable(q)

    '    grdAttachment.DataSource = DT
    '    grdAttachment.DataBind()
    '    SetGridStyle(grdAttachment)
    'End Sub
    'Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
    '    Dim q As String = ""
    '    Dim tkID As String = ""
    '    Dim wlStatus As String = "O" 'rblWLStatus.SelectedValue.ToString

    '    'Dim rowIndex As Integer = Convert.ToInt32(e.CommandArgument)


    '    'Reference the GridView Row.
    '    ' Dim row As GridViewRow = grdAttachment.Rows(rowIndex)




    '    If e.CommandName = "Step" Then

    '        Dim sDOC_TYPE As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
    '        Dim sArgRefID As String = ""
    '        Dim sDOC_DESC As String
    '        Dim sAction As String
    '        Dim sFileName As String
    '        'sWorklistID = e.CommandArgument 'wl_id
    '        sDOC_TYPE = e.CommandArgument.ToString.Split(",")(0).ToString
    '        sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString
    '        sDOC_DESC = e.CommandArgument.ToString.Split(",")(2).ToString
    '        sAction = e.CommandArgument.ToString.Split(",")(3).ToString
    '        sFileName = e.CommandArgument.ToString.Split(",")(4).ToString
    '        'sFileName = row.Cells(4).Text.ToString
    '        Dim url As String
    '        Dim s As String
    '        If sAction.ToString.ToUpper = "DIS" Then
    '            url = "../ImageStorage/" & sFileName & " "
    '            s = "window.open('" & url + "', 'popup_window', 'width=600,height=500,left=100,top=100,resizable=yes');"
    '        Else
    '            url = "../Pages/UploadFiles.aspx?docno=" & sArgRefID & "&doctype=" & sDOC_TYPE & "&docdesc=" & sDOC_DESC & " "
    '            s = "window.open('" & url + "', 'popup_window', 'width=400,height=200,left=100,top=100,resizable=yes');"
    '        End If

    '        'ClientScript.RegisterStartupScript(Me.GetType(), "script", s, True)
    '        ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "script", s, True)

    '    End If
    'End Sub


    Protected Sub btFinalEdit_Click(sender As Object, e As EventArgs)
        btFinalEdit.Enabled = False
        btFinalCancel.Visible = True
        btFinalSave.Visible = True
        txtPersonalFin.ReadOnly = False
        txtRealEstateFin.ReadOnly = False
        txtInstallment.ReadOnly = False
        txtSupportInst.ReadOnly = False
        txtLong.ReadOnly = False
        txtTax.ReadOnly = False
        txtPatch.ReadOnly = False
        txtChequAmt.ReadOnly = False
        txtCustomerCommition.ReadOnly = False
        txtBankCommition.ReadOnly = False
        txtFinalStatus.ReadOnly = False
        ' ChInstallYes.Enabled = True
        'ChInstallNo.Enabled = True
        '''ddlInstall.Enabled = True
        '''ddlCompPay.Enabled = True
        '''btnAddInstall.Enabled = True
        '''txtInstallAmt.ReadOnly = False
        '''txtInstallmentFinanceEntity.ReadOnly = False
        '''EnableBt = True
        '''If ddlInstall.SelectedValue = "Y" Then
        '''    q = ""
        '''    q = q & " SELECT * FROM INSTALLMENTS WHERE DOC_NO= '" & requestId & "' "

        '''    dtInstallment = GetTable(q)
        '''    ViewState("dtInstallment") = dtInstallment

        '''    grdInstall.DataSource = dtInstallment
        '''    grdInstall.DataBind()
        '''    MainClass.SetGridStyle(grdInstall)
        '''End If
    End Sub

    Protected Sub btFinalCancel_Click(sender As Object, e As EventArgs)
        btFinalEdit.Enabled = True
        btFinalCancel.Visible = False
        btFinalSave.Visible = False
        txtPersonalFin.ReadOnly = True
        txtRealEstateFin.ReadOnly = True
        txtInstallment.ReadOnly = True
        txtSupportInst.ReadOnly = True
        txtLong.ReadOnly = True
        txtTax.ReadOnly = True
        txtPatch.ReadOnly = True
        txtChequAmt.ReadOnly = True
        txtCustomerCommition.ReadOnly = True
        txtBankCommition.ReadOnly = True
        txtFinalStatus.ReadOnly = True
        'ChInstallYes.Enabled = False
        'ChInstallNo.Enabled = False
        '''ddlInstall.Enabled = False
        '''ddlCompPay.Enabled = False
        '''btnAddInstall.Enabled = False
        '''txtInstallAmt.ReadOnly = True
        '''txtInstallmentFinanceEntity.ReadOnly = True
        '''EnableBt = False
        loadData()
    End Sub
    Protected Sub imgInstallDel_Command(sender As Object, e As CommandEventArgs)
        Dim SR_NO As String
        SR_NO = e.CommandArgument.ToString.Split(",")(0).ToString
        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)
                        q = ""
                        q = q & "    DELETE FROM INSTALLMENTS"
                        q = q & "    WHERE DOC_NO= '" & requestId & "'  AND SR_NO=" & SR_NO & "  "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(q)

                        If CInt(GetFieldValue(cn, cmd, "SELECT COUNT(DOC_NO) FROM INSTALLMENTS WHERE DOC_NO='" & requestId & "' ")) = 0 Then
                            q = ""
                            q = q & " update ars_request_hdr set  REFCOMP_CODE= 'N' "
                            q = q & " where doc_no = '" & requestId & "'   "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(q)
                        End If

                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()
                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            GetInstall(requestId)
        End If
    End Sub


    Protected Sub lnKEdit_Command(sender As Object, e As CommandEventArgs)
        Dim SR_NO As String
        SR_NO = e.CommandArgument.ToString.Split(",")(0).ToString

        ViewState("SR_NO") = SR_NO
        btnAddInstall.Visible = False
        btnUpdateInstall.Visible = True
        q = ""
        q = q & "    SELECT DOC_NO,SR_NO,INSTALLAMT,INSTALL_TYPE,INSTALLMENTENTITY ,T.TYPE_DESC AS  INSTALL_STATUS,STATUS AS STATUS_CODE "
        q = q & "    FROM INSTALLMENTS I , (SELECT * FROM TYPE_MST WHERE TYPE_CODE='IS')T  "
        q = q & "    WHERE I.STATUS=T.TYPE_CATEGORY  "
        q = q & "    AND I.DOC_NO='" & requestId & "' AND SR_NO=" & SR_NO & " "
        Dim dt = GetTable(q)
        txtInstallAmt.Text = dt(0)("INSTALLAMT")
        txtInstallType.Text = dt(0)("INSTALL_TYPE")
        txtInstallmentFinanceEntity.Text = dt(0)("INSTALLMENTENTITY")
        ddlInstallStatus.SelectedValue = dt(0)("STATUS_CODE")

    End Sub

    Protected Sub btFinalSave_Click(sender As Object, e As EventArgs)
        If txtPersonalFin.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ التويل الشخصي")
            Exit Sub
        End If

        If txtRealEstateFin.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ التويل العقاري")
            Exit Sub
        End If

        If txtInstallment.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ القسط")
            Exit Sub
        End If

        If txtSupportInst.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ قسط الدعم")
            Exit Sub
        End If

        If txtLong.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل المدة")
            Exit Sub
        End If

        If txtTax.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الضريبة")
            Exit Sub
        End If

        If txtChequAmt.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الشيك")
            Exit Sub
        End If

        If txtCustomerCommition.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ السعي من العميل")
            Exit Sub
        End If


        If txtBankCommition.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ السعي من البنك")
            Exit Sub
        End If

        If txtFinalStatus.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا تحقق من الملاحظة")
            Exit Sub
        End If




        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False

        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)



                        q = ""
                            q = q & "   update ars_request_hdr set other11='" & txtPersonalFin.Text & "',other12='" & txtRealEstateFin.Text & "', "
                            q = q & "   other13 ='" & txtInstallment.Text & "',other14='" & txtSupportInst.Text & "',other15='" & txtLong.Text & "', "
                            q = q & "   other16 ='" & txtTax.Text & "',other17='" & txtPatch.Text & "',other18='" & txtChequAmt.Text & "',other19= '" & txtCustomerCommition.Text & "',other20='" & txtBankCommition.Text & "'  "
                            q = q & "  , FINAL_STATUS =N'" & txtFinalStatus.Text & "' "
                            'q = q & "   ,REF_DOCNO='" & IIf(ddlInstall.SelectedValue = "Y", ddlCompPay.SelectedValue.ToString, "") & "'  "
                            q = q & "    where doc_no= '" & requestId & "'   "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()

                            RunInOtherDb(q)

            'q = ""
                        'q = q & "  DELETE FROM INSTALLMENTS WHERE DOC_NO='" & requestId & "' "
                        'cmd.CommandText = q
                        'cmd.ExecuteNonQuery()
                        'If ddlInstall.SelectedValue = "Y" Then
                        '    dtInstallment = ViewState("dtInstallment")
                        '    For Each r In dtInstallment.Rows
                        '        q = ""
                        '        q = q & "  INSERT INTO INSTALLMENTS  "
                        '        q = q & "   (DOC_NO,"
                        '        q = q & "   installAmt ,"
                        '        q = q & "   InstallmentEntity"
                        '        q = q & "   ) VALUES "
                        '        q = q & "   ( '" & requestId & "' , "
                        '        q = q & "    '" & r("installAmt").ToString & "' , "
                        '        q = q & "    N'" & r("InstallmentEntity").ToString & "'  "
                        '        q = q & "      "
                        '        q = q & "    ) "


                        '        cmd.CommandText = q
                        '        cmd.ExecuteNonQuery()
                        '    Next
                        'End If
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()
                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            btFinalCancel_Click(Nothing, Nothing)
            loadData()
        End If

    End Sub


    Protected Sub btnSave_Click(sender As Object, e As EventArgs)
        If ucCustomerInfo.BUYING_TYPE <> "C" Then
            If ProcessId = AppProcess.ProcUploadDoc.ToString.ToUpper Then
                If ddlInvestmentAgency.SelectedValue = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا اختر البنك")
                    Exit Sub
                End If
                'If txtInvestmentIntialAmt.Text = "" Then
                '    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الحسبة")
                '    Exit Sub
                'End If
                If txtInitBankEmp.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل موظف البنك")
                    Exit Sub
                End If
                If txtInitReal.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ التمويل العقاري")
                    Exit Sub
                End If
                If txtInitPersonal.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ التمويل الشخصي")
                    Exit Sub
                End If
                If txtInitInstall.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ القسط")
                    Exit Sub
                End If
                If txtInitSuppInstall.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ قسط الدعم")
                    Exit Sub
                End If
                If txtInitLong.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل المدة")
                    Exit Sub
                End If

                If ddlService.SelectedValue = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا اختر الخدمة المطلوبة")
                    Exit Sub
                End If

                If ddlRealEstate.SelectedValue = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا اختر العقار المطلوب")
                    Exit Sub
                End If

                If txtRealValue.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل قيمة العقار")
                    Exit Sub
                End If

                If txtCustomId.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل هوية العميل")
                    Exit Sub
                End If


                If ChYes.Checked <> True And CheNo.Checked <> True Then
                    ShowPopUpMsg(Me.Page, "فضلا حدد اذا هناك متضامن ام لا ")
                    Exit Sub
                End If

                If ddlWayOfKnow.SelectedValue = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا حدد طريقة معرفة العميل بالشركة")
                    Exit Sub
                End If
                If ddlCity.SelectedValue = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا حدد مدينة العقار")
                    Exit Sub
                End If

                If txtCusPhone.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل جوال المالك")
                    Exit Sub
                End If
                If txtCustom_status.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا اكتب شرح لحالة العميل ")
                    Exit Sub
                End If

                If GetFieldValue("SELECT DOC_NO FROM APP_UPLOAD_MST WHERE DOC_NO='" & requestId & "' AND DOC_TYPE='DCID' ") = "" Then
                    If GetFieldValueCon("SELECT DOC_NO FROM APP_UPLOAD_MST WHERE DOC_NO='" & requestId & "' AND DOC_TYPE='DCID' ", "Enjazcon") = "" Then
                        ShowPopUpMsg(Me.Page, "فضلا قم بارفاق صورة البطاقة ")
                        Exit Sub
                    End If
                End If

                If GetFieldValue("SELECT DOC_NO FROM APP_UPLOAD_MST WHERE DOC_NO='" & requestId & "' AND DOC_TYPE='DCSAL' ") = "" Then
                    If GetFieldValueCon("SELECT DOC_NO FROM APP_UPLOAD_MST WHERE DOC_NO='" & requestId & "' AND DOC_TYPE='DCSAL' ", "Enjazcon") = "" Then
                        ShowPopUpMsg(Me.Page, "فضلا قم بارفاق تعريف الراتب ")
                        Exit Sub
                    End If
                End If

                    If ChYes.Checked = True Then
                    If GetFieldValue("SELECT DOC_NO FROM APP_UPLOAD_MST WHERE DOC_NO='" & requestId & "' AND DOC_TYPE='DCIDCOR' ") = "" Then
                        If GetFieldValueCon("SELECT DOC_NO FROM APP_UPLOAD_MST WHERE DOC_NO='" & requestId & "' AND DOC_TYPE='DCIDCOR' ", "Enjazcon") = "" Then
                            ShowPopUpMsg(Me.Page, "فضلا قم بارفاق صورة بطاقة المتضامن ")
                            Exit Sub
                        End If
                    End If

                    If GetFieldValue("SELECT DOC_NO FROM APP_UPLOAD_MST WHERE DOC_NO='" & requestId & "' AND DOC_TYPE='DCSALCOR' ") = "" Then
                        If GetFieldValueCon("SELECT DOC_NO FROM APP_UPLOAD_MST WHERE DOC_NO='" & requestId & "' AND DOC_TYPE='DCSALCOR' ", "Enjazcon") = "" Then
                            ShowPopUpMsg(Me.Page, "فضلا قم بارفاق تعريف راتب المتضامن ")
                            Exit Sub
                        End If
                    End If
                    End If

            End If
            If ddlInstall.SelectedValue = "Y" And grdInstall.Rows.Count < 1 Then
                ShowPopUpMsg(Me.Page, "فضلااضف بيانات الاقساط من خلال الضغط على + ")
                Exit Sub
            End If
            If ProcessId = AppProcess.ProcEval.ToString.ToUpper Then
                If txtEvalutionAmt.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا مبلغ التمويل")
                    Exit Sub
                End If

                'If txtEvalBankEmp.Text = "" Then
                '    ShowPopUpMsg(Me.Page, "فضلا ادخل موظف البنك")
                '    Exit Sub
                'End If

                If ddlProcType.SelectedValue.ToString = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا حدد سير المعاملة")
                    Exit Sub
                End If

                If ddlFinanceEntity.SelectedValue = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا اختر جهة التمويل")
                    Exit Sub
                End If



                If ddlInstall.SelectedValue = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا حدد اذا كان هناك التزام علي العميل ام لا ")
                    Exit Sub
                End If
                If ddlInstall.SelectedValue = "Y" And grdInstall.Rows.Count < 1 Then
                    ShowPopUpMsg(Me.Page, "فضلااضف بيانات الاقساط من خلال الضغط على + ")
                    Exit Sub
                End If
                If ddlInstall.SelectedValue = "Y" Then
                    If ddlCompPay.SelectedValue = "" Then
                        ShowPopUpMsg(Me.Page, "فضلا حدد جهة سداد الالتزامات المالية")
                        Exit Sub
                    End If
                End If

                If chkPayYes.Checked = False And chkPayNO.Checked = False Then
                    ShowPopUpMsg(Me.Page, "فضلا حدد, هل يجب المرور بمرحلة مراجعة السداد")
                    Exit Sub
                End If

            End If

            If ProcessId = AppProcess.ProcFinalAppr.ToString.ToUpper Then
                If txtPersonalFin.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ التويل الشخصي")
                    Exit Sub
                End If

                If txtRealEstateFin.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ التويل العقاري")
                    Exit Sub
                End If

                If txtInstallment.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ القسط")
                    Exit Sub
                End If

                If txtSupportInst.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ قسط الدعم")
                    Exit Sub
                End If

                If txtLong.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل المدة")
                    Exit Sub
                End If

                If txtTax.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الضريبة")
                    Exit Sub
                End If

                If txtChequAmt.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الشيك")
                    Exit Sub
                End If

                If txtCustomerCommition.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ السعي من العميل")
                    Exit Sub
                End If

                If txtBankCommition.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ السعي من البنك")
                    Exit Sub
                End If

                'If ddlInstall.SelectedValue = "" Then
                '    ShowPopUpMsg(Me.Page, "فضلا حدد اذا كان هناك التزام علي العميل ام لا ")
                '    Exit Sub
                'End If
                'If ddlInstall.SelectedValue = "Y" And grdInstall.Rows.Count < 1 Then
                '    ShowPopUpMsg(Me.Page, "فضلااضف بيانات الاقساط من خلال الضغط على + ")
                '    Exit Sub
                'End If
                'If ddlInstall.SelectedValue = "Y" Then
                '    If ddlCompPay.SelectedValue = "" Then
                '        ShowPopUpMsg(Me.Page, "فضلا حدد جهة سداد الالتزامات المالية")
                '        Exit Sub
                '    End If
                'End If


                If txtFinalStatus.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا تحقق من الملاحظة")
                    Exit Sub
                End If
                If chkPayYes.Checked = False And chkPayNO.Checked = False Then
                    ShowPopUpMsg(Me.Page, "فضلا حدد, هل يجب المرور بمرحلة مراجعة السداد")
                    Exit Sub
                End If
            End If

            If ProcessId = AppProcess.ProcClose.ToString.ToUpper Then
                If ChbCollectYes.Checked = False And ChbCollectNO.Checked = False Then
                    ShowPopUpMsg(Me.Page, "فضلا حدد, هل يجب المرور بمرحلة التحصيل")
                    Exit Sub
                End If
            End If




        End If

        If txtProcRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اكتب تعليق")
            Exit Sub
        End If



        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        btnSave.Enabled = False
                        If ProcessId <> AppProcess.ProcClose.ToString.ToUpper Then
                            Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                            AppWl.WL03ProcessCode = ViewState("p2").ToString
                            AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                            AppWl.WL05RefID = requestId
                            ' AppWl.WL99RefWLID = ViewState("p1")
                            AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                            AppWl.WL07Priority = "N"
                            AppWl.WL08CompCode = AppWl.WL08CompCode
                            AppWl.WL09SysUserID = AppWl.WL09SysUserID
                            AppWl.WL13Status = "O"

                            If ProcessId = AppProcess.ProcUploadDoc.ToString.ToUpper Then
                                AppWl.WL14NextProcessCode = AppProcess.ProcUploadReq.ToString.ToUpper
                            ElseIf ProcessId = AppProcess.ProcUploadReq.ToString.ToUpper Then
                                AppWl.WL14NextProcessCode = AppProcess.ProcEval.ToString.ToUpper
                            ElseIf ProcessId = AppProcess.ProcEval.ToString.ToUpper Then
                                If chkPayYes.Checked = True Then
                                    AppWl.WL14NextProcessCode = AppProcess.ProcChkPay.ToString.ToUpper
                                Else
                                    AppWl.WL14NextProcessCode = AppProcess.ProcFinalAppr.ToString.ToUpper
                                End If
                            ElseIf ProcessId = AppProcess.ProcFinalAppr.ToString.ToUpper Then
                                If chkPayYes.Checked = True Then
                                    AppWl.WL14NextProcessCode = AppProcess.ProcChkPay.ToString.ToUpper
                                Else
                                    AppWl.WL14NextProcessCode = AppProcess.ProcContract.ToString.ToUpper
                                End If
                            ElseIf ProcessId = AppProcess.ProcChkPay.ToString.ToUpper Then
                                Dim PREV_WLID = GetFieldValue(cn, cmd, "SELECT REF_WLID FROM APP_WORKLIST WHERE REF_ID='" & requestId & "' AND WL_ID='" & worklistId & "'")
                                If PREV_WLID = "" Then
                                    PREV_WLID = GetFieldValueCon("SELECT REF_WLID FROM APP_WORKLIST WHERE REF_ID='" & requestId & "' AND WL_ID='" & worklistId & "'", "Enjazcon")
                                End If
                                Dim NEXT_PROCESS_ID = GetFieldValue(cn, cmd, "SELECT NEXT_PROCESS_ID FROM APP_WORKLIST WHERE REF_ID='" & requestId & "' AND WL_ID='" & PREV_WLID & "'")
                                If NEXT_PROCESS_ID = "" Then
                                    NEXT_PROCESS_ID = GetFieldValueCon("SELECT NEXT_PROCESS_ID FROM APP_WORKLIST WHERE REF_ID='" & requestId & "' AND WL_ID='" & PREV_WLID & "'", "Enjazcon")
                                End If
                                If NEXT_PROCESS_ID = AppProcess.ProcEval.ToString.ToUpper Then
                                    AppWl.WL14NextProcessCode = AppProcess.ProcFinalAppr.ToString.ToUpper
                                Else
                                    AppWl.WL14NextProcessCode = AppProcess.ProcContract.ToString.ToUpper
                                End If
                            ElseIf ProcessId = AppProcess.ProcContract.ToString.ToUpper Then
                                AppWl.WL14NextProcessCode = AppProcess.ProcClose.ToString.ToUpper
                            End If

                            AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                            AppWl.WL16RefStationID = ""
                            AppWl.WL17RefTask = ""
                            AppWl.WL18RefOther = "R"
                            AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                            '  AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                            AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.Predefined

                            q = "  SELECT EMP_NO FROM APP_PROCESS_OWNER  WHERE PROCESS_ID='" & AppWl.WL14NextProcessCode & "' "
                            If AppWl.WL14NextProcessCode = AppProcess.ProcUploadReq.ToString.ToUpper Then
                                q = q & "   UNION SELECT DEPT_HEAD  FROM ARS_REQUEST_HDR WHERE DOC_NO='" & requestId & "' AND DEPT_HEAD <> ''  "
                            End If
                            Dim WL99Owners = GetTable(q)
                            'WL99Owners.Merge(GetTableCon("SELECT DEPT_HEAD FROM ARS_REQUEST_HDR WHERE DOC_NO='" & requestId & "' AND DEPT_HEAD <> ''", "Enjazcon"))



                            AppWl.WL99Owners = WL99Owners
                            AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                            AppWl.WL99ModuleID = "R"
                            AppWl.WL99ApprLevel = "0"
                            If ProcessId <> AppProcess.ProcCollect.ToString.ToUpper Then
                                InsertWorklist(cn, cmd, AppWl)
                            End If
                            ' CloseWorklist(cn, cmd, worklistId, Session("UserID"), txtProcRemarks.Text)
                        Else
                            q = ""
                            q = q & " update ars_request_hdr set status='C' where doc_no= '" & requestId & "'   "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(q)

                            If ChbCollectYes.Checked = True Then
                                Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                                AppWl.WL03ProcessCode = ViewState("p2").ToString
                                AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                                AppWl.WL05RefID = requestId
                                ' AppWl.WL99RefWLID = ViewState("p1")
                                AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                                AppWl.WL07Priority = "N"
                                AppWl.WL08CompCode = AppWl.WL08CompCode
                                AppWl.WL09SysUserID = AppWl.WL09SysUserID
                                AppWl.WL13Status = "O"
                                AppWl.WL14NextProcessCode = AppProcess.ProcCollect.ToString.ToUpper
                                AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                                AppWl.WL16RefStationID = ""
                                AppWl.WL17RefTask = ""
                                AppWl.WL18RefOther = "R"
                                AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper
                                AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                                'AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.Predefined
                                'AppWl.WL99Owners = GetTable("SELECT EMP_NO FROM APP_PROCESS_OWNER  WHERE PROCESS_ID='" & AppWl.WL14NextProcessCode & "' UNION SELECT DEPT_HEAD FROM ARS_REQUEST_HDR WHERE DOC_NO='" & requestId & "' AND DEPT_HEAD <> ''  ")
                                AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                                AppWl.WL99ModuleID = "R"
                                AppWl.WL99ApprLevel = "0"
                                InsertWorklist(cn, cmd, AppWl)
                            End If

                        End If

                        If ProcessId = AppProcess.ProcUploadDoc.ToString.ToUpper Then
                            q = ""
                            q = q & " update ars_request_hdr set other4='" & ddlInvestmentAgency.SelectedValue.ToString & "',initEmpBank=N'" & txtInitBankEmp.Text & "',other6='" & txtRealValue.Text & "',other7='" & IIf(ChYes.Checked, "Y", "N") & "',initPersonal='" & txtInitPersonal.Text & "',initReal='" & txtInitReal.Text & "',initInstall='" & txtInitInstall.Text & "',initInSuppInstall='" & txtInitSuppInstall.Text & "',initLong='" & txtInitLong.Text & "',service_req='" & ddlService.SelectedValue.ToString & "',realEstate_req='" & ddlRealEstate.SelectedValue.ToString & "' "
                            q = q & " ,CUSTOM_PHONE= N'" & txtCusPhone.Text & "',CITY='" & ddlCity.SelectedValue.ToString & "' ,WAY='" & ddlWayOfKnow.SelectedValue.ToString & "',CUSTOM_STATUS= N'" & txtCustom_status.Text.ToString & "',req_type=N'" & txtCustomId.Text & " ' "
                            q = q & " where doc_no = '" & requestId & "'   "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(q)
                        End If
                        '===20/08/2023 , ali to remove forupload flag
                        If ProcessId = AppProcess.ProcUploadReq.ToString.ToUpper Then
                            q = ""
                            q = q & " update ars_request_hdr set  FORUPLOAD='N' "
                            q = q & " where doc_no = '" & requestId & "'   "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(q)
                        End If

                        If ProcessId = AppProcess.ProcEval.ToString.ToUpper Then
                            q = ""
                            q = q & " update ars_request_hdr set other9='" & ddlFinanceEntity.SelectedItem.Value & "',PAY_TRANCODE='" & ddlProcType.SelectedValue.ToString & "', other10='" & txtEvalutionAmt.Text & "',EvalEmpBank=N'" & txtEvalBankEmp.Text & "' "
                            q = q & "  ,refcomp_code='" & ddlInstall.SelectedValue.ToString & "'"
                            q = q & "   ,REF_DOCNO='" & IIf(ddlInstall.SelectedValue = "Y", ddlCompPay.SelectedValue.ToString, "") & "'  "
                            q = q & "    where doc_no = '" & requestId & "'   "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(q)
                            ''q = ""
                            ''q = q & "  DELETE FROM INSTALLMENTS WHERE DOC_NO='" & requestId & "' "
                            ''cmd.CommandText = q
                            ''cmd.ExecuteNonQuery()
                            ''If ddlInstall.SelectedValue.ToString = "Y" Then
                            ''    dtInstallment = ViewState("dtInstallment")
                            ''    For Each r In dtInstallment.Rows
                            ''        q = ""
                            ''        q = q & "  INSERT INTO INSTALLMENTS  "
                            ''        q = q & "   (DOC_NO,"
                            ''        q = q & "   installAmt ,"
                            ''        q = q & "   InstallmentEntity"
                            ''        q = q & "   ) VALUES "
                            ''        q = q & "   ( '" & requestId & "' , "
                            ''        q = q & "    '" & r("installAmt").ToString & "' , "
                            ''        q = q & "    N'" & r("InstallmentEntity").ToString & "'  "
                            ''        q = q & "      "
                            ''        q = q & "    ) "


                            ''        cmd.CommandText = q
                            ''        cmd.ExecuteNonQuery()
                            ''    Next
                            ''End If

                        End If

                        If ProcessId = AppProcess.ProcFinalAppr.ToString.ToUpper Then
                            q = ""
                            q = q & "   update ars_request_hdr set other11='" & txtPersonalFin.Text & "',other12='" & txtRealEstateFin.Text & "', "
                            q = q & "   other13 ='" & txtInstallment.Text & "',other14='" & txtSupportInst.Text & "',other15='" & txtLong.Text & "', "
                            q = q & "   other16 ='" & txtTax.Text & "',other17='" & txtPatch.Text & "',other18='" & txtChequAmt.Text & "',other19= '" & txtCustomerCommition.Text & "',other20='" & txtBankCommition.Text & "'  "
                            q = q & "  , FINAL_STATUS =N'" & txtFinalStatus.Text & "' "
                            q = q & "    where doc_no= '" & requestId & "'   "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(q)

                        End If


                        ' 8/12/2022
                        ''If ddlInstall.SelectedValue.ToString = "Y" And ProcessId <> AppProcess.ProcEval.ToString.ToUpper Then
                        ''    dtInstallment = ViewState("dtInstallment")
                        ''    If dtInstallment.Rows.Count > 0 Then
                        ''        q = ""
                        ''        q = q & "  DELETE FROM INSTALLMENTS WHERE DOC_NO='" & requestId & "' "
                        ''        cmd.CommandText = q
                        ''        cmd.ExecuteNonQuery()


                        ''        For Each r In dtInstallment.Rows
                        ''            q = ""
                        ''            q = q & "  INSERT INTO INSTALLMENTS  "
                        ''            q = q & "   (DOC_NO,"
                        ''            q = q & "   installAmt ,"
                        ''            q = q & "   InstallmentEntity"
                        ''            q = q & "   ) VALUES "
                        ''            q = q & "   ( '" & requestId & "' , "
                        ''            q = q & "    '" & r("installAmt").ToString & "' , "
                        ''            q = q & "    N'" & r("InstallmentEntity").ToString & "'  "
                        ''            q = q & "      "
                        ''            q = q & "    ) "


                        ''            cmd.CommandText = q
                        ''            cmd.ExecuteNonQuery()
                        ''        Next
                        ''    End If
                        ''End If




                        CloseWorklist(cn, cmd, worklistId, Session("user_id").ToString, "C", txtProcRemarks.Text)
                        ''If txtProcRemarks.Text <> "" Then
                        ''    UpdateLastRemarks(cn, cmd, requestId, txtProcRemarks.Text)
                        ''End If
                        'q = ""
                        'q = q & " update ars_request_hdr set emp_no='" & ddlEmployee.SelectedValue.ToString & "' where doc_no= '" & requestId & "'   "
                        'cmd.CommandText = q
                        'cmd.ExecuteNonQuery()
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()
                    btnSave.Enabled = True
                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            'RedirectURL("../pages/Worklist.aspx")
            ClosePage(Me.Page)
        End If

    End Sub

    Protected Sub btnCancel_Click(sender As Object, e As EventArgs)

        divCancel.Visible = True
        If txtProcRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اكتب تعليق")
            Exit Sub
        End If

        If ddlCancelReason.SelectedValue.ToString = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر سبب الإلغاء")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        CloseWorklist(cn, cmd, worklistId, Session("user_id").ToString, "C", txtProcRemarks.Text)
                        'If txtProcRemarks.Text <> "" Then
                        '    UpdateLastRemarks(cn, cmd, requestId, txtProcRemarks.Text)
                        'End If



                        Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        AppWl.WL03ProcessCode = ViewState("p2").ToString
                        AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                        AppWl.WL05RefID = requestId
                        ' AppWl.WL99RefWLID = ViewState("p1")
                        AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL07Priority = "N"
                        AppWl.WL08CompCode = AppWl.WL08CompCode
                        AppWl.WL09SysUserID = AppWl.WL09SysUserID
                        AppWl.WL13Status = "O"
                        AppWl.WL14NextProcessCode = AppProcess.ProcCancelConfirm.ToString.ToUpper
                        AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                        AppWl.WL16RefStationID = ""
                        AppWl.WL17RefTask = ""
                        AppWl.WL18RefOther = "R"
                        AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                        '  AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                        AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.Predefined
                        Dim DtOwner = GetTable(cn, cmd, "SELECT EMP_NO FROM APP_PROCESS_OWNER  WHERE PROCESS_ID='" & AppWl.WL14NextProcessCode & "' UNION SELECT DEPT_HEAD FROM ARS_REQUEST_HDR WHERE DOC_NO='" & requestId & "' AND DEPT_HEAD <> ''  ")
                        DtOwner.Merge(GetTableCon("SELECT DEPT_HEAD AS  EMP_NO FROM ARS_REQUEST_HDR WHERE DOC_NO='" & requestId & "' AND DEPT_HEAD <> '' ", "Enjazcon"))
                        DtOwner.AcceptChanges()
                        AppWl.WL99Owners = DtOwner

                        AppWl.WL99PageLink = "../Pages/CancelConfirm.aspx"
                        AppWl.WL99ModuleID = "R"
                        AppWl.WL99ApprLevel = "0"
                        InsertWorklist(cn, cmd, AppWl)


                        q = ""
                        q = q & " update ars_request_hdr set cancel_reason='" & ddlCancelReason.SelectedValue.ToString & "' where doc_no= '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            'RedirectURL("../pages/Worklist.aspx")
            ClosePage(Me.Page)
        End If

    End Sub

    Protected Sub btReturn_Click(sender As Object, e As EventArgs)


        If txtProcRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اكتب تعليق")
            Exit Sub
        End If



        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)
                        CloseWorklist(cn, cmd, worklistId, Session("user_id").ToString, "U", txtProcRemarks.Text)
                        'If txtProcRemarks.Text <> "" Then
                        '    UpdateLastRemarks(cn, cmd, requestId, txtProcRemarks.Text)
                        'End If
                        Dim ref_wlid = GetFieldValue(cn, cmd, "select ref_wlid from app_worklist where wl_id='" & worklistId & "'")
                        If ref_wlid = "" Then
                            ref_wlid = GetFieldValueCon("select ref_wlid from app_worklist where wl_id='" & worklistId & "'", "Enjazcon")
                        End If
                        q = ""
                        q = q & " update app_worklist  set status='O' where WL_ID= '" & ref_wlid & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    '  cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            'RedirectURL("../pages/Worklist.aspx")
            ClosePage(Me.Page)
        End If
    End Sub

    Protected Sub btSetPending_Click(sender As Object, e As EventArgs)

        divHold.Visible = True

        If txtProcRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اكتب تعليق")
            Exit Sub
        End If

        If ddlReason.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد سبب التاجيل")
            Exit Sub
        End If

        If ddlTime.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد مدة التأجيل")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        ' CloseWorklist(cn, cmd, worklistId, Session("user_id").ToString, "U", txtProcRemarks.Text)

                        'Dim ref_wlid = GetFieldValue(cn, cmd, "select ref_wlid from app_worklist where wl_id='" & worklistId & "'")
                        q = ""
                        q = q & " update app_worklist  set STATUS='N'  where WL_ID= '" & worklistId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(q)
                        q = ""
                        q = q & " update ars_request_hdr set status='N',hold_reason='" & ddlReason.SelectedValue.ToString() & "',hold_time=DATEADD(DAY, " & ddlTime.SelectedValue.ToString & ",EnjazVB.GetServerDate())  where doc_no= '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            'RedirectURL("../pages/Worklist.aspx")
            ClosePage(Me.Page)
        End If
    End Sub

    Protected Sub btnSaveEvalRemarks_Click(sender As Object, e As EventArgs)
        If txtEvalRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل ملاحظة التقييم")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        AppWl.WL03ProcessCode = ViewState("p2").ToString
                        AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                        AppWl.WL05RefID = requestId
                        ' AppWl.WL99RefWLID = ViewState("p1")
                        AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL121ClosedRemarks = txtEvalRemarks.Text.ToString
                        AppWl.WL11ClosedDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL12ClosedBy = Session("user_id").ToString

                        AppWl.WL07Priority = "N"
                        AppWl.WL08CompCode = AppWl.WL08CompCode
                        AppWl.WL09SysUserID = AppWl.WL09SysUserID
                        AppWl.WL13Status = "C"

                        AppWl.WL14NextProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
                        AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & "(التقييم)"
                        AppWl.WL16RefStationID = ""
                        AppWl.WL17RefTask = ""
                        AppWl.WL18RefOther = "R"
                        AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper


                        ' AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                        AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        AppWl.WL98OnlyOwner = Session("emp_no").ToString

                        'AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        'AppWl.WL98OnlyOwner = ddlEmployee.SelectedValue.ToString
                        AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                        AppWl.WL99ModuleID = "R"
                        AppWl.WL99ApprLevel = "0"
                        InsertRemarks(cn, cmd, AppWl)
                        ' InsertNewRemarks(cn, cmd, AppWl)
                        'InsertWorklist(cn, cmd, AppWl)

                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            txtEvalRemarks.Text = ""
            '  RedirectURL("../pages/Worklist.aspx")
            ucApprovals.DocNo = requestId
        End If
    End Sub

    Protected Sub btnAddApprovalRemarks_Click(sender As Object, e As EventArgs)
        If txtFinalApprovalRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل ملاحظة الموافقة النهائية")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        AppWl.WL03ProcessCode = ViewState("p2").ToString
                        AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                        AppWl.WL05RefID = requestId
                        ' AppWl.WL99RefWLID = ViewState("p1")
                        AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL121ClosedRemarks = txtFinalApprovalRemarks.Text.ToString
                        AppWl.WL11ClosedDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL12ClosedBy = Session("user_id").ToString

                        AppWl.WL07Priority = "N"
                        AppWl.WL08CompCode = AppWl.WL08CompCode
                        AppWl.WL09SysUserID = AppWl.WL09SysUserID
                        AppWl.WL13Status = "C"

                        AppWl.WL14NextProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
                        AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & "(الموافقة النهائية)"
                        AppWl.WL16RefStationID = ""
                        AppWl.WL17RefTask = ""
                        AppWl.WL18RefOther = "R"
                        AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper


                        ' AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                        AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        AppWl.WL98OnlyOwner = Session("emp_no").ToString

                        'AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        'AppWl.WL98OnlyOwner = ddlEmployee.SelectedValue.ToString
                        AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                        AppWl.WL99ModuleID = "R"
                        AppWl.WL99ApprLevel = "0"
                        InsertRemarks(cn, cmd, AppWl)
                        'InsertNewRemarks(cn, cmd, AppWl)
                        'InsertWorklist(cn, cmd, AppWl)
                    End Using

                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            '  RedirectURL("../pages/Worklist.aspx")
            txtFinalApprovalRemarks.Text = ""
            ucApprovals.DocNo = requestId
        End If
    End Sub

    Protected Sub btnDocUploadRemarks_Click(sender As Object, e As EventArgs)
        If txtDocUploadRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل ملاحظة اكمال المستندات")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        AppWl.WL03ProcessCode = ViewState("p2").ToString
                        AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                        AppWl.WL05RefID = requestId
                        ' AppWl.WL99RefWLID = ViewState("p1")
                        AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL121ClosedRemarks = txtDocUploadRemarks.Text.ToString
                        AppWl.WL11ClosedDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL12ClosedBy = Session("user_id").ToString

                        AppWl.WL07Priority = "N"
                        AppWl.WL08CompCode = AppWl.WL08CompCode
                        AppWl.WL09SysUserID = AppWl.WL09SysUserID
                        AppWl.WL13Status = "C"

                        AppWl.WL14NextProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
                        AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & "(اكمال المستندات)"
                        AppWl.WL16RefStationID = ""
                        AppWl.WL17RefTask = ""
                        AppWl.WL18RefOther = "R"
                        AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper


                        ' AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                        AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        AppWl.WL98OnlyOwner = Session("emp_no").ToString

                        'AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        'AppWl.WL98OnlyOwner = ddlEmployee.SelectedValue.ToString
                        AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                        AppWl.WL99ModuleID = "R"
                        AppWl.WL99ApprLevel = "0"
                        InsertRemarks(cn, cmd, AppWl)
                        'InsertNewRemarks(cn, cmd, AppWl)
                        'InsertWorklist(cn, cmd, AppWl)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            txtDocUploadRemarks.Text = ""
            '  RedirectURL("../pages/Worklist.aspx")
            ucApprovals.DocNo = requestId
        End If
    End Sub



    Protected Sub btnAddInstall_Click(sender As Object, e As EventArgs)
        AddDelInstall()
    End Sub

    Public Sub CreateTableInstall()
        dtInstallment = New DataTable
        dtInstallment.Columns.Add("SRNO", Type.GetType("System.String"))
        dtInstallment.Columns.Add("installAmt", Type.GetType("System.String"))
        dtInstallment.Columns.Add("InstallmentType", Type.GetType("System.String"))
        dtInstallment.Columns.Add("InstallmentEntity", Type.GetType("System.String"))
        dtInstallment.Columns.Add("InstallmentStatus", Type.GetType("System.String"))
        dtInstallment.Columns.Add("InstallmentStatus_Code", Type.GetType("System.String"))
        ViewState("dtInstallment") = dtInstallment

        grdInstall.DataSource = dtInstallment
        grdInstall.DataBind()
        MainClass.SetGridStyle(grdInstall)
    End Sub

    Private Sub AddDelInstall()
        If txtInstallAmt.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ السداد المبكر  ")
            Exit Sub
        End If

        If txtInstallType.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل نوع القرض ")
            Exit Sub
        End If

        If txtInstallmentFinanceEntity.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد الجهة ")
            Exit Sub
        End If

        If ddlInstallStatus.SelectedValue.ToString = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد حالة القرض ")
            Exit Sub
        End If

        'If ViewState("dtInstallment") Is Nothing Then
        '    CreateTableInstall()
        'Else
        '    dtInstallment = ViewState("dtInstallment")

        'End If

        ''Dim nr As DataRow = dtInstallment.NewRow
        ''nr("installAmt") = txtInstallAmt.Text
        ''nr("InstallmentEntity") = txtInstallmentFinanceEntity.Text








        ''dtInstallment.Rows.Add(nr)


        ''ViewState("dtInstallment") = dtInstallment




        ''grdInstall.DataSource = dtInstallment
        ''grdInstall.DataBind()
        ''MainClass.SetGridStyle(grdInstall)
        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)
                        Dim SR_NO = CInt(GetFieldValue(cn, cmd, "SELECT ISNULL(MAX(SR_NO),0)+1 FROM INSTALLMENTS WHERE DOC_NO= '" & requestId & "'  "))
                        q = ""
                        q = q & "  INSERT INTO INSTALLMENTS  "
                        q = q & "   (DOC_NO,"
                        q = q & "   installAmt ,"
                        q = q & "   INSTALL_TYPE ,"
                        q = q & "   InstallmentEntity,"
                        q = q & "   STATUS,"
                        q = q & "   SR_NO"
                        q = q & "   ) VALUES "
                        q = q & "   ( '" & requestId & "' , "
                        q = q & "    " & txtInstallAmt.Text & " , "
                        q = q & "    N'" & txtInstallType.Text.ToString & "',  "
                        q = q & "    N'" & txtInstallmentFinanceEntity.Text & "' , "
                        q = q & "    N'" & ddlInstallStatus.SelectedValue.ToString() & "' , "
                        q = q & "    " & SR_NO & "  "
                        q = q & "      "
                        q = q & "    ) "


                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()


                        q = ""
                        q = q & " update ars_request_hdr set  REFCOMP_CODE= 'Y' "
                        q = q & " where doc_no = '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            GetInstall(requestId)
            txtInstallAmt.Text = ""
            txtInstallType.Text = ""
            txtInstallmentFinanceEntity.Text = ""
            ddlInstallStatus.SelectedIndex = -1
        End If
    End Sub

    Protected Sub BtnSaveInitRemarks_Click(sender As Object, e As EventArgs)
        If txtCustom_status.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اكتب شرح لحالة العميل ")
            Exit Sub
        End If


        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)



                        q = ""
                        q = q & " update ars_request_hdr set  CUSTOM_STATUS= N'" & txtCustom_status.Text.ToString & "' "
                        q = q & " where doc_no = '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()
                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            loadData()
        End If

    End Sub

    Protected Sub ddlInstall_SelectedIndexChanged(sender As Object, e As EventArgs)
        If ddlInstall.SelectedValue.ToString = "Y" Then
            divInstallments.Visible = True
            divCompPay.Visible = True
        Else
            divInstallments.Visible = False
            divCompPay.Visible = False
        End If
    End Sub

    Protected Sub ChInstallYes_CheckedChanged(sender As Object, e As EventArgs)
        'If ChInstallYes.Checked = True Then
        '    ChInstallNo.Checked = False
        '    divInstallments.Visible = True
        '    divCompPay.Visible = True
        'Else
        '    divInstallments.Visible = False
        '    divCompPay.Visible = False
        'End If
    End Sub

    Protected Sub ChInstallNo_CheckedChanged(sender As Object, e As EventArgs)
        'If ChInstallNo.Checked = True Then
        '    divInstallments.Visible = False
        '    divCompPay.Visible = False
        'Else
        'End If
    End Sub

    Protected Sub chkPayYes_CheckedChanged(sender As Object, e As EventArgs)
        If chkPayYes.Checked = True Then
            chkPayNO.Checked = False
        End If
    End Sub

    Protected Sub chkPayNO_CheckedChanged(sender As Object, e As EventArgs)
        If chkPayNO.Checked = True Then
            chkPayYes.Checked = False
        End If
    End Sub

    Protected Sub btnStumbled_Click(sender As Object, e As EventArgs)
        If txtProcRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اكتب تعليق")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        CloseWorklist(cn, cmd, worklistId, Session("user_id").ToString, "S", txtProcRemarks.Text)
                        q = ""
                        q = q & " UPDATE ARS_REQUEST_HDR SET STATUS='S' WHERE DOC_NO= '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            'RedirectURL("../pages/Worklist.aspx")
            ClosePage(Me.Page)
        End If
    End Sub

    Protected Sub btnUpdateInstall_Click(sender As Object, e As EventArgs)
        If IsNothing(ViewState("SR_NO")) Then
            ViewState("SR_NO") = ""
        End If


        If ViewState("SR_NO").ToString = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر اولا للتعديل")
            Exit Sub
        End If

        If txtInstallAmt.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ السداد المبكر  ")
            Exit Sub
        End If

        If txtInstallType.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل نوع القرض ")
            Exit Sub
        End If

        If txtInstallmentFinanceEntity.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد الجهة ")
            Exit Sub
        End If

        If ddlInstallStatus.SelectedValue.ToString = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد حالة القرض ")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        q = ""
                        q = q & "  UPDATE  INSTALLMENTS  "
                        q = q & "   SET "
                        q = q & "   installAmt= " & txtInstallAmt.Text & " ,"
                        q = q & "   INSTALL_TYPE = N'" & txtInstallType.Text.ToString & "' ,"
                        q = q & "   InstallmentEntity = N'" & txtInstallmentFinanceEntity.Text & "' ,"
                        q = q & "   STATUS= N'" & ddlInstallStatus.SelectedValue.ToString() & "'"
                        q = q & "   WHERE DOC_NO='" & requestId & "' AND  SR_NO = " & ViewState("SR_NO").ToString & "  "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()

                        RunInOtherDb(q)

                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            ViewState("SR_NO") = ""
            btnUpdateInstall.Visible = False
            btnAddInstall.Visible = True
            GetInstall(requestId)
            txtInstallAmt.Text = ""
            txtInstallType.Text = ""
            txtInstallmentFinanceEntity.Text = ""
            ddlInstallStatus.SelectedIndex = -1
        End If
    End Sub

    Protected Sub btnSaveEval_Click(sender As Object, e As EventArgs)

        If txtEvalutionAmt.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا مبلغ التمويل")
                Exit Sub
            End If
        If ddlProcType.SelectedValue.ToString = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد سير المعاملة")
            Exit Sub
        End If

        If ddlFinanceEntity.SelectedValue = "" Then
                ShowPopUpMsg(Me.Page, "فضلا اختر جهة التمويل")
                Exit Sub
            End If



            If ddlInstall.SelectedValue = "" Then
                ShowPopUpMsg(Me.Page, "فضلا حدد اذا كان هناك التزام علي العميل ام لا ")
                Exit Sub
            End If
            If ddlInstall.SelectedValue = "Y" And grdInstall.Rows.Count < 1 Then
                ShowPopUpMsg(Me.Page, "فضلااضف بيانات الاقساط من خلال الضغط على + ")
                Exit Sub
            End If
            If ddlInstall.SelectedValue = "Y" Then
                If ddlCompPay.SelectedValue = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا حدد جهة سداد الالتزامات المالية")
                    Exit Sub
                End If
            End If


        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)
                        q = ""
                        q = q & " update ars_request_hdr set other9='" & ddlFinanceEntity.SelectedItem.Value & "',PAY_TRANCODE='" & ddlProcType.SelectedValue.ToString & "', other10='" & txtEvalutionAmt.Text & "',EvalEmpBank=N'" & txtEvalBankEmp.Text & "' "
                        q = q & "  ,refcomp_code='" & ddlInstall.SelectedValue.ToString & "'"
                        q = q & "   ,REF_DOCNO='" & IIf(ddlInstall.SelectedValue = "Y", ddlCompPay.SelectedValue.ToString, "") & "'  "
                        q = q & "    where doc_no = '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            loadData()
        End If
    End Sub

    Protected Sub ChbCollectYes_CheckedChanged(sender As Object, e As EventArgs)
        ChbCollectNO.Checked = Not ChbCollectYes.Checked
    End Sub

    Protected Sub ChbCollectNO_CheckedChanged(sender As Object, e As EventArgs)
        ChbCollectYes.Checked = Not ChbCollectNO.Checked
    End Sub
End Class

Contents of ucQualityCancelled.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucQualityCancelled.ascx.vb" Inherits="EnjazVB.ucQualityCancelled" %>
  <%@ Register Src="~/Controls/ucCustomerInfo.ascx" TagPrefix="uc1" TagName="ucCustomerInfo" %>
<%@ Register Src="~/Controls/ucApprovals.ascx" TagPrefix="uc1" TagName="ucApprovals" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>                
                <div class="form-horizontal">
                  
                          <div class="form-group">
                        <div style="overflow: auto;">
                            <div style="direction:rtl;" class="table-responsive">
                                <asp:GridView ID="grdWL"   CssClass="table table-hover table-striped" runat="server" AllowPaging="false" AllowCustomPaging="false" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%" meta:resourcekey="grdWLResource1">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource1">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnRefresh" runat="server" CssClass="btn btn-primary btn-sm pull-right"  ToolTip="Refresh" meta:resourcekey="btnRefreshResource1" Text="
                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-refresh&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblSrNo" runat="server" Text='<%# Eval("srno") %>' meta:resourcekey="lblSrNoResource1"></asp:Label>
<%--                                                <asp:HiddenField ID="hwl_days" runat="server" Value='<%# Eval("wl_days") %>' />--%>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>  
                                        
                                        <asp:TemplateField HeaderText="رقم الطلب" SortExpression="doc_no" >
                                        <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton ID="btnStep" runat="server" OnCommand="btnStep_Command"
                                                     Text='<%# Bind("ref_id") %>'
                                                    ToolTip="Click to open the details" CommandName="Step" CommandArgument='<%# string.Concat(Eval("ref_id"), ",", Eval("ref_id"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <%-- Enabled='<%# IIf(isSupper Or isSupvisor, True, False) %>'--%>
                                             

 <asp:TemplateField HeaderText="العميل" SortExpression="customer" >
                                           <ItemTemplate>
                                                <asp:Label ID="lblcustomer" runat="server" Text='<%# Eval("customer") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                          

                                        <asp:TemplateField HeaderText="هوية العميل" SortExpression="cust_id" >
                                           <ItemTemplate>
                                                <asp:Label ID="lblcust_id" runat="server" Text='<%# Eval("cust_id") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>



                                        <asp:TemplateField HeaderText="موظف البنك" SortExpression="initempbank" >
                                          <ItemTemplate>
                                                <asp:Label ID="lbllinitempbank" runat="server" Text='<%# Eval("initempbank") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>
 <asp:TemplateField HeaderText="بنك التمويل" SortExpression="INV_bank"  >
                                         <ItemTemplate>
                                                <asp:Label ID="lblINV_bank" runat="server" Text='<%# Eval("INV_bank") %>' meta:resourcekey="lblPriorityResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                            <%--  <asp:TemplateField HeaderText="بنك الراتب" SortExpression="salary_bank"  >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblBank" runat="server" Text="بنك الراتب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="salary_bank" ></asp:LinkButton>
                                                <asp:TextBox ID="salary_bank" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblBank" runat="server" Text='<%# Eval("salary_bank") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>



                                        <asp:TemplateField HeaderText="تاريخ الطلب" SortExpression="doc_date" meta:resourcekey="TemplateFieldResource3">
                                           <ItemTemplate>
                                                <asp:Label ID="lblDate" runat="server" Text='<%# Eval("doc_date") %>' meta:resourcekey="lblDateResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        

                                         <asp:TemplateField HeaderText="حالة الطلب" SortExpression="status" >
                                        <ItemTemplate>
                                                <asp:Label ID="lblstatus" runat="server" Text='<%# Eval("status") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>



                                            <asp:TemplateField HeaderText="اخر تحديث"  >
                                          <%--  <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWLID" runat="server" Text="تسلسل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="wl_id" ></asp:LinkButton>
                                                <asp:TextBox ID="wl_id" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" meta:resourcekey="wl_idResource1"></asp:TextBox>
                                            </HeaderTemplate>--%>
                                            <ItemTemplate>
                                                <asp:Label ID="lblWlID" runat="server" Text='<%# Eval("last_update") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

<%--                                        <asp:BoundField DataField="next_process_id" HeaderText="NextProcessID" Visible="False"  />
                                        <asp:BoundField DataField="process_id" HeaderText="ProcessID" Visible="False"  />--%>

                                  <%--      <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource13">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnpending" runat="server" CssClass="btn btn-primary btn-sm pull-right" ToolTip="Pending List"  Text="
                                                        &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-right&quot;&gt;&lt;/i&gt;
                                                " ></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:LinkButton ID="btnPending" runat="server"
                                                    ToolTip="Add to Pending" CssClass="btn btn-primary btn-sm pull-right" CommandName="addpending" CommandArgument='<%# Eval("wl_id") %>'  OnClientClick="javascript:return confirm('Are you sure add to pending?');" meta:resourcekey="btnPendingResource2" Text="
                                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-left&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>
                                    </Columns>
                                    <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                
                    </div>
                <div id="myModal" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="t4" class="modal-title" runat="server">
                            <asp:Localize ID="Localize3" runat="server" meta:resourcekey="Localize3Resource1" Text="تفاصيل الطلب"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         <div class="form-group">
                             <div class="col-sm-12">
                        <uc1:ucCustomerInfo runat="server" id="ucCustomerInfo" />
                       </div>
                             </div>
                         
                         <div class="form-group">
                               <div class="col-sm-12">
                         <asp:Label ID="Label7" runat="server" Text="الموافقات" Font-Bold="True" ></asp:Label>
                        <div class="form-group">
                                  <div style="height:350px;overflow:auto">
                                 <uc1:ucApprovals runat="server" id="ucApprovals" />
                                      </div>
                                </div>
                                   </div>
                             </div>
                         <hr />
                        <br />
                        
                        
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>
                    </div>

                </div>
            </div>
        </div>

                </ContentTemplate>
            </asp:UpdatePanel>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>
  
      

Contents of ucQualityCancelled.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucQualityCancelled

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''grdWL control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdWL As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''t4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents t4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize3 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucCustomerInfo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucCustomerInfo As Global.EnjazVB.ucCustomerInfo

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ucApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucApprovals As Global.EnjazVB.ucApprovals

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucQualityCancelled.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports WebClass.Sys.Classes
Public Class ucQualityCancelled
    Inherits System.Web.UI.UserControl

    Dim sSql As String = ""


    Private Property PendingFlag As String
        Get
            Return Session("PendingFlag")
        End Get
        Set(value As String)
            Session("PendingFlag") = value
        End Set
    End Property


    Public Property isSupper As Boolean
        Get
            Return Session("isSupper")
        End Get
        Set(value As Boolean)
            Session("isSupper") = value
        End Set
    End Property

    Public Property isSupvisor As Boolean
        Get
            Return Session("isSupvisor")
        End Get
        Set(value As Boolean)
            Session("isSupvisor") = value
        End Set
    End Property

    Private Property RpWLFilterCondition As String
        Get
            Return Session("RpWLFilterCondition")
        End Get
        Set(value As String)
            Session("RpWLFilterCondition") = value
        End Set
    End Property

    Private Property pWLFilterValue As String
        Get
            Return Session("pWLFilterValue")
        End Get
        Set(value As String)
            Session("pWLFilterValue") = value
        End Set
    End Property

    Public Property requestId As String
        Get
            Return ViewState("requestId")
        End Get
        Set(value As String)
            ViewState("requestId") = value
        End Set
    End Property

    Public Property requestOwner As String
        Get
            Return ViewState("requestOwner")
        End Get
        Set(value As String)
            ViewState("requestOwner") = value
        End Set
    End Property

    Public Property isQulity As Boolean
        Get
            Return Session("isQulity")
        End Get
        Set(value As Boolean)
            Session("isQulity") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If
        Try


            If Not IsPostBack Then
                ' grdWL.VirtualItemCount = GetOpenWL(Session("EmpNo").ToString, False)
                ' grdWL.VirtualItemCount = GetOpenWL(Session("emp_no").ToString, False)
                PendingFlag = "N"
                isSupper = IIf(Session("supper_user").ToString = "True", True, False)
                isSupvisor = IIf(GetFieldValue("SELECT IS_SUP FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
                isQulity = IIf(GetFieldValue("SELECT QUALITY FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
                GetPageData(0, 10)
            End If
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)
        End Try
        SetGridStyle(grdWL)
    End Sub

    Protected Sub ddlStatus_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Private Sub GetPageData(pgIndex As Integer, pgSize As Integer)

        Try
            Dim dt As New DataTable
            'If pWLFilterCondition <> "" Then

            sSql = "             "
            sSql = sSql & "   SELECT  ROW_NUMBER() OVER (ORDER BY  Convert(date,doc_date,103) DESC) as srno,a.* FROM (  "
            sSql = sSql & "   select h.doc_no AS REF_ID ,format(h.doc_date,'dd/MM/yyyy')doc_date, REQ_BY AS customer ,h.initempbank,h.CUST_ID, BK.TYPE_DESC AS salary_bank, W.TYPE_dESC AS SEC,H.CONTACT_NO ,s.type_desc as status ,H.STATUS  AS STATUS_CODE,H.ref_procid,ISNULL(H.REF_DOCNO,'O')REF_DOCNO ,H.refcomp_code,ISNULL(H.SERVICE,'F') AS SERVICE,"
            sSql = sSql & "   IK.TYPE_DESC  as INV_bank,h.other5 as investment_amt,h.other6 as readEstateAmt,h.other7 as corporate,e.emp_name,H.EMP_NO,H.dept_head,H.last_update  "
            sSql = sSql & "   from ARS_REQUEST_HDR h WITH (NOLOCK) left join  emp_mst e WITH (NOLOCK)  on h.emp_no=e.emp_no inner join (select * from type_mst WITH (NOLOCK) where type_code='RS') S on h.status=s.type_category  "
            sSql = sSql & "   left join (select * from type_mst WITH (NOLOCK) where type_Code='BK') BK ON H.OTHER1=BK.TYPE_cATEGORY "
            sSql = sSql & "   left join (select * from type_mst WITH (NOLOCK) where type_Code='BK') IK ON H.OTHER4=IK.TYPE_cATEGORY "
            sSql = sSql & "   left join (select * from type_mst WITH (NOLOCK) where type_Code='WE')W ON H.OTHER3=W.TYPE_CATEGORY "
            'sSql = sSql & "   LEFT JOIN  APP_WORKLIST L WITH (NOLOCK)  ON L.WL_ID=(SELECT TOP 1 WL_ID FROM APP_WORKLIST WHERE CLOSED_DATE IS NOT NULL AND  REF_ID=H.DOC_NO  ORDER BY CLOSED_DATE DESC)"
            'sSql = sSql & "   OUTER APPLY (SELECT TOP 1 CLOSED_REMARKS, CLOSED_DATE  FROM APP_WORKLIST WITH (NOLOCK) WHERE CLOSED_DATE IS NOT NULL  and ref_id=H.DOC_NO   ORDER BY CLOSED_DATE DESC)  L  "
            sSql = sSql & "    WHERE     H.STATUS='D' AND H.Q_CANCEL='Y' AND  H.TRAN_TYPE='R' "
            sSql = sSql & "    )a    "
            sSql = sSql & "    where 1=1 "
            If isSupper Or isQulity Then
            Else
                sSql = sSql & " and  (emp_no='" & Session("emp_no").ToString & "' OR  dept_head='" & Session("emp_no").ToString & "'  )  "
            End If
            'sSql = sSql & "    and  (emp_no='" & Session("emp_no").ToString & "'  )  "




            '    sSql = "SELECT WL.*  FROM ("
            '    sSql = sSql & " SELECT ROW_NUMBER() OVER (ORDER BY  WL_DAYS DESC, CAST(WL_ID AS NUMERIC(38, 10)) DESC) SRNO, A.* FROM VOPENWORKLIST A WHERE 1=1 "
            '    sSql = sSql & " AND OWNER='" & Session("emp_no").ToString & "' AND PENDING_FLAG='" & PendingFlag & "'"
            '    sSql = sSql & " AND " & pWLFilterCondition
            '    sSql = sSql & " ) WL"
            '    sSql = sSql & "  WHERE SRNO BETWEEN ((" & pgIndex & "*10)+1) AND ((" & pgIndex & "+1)*" & pgSize & ")"
            '    sSql = sSql & " ORDER BY SRNO"
            'Else
            '    sSql = " SELECT WL.* FROM ("
            '    sSql = sSql & " SELECT ROW_NUMBER() OVER (ORDER BY  WL_DAYS DESC, CAST(WL_ID AS NUMERIC(38, 10)) DESC) SRNO, A.* FROM VOPENWORKLIST A WHERE 1=1"
            '    sSql = sSql & " AND OWNER='" & Session("emp_no").ToString & "' AND PENDING_FLAG='" & PendingFlag & "'"
            '    sSql = sSql & ") WL"
            '    sSql = sSql & " WHERE  "
            '    sSql = sSql & "  SRNO BETWEEN ((" & pgIndex & "*10)+1) AND ((" & pgIndex & "+1)*" & pgSize & ")"
            '    sSql = sSql & " ORDER BY SRNO"
            'End If

            dt = GetTable(sSql)
            Dim dt2 = GetTableCon(sSql, "Enjazcon")

            dt.Merge(dt2)
            Dim sortedResults = From row In dt.AsEnumerable()
                                Order By CDate(row.Field(Of String)("doc_date")) Descending

            dt = dt.Clone() ' Clone the structure (columns) of the original table
            ' Import each sorted row into the new DataTable
            Dim rowNumber As Integer = 1
            For Each row In sortedResults
                row("SRNO") = rowNumber
                dt.ImportRow(row)
                rowNumber += 1
            Next
            dt.AcceptChanges()

            If dt.Rows.Count = 0 Then
                Dim nr As DataRow = dt.NewRow
                'dinesh(17-04-23) add empty values as error rais null values to slect color
                'nr("priority") = ""
                nr("srno") = 0
                dt.Rows.Add(nr)
                dt.AcceptChanges()
            End If
            grdWL.DataSource = dt
            grdWL.DataBind()
            SetGridStyle(grdWL)
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)

        End Try
        RpWLFilterCondition = ""
    End Sub

    Protected Sub grdWL_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles grdWL.PageIndexChanging
        grdWL.PageIndex = e.NewPageIndex
        GetPageData(e.NewPageIndex, 10)
        SetGridStyle(grdWL)
    End Sub


    Protected Sub txtFWL_TextChanged(sender As Object, e As EventArgs)
        Dim strText As String = "", strName As String = ""
        strText = CType(sender, TextBox).Text.ToString
        strName = CType(sender, TextBox).ID.ToString

        pWLFilterValue = strText
        RpWLFilterCondition = ""


        If strText <> "" Then
            If strName = "doc_date" Or strName = "ref_date" Then
                strText = CDate(strText).ToString("dd/MM/yyyy")
                RpWLFilterCondition = " format(" & strName & ") = format('" & strText & "','DD/MM/YYYY')"
            Else
                strText = "N'%" & strText.ToUpper & "%'"
                RpWLFilterCondition = " upper(" & strName & ") Like " & strText
            End If
        End If

        GetPageData(0, 10)
        SetGridStyle(grdWL)
    End Sub


    Private Sub grdWL_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles grdWL.RowDataBound
        If IsNothing(RpWLFilterCondition) Then
            RpWLFilterCondition = ""
        End If

        If e.Row.RowType = DataControlRowType.Header Then
            If RpWLFilterCondition.ToLower.ToString.Contains("(ref_id") Then
                CType(e.Row.FindControl("ref_id"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(customer") Then
                CType(e.Row.FindControl("customer"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(contact_no") Then
                CType(e.Row.FindControl("contact_no"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(sec") Then
                CType(e.Row.FindControl("sec"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(inv_bank") Then
                CType(e.Row.FindControl("inv_bank"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(salary_bank") Then
                CType(e.Row.FindControl("salary_bank"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(doc_date") Then
                'CType(e.Row.FindControl("wl_date"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", CDate(Session("pWLFilterValue")).ToString("yyyy-mm-dd"))
                CType(e.Row.FindControl("doc_date"), TextBox).Text = CDate(Session("pWLFilterValue")).ToString("yyyy-MM-dd")
            End If

            If RpWLFilterCondition.ToLower.ToString.Contains("(emp_name") Then
                CType(e.Row.FindControl("emp_name"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(status") Then
                CType(e.Row.FindControl("status"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If

        End If


        If e.Row.RowType = DataControlRowType.DataRow Then



        End If


        SetGridStyle(grdWL)
    End Sub



    Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O" 'rblWLStatus.SelectedValue.ToString


        Dim sWorklistID As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
        Dim sArgRefID As String = ""
        'sWorklistID = e.CommandArgument 'wl_id
        sWorklistID = e.CommandArgument.ToString.Split(",")(0).ToString
        sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString
        requestId = sArgRefID
        sRefID = ""
        sCurrentProcessCode = ""
        sNextProcessCode = ""
        sPageLink = ""


        'q = "SELECT MODULE_ID,PROCESS_ID,REF_ID,NEXT_PROCESS_ID,PAGELINK FROM APP_WORKLIST WHERE WL_ID='" & sWorklistID & "' AND STATUS='" & wlStatus & "' "


        'Dim dtr = GetTable(q)
        'For Each rdr As DataRow In dtr.Rows
        '    sRefID = rdr("ref_id").ToString
        '    sCurrentProcessCode = rdr("process_id").ToString
        '    sNextProcessCode = rdr("next_process_id").ToString
        '    sPageLink = rdr("pagelink").ToString
        '    sModuleID = rdr("module_id").ToString
        '    Exit For
        'Next

        ' RedirectURL("../pages/ReqDetails.aspx?p1=" & sArgRefID)
        If e.CommandName = "Step" Then
            ucCustomerInfo.DocNo = sArgRefID
            ucApprovals.DocNo = sArgRefID
            ''requestOwner = GetFieldValue("select emp_no from ars_request_hdr where doc_no='" & sArgRefID & "'")
            ''Dim ReqStatus = GetFieldValue("select status from ars_request_hdr where doc_no='" & sArgRefID & "'")
            ''Dim UploadDocStep = GetFieldValue("select WL_ID from APP_WORKLIST where REF_ID='" & sArgRefID & "' AND NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "' AND STATUS='O'")
            ''If requestOwner = Session("emp_no").ToString And ReqStatus <> "D" And ReqStatus <> "C" And (ReqStatus = "N" Or UploadDocStep <> "") Then
            ''    NotesDiv.Visible = True
            ''Else
            ''    NotesDiv.Visible = False
            ''End If
            ' NotesDiv.Visible = True
            OpenModal(Me.Page, "myModal")
            '  OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)
        ElseIf e.CommandName = "Detail" Then

            OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)


            'If sPageLink <> "" Then
            '    ' sPageLink = "../../../" & sModuleID & "/" & Session("Language") & "/" & Replace(sPageLink, "../", "") 'format for the new system
            '    sPageLink = "../../../" & Replace(sPageLink, "../", "") 'format for the new system

            '    If Not sPageLink.ToUpper.Contains(".ASPX") Then
            '        ' clsGenClass.OpenTab(Me.Page, sPageLink & "&ViewMode=" & rblWLStatus.SelectedValue.ToString)
            '        'tkID = clsGenClass.InsertToken("N")
            '        'clsGenClass.OpenTab(Me.Page, sModuleLink & "default.aspx?token=" & tkID.ToString & "&div=" & Session("CompCode") & "&lnk=" & Server.UrlEncode(Replace(sPageLink, "..", Session("Language").ToString) & "&ViewMode=" & rblWLStatus.SelectedValue.ToString))
            '        OpenWorklistPage(Me.Page, sWorklistID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, sPageLink)
            '    Else
            '        OpenTab(Me.Page, sPageLink & "&ViewMode=" & wlStatus, sWorklistID)
            '    End If
            'End If
        ElseIf e.CommandName = "addpending" Then
            ' AddtoPending(e.CommandArgument)
            'AddtoPending(e.CommandArgument.ToString.Split(",")(0).ToString)
            'GetPageData(0, 10)
        End If
        SetGridStyle(grdWL)
    End Sub

    Protected Sub ddlStep_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub btnAddRemarks_Click(sender As Object, e As EventArgs)


        Dim cn As New SqlConnection
        Dim cmd As New SqlCommand
        Dim trans As SqlTransaction

        cn = OpenConnection()
        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        cmd.Connection = cn
        cmd.Transaction = trans

        SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Try

            Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
            AppWl.WL03ProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
            AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
            AppWl.WL05RefID = requestId
            ' AppWl.WL99RefWLID = ViewState("p1")
            AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
            ' AppWl.WL121ClosedRemarks = txtRemarks.Text.ToString
            AppWl.WL11ClosedDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
            AppWl.WL12ClosedBy = Session("user_id").ToString

            AppWl.WL07Priority = "N"
            AppWl.WL08CompCode = AppWl.WL08CompCode
            AppWl.WL09SysUserID = AppWl.WL09SysUserID
            AppWl.WL13Status = "C"

            AppWl.WL14NextProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
            AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
            AppWl.WL16RefStationID = ""
            AppWl.WL17RefTask = ""
            AppWl.WL18RefOther = "R"
            AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper


            ' AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
            AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
            AppWl.WL98OnlyOwner = Session("emp_no").ToString

            'AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
            'AppWl.WL98OnlyOwner = ddlEmployee.SelectedValue.ToString
            AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
            AppWl.WL99ModuleID = "R"
            AppWl.WL99ApprLevel = "0"
            InsertRemarks(cn, cmd, AppWl)
            'InsertNewRemarks(cn, cmd, AppWl)
            'InsertWorklist(cn, cmd, AppWl)

            trans.Commit()
            saveFlag = True
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
            trans.Rollback()

        Finally
            cmd.Dispose()
            trans.Dispose()
            cn.Close()
            cn.Dispose()
        End Try
        If saveFlag = True Then
            'txtRemarks.Text = ""
            CloseModal(Me.Page, "myModal")
            '  RedirectURL("../pages/Worklist.aspx")
            ' ucApprovals.DocNo = requestId
        End If
        GetPageData(0, 0)
    End Sub

    Protected Sub ddlCompPay_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub ddlCustomService_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub
End Class

Contents of ucRealOffers.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucRealOffers.ascx.vb" Inherits="EnjazVB.ucRealOffers" %>
<%@ Register Src="~/Controls/ucRealOffersAdm.ascx" TagPrefix="uc1" TagName="ucRealOffersAdm" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>                
                <div class="form-horizontal">
                     <div class="form-group">
                       <asp:LinkButton ID="btnNewOffer"  runat="server" CssClass="btn btn-primary btn-md" OnClick="btnNewOffer_Click"
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-plus&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;عرض جديد
                                                        "></asp:LinkButton>
                         </div>
                    <div  class="form-group">
                        
                                <div class="col-sm-3">
                                    <asp:DropDownList ID="ddlStatus" OnSelectedIndexChanged="ddlStatus_SelectedIndexChanged1" CssClass="form-control" runat="server" AutoPostBack="True"
                                         >
                                    </asp:DropDownList>
                                </div>

                        <div class="col-sm-3">
                                     <asp:DropDownList ID="ddlRealEstate" OnSelectedIndexChanged="ddlRealEstate_SelectedIndexChanged" runat="server" AutoPostBack="true"  CssClass="form-control" Width="100%">
                                            </asp:DropDownList>
                                    </div>

                         <div class="col-sm-3">
                              <asp:DropDownList ID="ddlCity" OnSelectedIndexChanged="ddlCity_SelectedIndexChanged" CssClass="form-control" runat="server" 
                                  AutoPostBack="True"
                                        >
                                    </asp:DropDownList>
                             </div>

                        
                                <div class="col-sm-3">
                                    <asp:DropDownList ID="ddlDistrict" OnSelectedIndexChanged="ddlDistrict_SelectedIndexChanged" CssClass="form-control" runat="server" AutoPostBack="True"
                                        >
                                    </asp:DropDownList>
                                </div>

                        
                        </div>

                          <div class="form-group">
                        <div style="overflow: auto;">
                            <div style="direction:rtl;" class="table-responsive">
                                <asp:GridView ID="grdOffers"   CssClass="table table-hover table-striped" runat="server" AllowPaging="false" AllowCustomPaging="false" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%" meta:resourcekey="grdWLResource1">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource1">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnRefresh" runat="server" CssClass="btn btn-primary btn-sm pull-right"  ToolTip="Refresh" meta:resourcekey="btnRefreshResource1" Text="
                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-refresh&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblSrNo" runat="server" Text='<%# Eval("srno") %>' meta:resourcekey="lblSrNoResource1"></asp:Label>
<%--                                                <asp:HiddenField ID="hwl_days" runat="server" Value='<%# Eval("wl_days") %>' />--%>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField> 
                                        
                                        
                                           <asp:TemplateField HeaderText="تعديل" >
                                          <ItemTemplate>
                                              <asp:LinkButton ID="btEdit" Enabled="true"  runat="server" OnCommand="btnStep_Command"
                                                Text="<i aria-hidden='true' class='glyphicon glyphicon-pencil'></i>"
                                                    ToolTip="Click to open the details" CommandName="Edit" CommandArgument='<%#String.Concat(Eval("OFFER_ID"), ",", Eval("OFFER_ID"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>
                                        
                                        
                                        <asp:TemplateField HeaderText="رقم العرض" SortExpression="OFFER_ID" >
                                        <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton ID="btnStep" runat="server" OnCommand="btnStep_Command"
                                                     Text='<%# Bind("OFFER_ID") %>'
                                                    ToolTip="Click to open the details" CommandName="Detail" CommandArgument='<%# string.Concat(Eval("OFFER_ID"), ",", Eval("OFFER_ID"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                      <asp:TemplateField HeaderText="المدينة" SortExpression="CITY" >
                                          <ItemTemplate>
                                                <asp:Label ID="lblCITY" runat="server" Text='<%# Eval("CITY") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                          <asp:TemplateField HeaderText="الحي" SortExpression="DISTRICT"  >
                                         <ItemTemplate>
                                                <asp:Label ID="lblDISTRICT" runat="server" Text='<%# Eval("DISTRICT") %>' meta:resourcekey="lblPriorityResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                      
                                        <asp:TemplateField HeaderText="نوع العقار" SortExpression="REALESTATE" >
                                           <ItemTemplate>
                                                <asp:Label ID="lblREALESTATE" runat="server" Text='<%# Eval("REALESTATE") %>'  ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                     <asp:TemplateField HeaderText="المالك" SortExpression="OWNER_NAME" >
                                           <ItemTemplate>
                                                <asp:Label ID="lblOWNER_NAME" runat="server" Text='<%# Eval("OWNER_NAME") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                          

                                        <asp:TemplateField HeaderText="جوال المالك" SortExpression="OWNER_PHONE" >
                                           <ItemTemplate>
                                                <asp:Label ID="lblOWNER_PHONE" runat="server" Text='<%# Eval("OWNER_PHONE") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="الحالة" SortExpression="STATUS" >
                                           <ItemTemplate>
                                                <asp:Label ID="lblSTATUS" runat="server" Text='<%# Eval("STATUS") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>



                                            <asp:TemplateField HeaderText="وصف مختصر"  >
                                         <ItemTemplate>
                                                <asp:Label ID="lblREMARKS" runat="server" Text='<%# Eval("REMARKS") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

<%--                                        <asp:BoundField DataField="next_process_id" HeaderText="NextProcessID" Visible="False"  />
                                        <asp:BoundField DataField="process_id" HeaderText="ProcessID" Visible="False"  />--%>

                                  <%--      <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource13">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnpending" runat="server" CssClass="btn btn-primary btn-sm pull-right" ToolTip="Pending List"  Text="
                                                        &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-right&quot;&gt;&lt;/i&gt;
                                                " ></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:LinkButton ID="btnPending" runat="server"
                                                    ToolTip="Add to Pending" CssClass="btn btn-primary btn-sm pull-right" CommandName="addpending" CommandArgument='<%# Eval("wl_id") %>'  OnClientClick="javascript:return confirm('Are you sure add to pending?');" meta:resourcekey="btnPendingResource2" Text="
                                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-left&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>
                                    </Columns>
                                    <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                
                    </div>
               

                </ContentTemplate>
            </asp:UpdatePanel>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>
  
     

                        <div id="OfferModal" data-backdrop="static" data-keyboard="false" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="H1" class="modal-title" runat="server">
                            <asp:Localize ID="Localize1" runat="server" Text="تفاصيل العرض العقاري"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         <div class="form-group">
                           <uc1:ucRealOffersAdm runat="server" id="ucRealOffersAdm" />
                             </div>
              </div>
 <div class="modal-footer">
     <div class="form-group">
                     <%--   <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>--%>
     </div>               
     </div>

                </div>
            </div>
        </div>

Contents of ucRealOffers.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucRealOffers

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''btnNewOffer control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnNewOffer As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''ddlStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlStatus As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''ddlRealEstate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlRealEstate As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''ddlCity control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCity As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''ddlDistrict control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlDistrict As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''grdOffers control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdOffers As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress

    '''<summary>
    '''H1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H1 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize1 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucRealOffersAdm control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucRealOffersAdm As Global.EnjazVB.ucRealOffersAdm
End Class

Contents of ucRealOffers.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports WebClass.Sys.Classes
Public Class ucRealOffers
    Inherits System.Web.UI.UserControl

    Dim sSql As String = ""
    Dim q = ""


    Private Property PendingFlag As String
        Get
            Return Session("PendingFlag")
        End Get
        Set(value As String)
            Session("PendingFlag") = value
        End Set
    End Property


    Public Property isSupper As Boolean
        Get
            Return Session("isSupper")
        End Get
        Set(value As Boolean)
            Session("isSupper") = value
        End Set
    End Property

    Public Property isSupvisor As Boolean
        Get
            Return Session("isSupvisor")
        End Get
        Set(value As Boolean)
            Session("isSupvisor") = value
        End Set
    End Property

    Public Property Qulity As String
        Get
            Return Session("Qulity")
        End Get
        Set(value As String)
            Session("Qulity") = value
        End Set
    End Property

    Private Property RpWLFilterCondition As String
        Get
            Return Session("RpWLFilterCondition")
        End Get
        Set(value As String)
            Session("RpWLFilterCondition") = value
        End Set
    End Property

    Private Property pWLFilterValue As String
        Get
            Return Session("pWLFilterValue")
        End Get
        Set(value As String)
            Session("pWLFilterValue") = value
        End Set
    End Property



    Public Property requestOwner As String
        Get
            Return ViewState("requestOwner")
        End Get
        Set(value As String)
            ViewState("requestOwner") = value
        End Set
    End Property


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If
        Try


            If Not IsPostBack Then
                ' grdWL.VirtualItemCount = GetOpenWL(Session("EmpNo").ToString, False)
                ' grdWL.VirtualItemCount = GetOpenWL(Session("emp_no").ToString, False)
                Dim q = ""
                q = "SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='RT'  "
                FillComboSelect(ddlRealEstate, Q)

                Q = "SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='CT'  "
                FillComboSelect(ddlCity, Q)

                Q = "SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='OS'  "
                FillComboSelect(ddlStatus, Q)


                PendingFlag = "N"

                Qulity = GetFieldValue("SELECT QUALITY FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'")
                If Qulity = "R" Then
                    grdOffers.Columns(1).Visible = True
                    btnNewOffer.Visible = True
                Else
                    grdOffers.Columns(1).Visible = False
                    btnNewOffer.Visible = False
                End If

                GetPageData(0, 100)
            End If
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)
        End Try
        SetGridStyle(grdOffers)
    End Sub

    Protected Sub btnQuality_Command(sender As Object, e As CommandEventArgs)
        Dim count = 0

        If count > 0 Then
            OpenModal(Me.Page, "QualityModal")
        Else
            ShowPopUpMsg(Me.Page, "فضلا اختر طلب واحد علي الاقل")
        End If
    End Sub


    Protected Sub CLOSEOPENWORKLIST(cmd As SqlCommand, DOCNO As String)
        Dim Q As String = ""
        Q = ""
        Q = Q & " update app_worklist  set status='C',CLOSED_DATE=EnjazVB.GetServerDate(),CLOSED_REMARKS=N'تحويل بواسطة الجودة'  WHERE STATUS IN ('P','O') AND REF_ID='" & DOCNO & "'   "

        cmd.CommandText = Q
        cmd.ExecuteNonQuery()

    End Sub

    Protected Sub ddlStatus_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Private Sub GetPageData(pgIndex As Integer, pgSize As Integer)

        Try
            Dim dt As New DataTable
            'If pWLFilterCondition <> "" Then

            sSql = "             "
            sSql = sSql & "   SELECT  ROW_NUMBER() OVER (ORDER BY  Convert(date,ADD_DATE,103) DESC ) as srno,a.* FROM (  "
            sSql = sSql & "   SELECT H.OFFER_ID  ,FORMAT(H.ADD_DATE,'dd/MM/yyyy')ADD_DATE,OWNER_NAME, OWNER_PHONE ,REMARKS "
            sSql = sSql & "   ,CT.TYPE_DESC AS CITY, DS.TYPE_DESC AS DISTRICT, RT.TYPE_DESC AS REALESTATE,OS.TYPE_DESC AS STATUS "
            sSql = sSql & "   FROM REAL_OFFERS H WITH (NOLOCK) LEFT JOIN  EMP_MST E WITH (NOLOCK)  ON H.EMP_NO=E.EMP_NO  "
            sSql = sSql & "   LEFT JOIN (SELECT * FROM TYPE_MST WITH (NOLOCK) WHERE TYPE_CODE='CT') CT ON H.CITY=CT.TYPE_CATEGORY "
            sSql = sSql & "   LEFT JOIN (SELECT * FROM TYPE_MST WITH (NOLOCK) WHERE TYPE_CODE='DS') DS ON H.DISTRICT=DS.TYPE_CATEGORY "
            sSql = sSql & "   LEFT JOIN (SELECT * FROM TYPE_MST WITH (NOLOCK) WHERE TYPE_CODE='RT')RT ON H.REALESTATE=RT.TYPE_CATEGORY "
            sSql = sSql & "   LEFT JOIN (SELECT * FROM TYPE_MST WITH (NOLOCK) WHERE TYPE_CODE='OS')OS ON H.STATUS=OS.TYPE_CATEGORY "
            sSql = sSql & "   WHERE 1=1  "
            If ddlStatus.SelectedValue <> "" Then
                sSql = sSql & "  AND STATUS='" & ddlStatus.SelectedValue.ToString & "' "
            End If
            If ddlRealEstate.SelectedValue <> "" Then
                sSql = sSql & "   AND REALESTATE='" & ddlRealEstate.SelectedValue.ToString & "'   "
            End If

            If ddlCity.SelectedValue <> "" Then
                sSql = sSql & "   AND CITY='" & ddlCity.SelectedValue.ToString & "'   "
            End If

            If ddlDistrict.SelectedValue <> "" Then
                sSql = sSql & "  AND DISTRICT='" & ddlDistrict.SelectedValue.ToString & "'   "
            End If


            sSql = sSql & "    )A    "
            sSql = sSql & "    WHERE 1=1   "



            dt = GetTable(sSql)

            Dim dt2 = GetTableCon(sSql, "Enjazcon")
            dt.Merge(dt2)
            Dim sortedResults = From row In dt.AsEnumerable()
                                Order By CDate(row.Field(Of String)("ADD_DATE")) Descending

            dt = dt.Clone() ' Clone the structure (columns) of the original table
            ' Import each sorted row into the new DataTable
            Dim rowNumber As Integer = 1
            For Each row In sortedResults
                row("SRNO") = rowNumber
                dt.ImportRow(row)
                rowNumber += 1
            Next
            dt.AcceptChanges()


            If dt.Rows.Count = 0 Then
                Dim nr As DataRow = dt.NewRow
                'dinesh(17-04-23) add empty values as error rais null values to slect color
                'nr("priority") = ""
                nr("srno") = 0
                dt.Rows.Add(nr)
                dt.AcceptChanges()
            End If
            grdOffers.DataSource = dt
            grdOffers.DataBind()
            SetGridStyle(grdOffers)
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)

        End Try
        RpWLFilterCondition = ""
    End Sub

    Protected Sub grdOffers_RowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs) Handles grdOffers.RowEditing

    End Sub
    Protected Sub grdWL_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles grdOffers.PageIndexChanging
        grdOffers.PageIndex = e.NewPageIndex
        GetPageData(e.NewPageIndex, 100)
        SetGridStyle(grdOffers)
    End Sub


    Protected Sub txtFWL_TextChanged(sender As Object, e As EventArgs)
        Dim strText As String = "", strName As String = ""
        strText = CType(sender, TextBox).Text.ToString
        strName = CType(sender, TextBox).ID.ToString

        pWLFilterValue = strText
        RpWLFilterCondition = ""


        If strText <> "" Then
            If strName = "doc_date" Or strName = "ref_date" Then
                strText = CDate(strText).ToString("dd/MM/yyyy")
                RpWLFilterCondition = " format(" & strName & ") = format('" & strText & "','DD/MM/YYYY')"
            Else
                strText = "N'%" & strText.ToUpper & "%'"
                RpWLFilterCondition = " upper(" & strName & ") Like " & strText
            End If
        End If

        GetPageData(0, 100)
        SetGridStyle(grdOffers)
    End Sub


    Private Sub grdOffers_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles grdOffers.RowDataBound
        If IsNothing(RpWLFilterCondition) Then
            RpWLFilterCondition = ""
        End If

        If e.Row.RowType = DataControlRowType.Header Then
            If RpWLFilterCondition.ToLower.ToString.Contains("(offer_id") Then
                CType(e.Row.FindControl("offer_id"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(city") Then
                CType(e.Row.FindControl("city"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(district") Then
                CType(e.Row.FindControl("district"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(realestate") Then
                CType(e.Row.FindControl("REALESTATE"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(owner_name") Then
                CType(e.Row.FindControl("owner_name"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(owner_phone") Then
                CType(e.Row.FindControl("OWNER_PHONE"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If


        End If


        If e.Row.RowType = DataControlRowType.DataRow Then



        End If


        SetGridStyle(grdOffers)
    End Sub



    Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O" 'rblWLStatus.SelectedValue.ToString


        Dim OFFER_ID As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
        Dim sArgRefID As String = ""
        'sWorklistID = e.CommandArgument 'wl_id
        OFFER_ID = e.CommandArgument.ToString.Split(",")(0).ToString
        sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString
        ucRealOffersAdm.OfferId = OFFER_ID
        sRefID = ""
        sCurrentProcessCode = ""
        sNextProcessCode = ""
        sPageLink = ""


        'q = "SELECT MODULE_ID,PROCESS_ID,REF_ID,NEXT_PROCESS_ID,PAGELINK FROM APP_WORKLIST WHERE WL_ID='" & sWorklistID & "' AND STATUS='" & wlStatus & "' "


        'Dim dtr = GetTable(q)
        'For Each rdr As DataRow In dtr.Rows
        '    sRefID = rdr("ref_id").ToString
        '    sCurrentProcessCode = rdr("process_id").ToString
        '    sNextProcessCode = rdr("next_process_id").ToString
        '    sPageLink = rdr("pagelink").ToString
        '    sModuleID = rdr("module_id").ToString
        '    Exit For
        'Next

        ' RedirectURL("../pages/ReqDetails.aspx?p1=" & sArgRefID)
        If e.CommandName = "Detail" Then
            ucRealOffersAdm.EnableControls(False)

            OpenModal(Me.Page, "OfferModal")
            '  OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)

        ElseIf e.CommandName = "Edit" Then
            ucRealOffersAdm.EnableControls(True)
            OpenModal(Me.Page, "OfferModal")
        ElseIf e.CommandName = "Step" Then

            OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)


            'If sPageLink <> "" Then
            '    ' sPageLink = "../../../" & sModuleID & "/" & Session("Language") & "/" & Replace(sPageLink, "../", "") 'format for the new system
            '    sPageLink = "../../../" & Replace(sPageLink, "../", "") 'format for the new system

            '    If Not sPageLink.ToUpper.Contains(".ASPX") Then
            '        ' clsGenClass.OpenTab(Me.Page, sPageLink & "&ViewMode=" & rblWLStatus.SelectedValue.ToString)
            '        'tkID = clsGenClass.InsertToken("N")
            '        'clsGenClass.OpenTab(Me.Page, sModuleLink & "default.aspx?token=" & tkID.ToString & "&div=" & Session("CompCode") & "&lnk=" & Server.UrlEncode(Replace(sPageLink, "..", Session("Language").ToString) & "&ViewMode=" & rblWLStatus.SelectedValue.ToString))
            '        OpenWorklistPage(Me.Page, sWorklistID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, sPageLink)
            '    Else
            '        OpenTab(Me.Page, sPageLink & "&ViewMode=" & wlStatus, sWorklistID)
            '    End If
            'End If
        ElseIf e.CommandName = "addpending" Then
            ' AddtoPending(e.CommandArgument)
            'AddtoPending(e.CommandArgument.ToString.Split(",")(0).ToString)
            'GetPageData(0, 10)
        End If
        SetGridStyle(grdOffers)
    End Sub

    Protected Sub ddlStep_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub


    Protected Sub ddlCompPay_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub ddlCustomService_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub



    Protected Sub btnNewOffer_Click(sender As Object, e As EventArgs)

        ucRealOffersAdm.EnableControls(True)
        ucRealOffersAdm.OfferId = ""
        ucRealOffersAdm.ClearData()
        OpenModal(Me.Page, "OfferModal")
    End Sub

    Protected Sub ddlStatus_SelectedIndexChanged1(sender As Object, e As EventArgs)

        GetPageData(0, 100)
    End Sub

    Protected Sub ddlRealEstate_SelectedIndexChanged(sender As Object, e As EventArgs)

        GetPageData(0, 100)
    End Sub

    Protected Sub ddlCity_SelectedIndexChanged(sender As Object, e As EventArgs)
        Dim q = " SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='DS' AND TYPE_ABBR='" & ddlCity.SelectedValue.ToString & "' ORDER BY PERCENTAGE  "
        FillComboSelect(ddlDistrict, q)
        GetPageData(0, 100)
    End Sub

    Protected Sub ddlDistrict_SelectedIndexChanged(sender As Object, e As EventArgs)

        GetPageData(0, 100)
    End Sub
End Class

Contents of ucRealOffersAdm.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucRealOffersAdm.ascx.vb" Inherits="EnjazVB.ucRealOffersAdm" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>     
<div class="form-group">
                              <div class="col-sm-6">
                                            <asp:Label ID="lbl" runat="server" Text="رقم العرض" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtOfferId" MaxLength="6"  placeholder="فضلا ادخل رقم العرض" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>

                               <div class="col-sm-6">
                         <asp:Label ID="Label1" runat="server" Text="نوع العقار" Font-Bold="True" ></asp:Label>
                          <asp:DropDownList ID="ddlRealEstate"   runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                              </div>
                            </div>


                                       <div class="form-group">
                              <div class="col-sm-6">
                                            <asp:Label ID="Label2" runat="server" Text="المدينة" Font-Bold="True"></asp:Label>
                          <asp:DropDownList ID="ddlCity" AutoPostBack="true" OnSelectedIndexChanged="ddlCity_SelectedIndexChanged"   runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                        </div>

                               <div class="col-sm-6">
                         <asp:Label ID="Label3" runat="server" Text="الحي" Font-Bold="True" ></asp:Label>
                          <asp:DropDownList ID="ddlDistrict"   runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                              </div>
                            </div>


                                   <div class="form-group">
                              <div class="col-sm-6">
                                            <asp:Label ID="Label4" runat="server" Text="المالك" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtOwnerName"  placeholder="فضلا ادخل اسم المالك" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>

                               <div class="col-sm-6">
                         <asp:Label ID="Label5" runat="server" Text="رقم الجوال" Font-Bold="True" ></asp:Label>
              <asp:TextBox ID="txtPhone" MaxLength="10"  placeholder="05xx فضلا ادخل جوال المالك" CssClass="form-control" runat="server"></asp:TextBox>
                              </div>
                            </div>
                   <div runat="server" id="divStatus" class="form-group">
                        <div class="col-sm-6">
                         <asp:Label ID="Label7" runat="server" Text="الحالة" Font-Bold="True" ></asp:Label>
                          <asp:DropDownList ID="ddlstatus"   runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>
                              </div> <div class="col-sm-6"></div>
                       </div>
                         <div class="form-group">
                              <div class="col-sm-12">
                                            <asp:Label ID="Label6" runat="server" Text="وسف مختصر" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtRemarks" TextMode="MultiLine" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                             </div>
                          <div class="form-group">
                           <div class="col-sm-2">
                                    <asp:LinkButton ID="btnSave" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnSave_Click"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; حفظ
                                                        " ></asp:LinkButton> 
                              </div>
                         </div>
                </ContentTemplate>
    </asp:UpdatePanel>

Contents of ucRealOffersAdm.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucRealOffersAdm

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''lbl control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lbl As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtOfferId control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtOfferId As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlRealEstate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlRealEstate As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCity control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCity As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlDistrict control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlDistrict As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtOwnerName control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtOwnerName As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label5 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtPhone control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPhone As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divStatus As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlstatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlstatus As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label6 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRemarks As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton
End Class

Contents of ucRealOffersAdm.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports WebClass.Sys.Classes

Public Class ucRealOffersAdm
    Inherits System.Web.UI.UserControl
    Dim q = ""

    Public Property OfferId As String
        Get
            Return ViewState("OfferId")
        End Get
        Set(value As String)
            ViewState("OfferId") = value
            If value <> "" Then
                q = "SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='RT'  "
                FillComboSelect(ddlRealEstate, q)

                q = "SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='CT'  "
                FillComboSelect(ddlCity, q)

                q = "SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='OS'  "
                FillComboSelect(ddlstatus, q)

                divStatus.Visible = True
                LoadOfferDetails(value)
            Else
                txtOfferId.ReadOnly = False
                divStatus.Visible = False
            End If
        End Set
    End Property

    Public Sub EnableControls(ByVal IsEnable As Boolean)
        txtOfferId.ReadOnly = True
        ddlRealEstate.Enabled = IsEnable
        ddlCity.Enabled = IsEnable
        ddlstatus.Enabled = IsEnable
        ddlDistrict.Enabled = IsEnable
        txtOwnerName.ReadOnly = Not IsEnable
        txtPhone.ReadOnly = Not IsEnable
        txtRemarks.ReadOnly = Not IsEnable
        btnSave.Visible = IsEnable
    End Sub

    Public Sub LoadOfferDetails(ByVal Offer_id As String)
        q = " SELECT * FROM REAL_OFFERS WHERE OFFER_ID='" & Offer_id & "'"
        Dim DT = GetTable(q)
        If DT.Rows.Count = 0 Then
            DT = GetTableCon(q, "Enjazcon")
        End If

        If DT.Rows.Count > 0 Then
            Dim dr = DT(0)
            txtOfferId.Text = dr("OFFER_ID").ToString
            ddlRealEstate.SelectedValue = dr("REALESTATE").ToString
            ddlCity.SelectedValue = dr("CITY").ToString
            ddlCity_SelectedIndexChanged(Nothing, Nothing)
            ddlDistrict.SelectedValue = dr("DISTRICT").ToString
            txtOwnerName.Text = dr("OWNER_NAME").ToString
            txtPhone.Text = dr("OWNER_PHONE").ToString
            txtRemarks.Text = dr("REMARKS").ToString


        End If
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            q = "SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='RT'  "
            FillComboSelect(ddlRealEstate, q)

            q = "SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='CT'  "
            FillComboSelect(ddlCity, q)
        End If
    End Sub

    Protected Sub ddlCity_SelectedIndexChanged(sender As Object, e As EventArgs)

        q = " SELECT TYPE_CATEGORY , TYPE_DESC  FROM TYPE_MST  WHERE TYPE_CODE='DS' AND TYPE_ABBR='" & ddlCity.SelectedValue.ToString & "' ORDER BY PERCENTAGE  "
        FillComboSelect(ddlDistrict, q)
    End Sub

    Public Sub ClearData()
        txtOfferId.Text = ""
        ddlRealEstate.SelectedIndex = -1
        ddlCity.SelectedIndex = -1
        ddlDistrict.SelectedIndex = -1
        ddlstatus.SelectedIndex = -1
        txtOwnerName.Text = ""
        txtPhone.Text = ""
        txtRemarks.Text = ""
    End Sub

    Private Function ValidatePhoneNumber(ByVal phoneNumber As String) As Boolean
        ' Regular expression pattern for Saudi Arabian phone numbers starting with 05 and having 10 digits
        Dim pattern As String = "^05\d{8}$"

        ' Create a Regex object
        Dim regex As New Regex(pattern)

        ' Check if the phone number matches the pattern
        Return regex.IsMatch(phoneNumber)
    End Function


    Protected Sub btnSave_Click(sender As Object, e As EventArgs)

        Dim Q = ""

        Dim saveFlag As Boolean = False



        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        If txtOfferId.Text = "" Then
            MainClass.ShowPopUpMsg(Me.Page, "فضلا تحقق من رقم العرض")
            Exit Sub
        End If

        If ddlRealEstate.SelectedValue = "" Then
            MainClass.ShowPopUpMsg(Me.Page, "فضلا اختر نوع العقار")
            Exit Sub
        End If

        If ddlCity.SelectedValue.ToString = "" Then
            MainClass.ShowPopUpMsg(Me.Page, "فضلا اختر مدينة العقار")
            Exit Sub
        End If

        If ddlDistrict.SelectedValue.ToString = "" Then
            MainClass.ShowPopUpMsg(Me.Page, "فضلا اختر الحي")
            Exit Sub
        End If


        If txtOwnerName.Text = "" Then
            MainClass.ShowPopUpMsg(Me.Page, "فضلا تحقق من اسم المالك")
            Exit Sub
        End If

        If ValidatePhoneNumber(txtPhone.Text) = False Then
            MainClass.ShowPopUpMsg(Me.Page, "فضلا تحقق من جوال المالك")
            Exit Sub
        End If


        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        If OfferId <> "" Then

                            Q = ""
                            Q = Q & "  UPDATE REAL_OFFERS  "
                            Q = Q & "  SET  CITY ='" & ddlCity.SelectedValue.ToString & "',"
                            Q = Q & "   DISTRICT ='" & ddlDistrict.SelectedValue.ToString & "' ,"
                            Q = Q & "   REALESTATE= '" & ddlRealEstate.SelectedValue.ToString & "' ,"
                            Q = Q & "   STATUS= '" & ddlstatus.SelectedValue.ToString & "' ,"
                            Q = Q & "   OWNER_NAME= N'" & txtOwnerName.Text.ToString & "',"
                            Q = Q & "   OWNER_PHONE= N'" & txtPhone.Text & "',"
                            Q = Q & "   REMARKS= N'" & txtRemarks.Text.ToString() & "'"
                            Q = Q & "  WHERE OFFER_ID=  '" & OfferId & "'  "
                            cmd.CommandText = Q
                            cmd.ExecuteNonQuery()

                            RunInOtherDb(Q)
                        Else
                            Q = ""
                            Q = Q & "  INSERT INTO REAL_OFFERS  "
                            Q = Q & "   (OFFER_ID,"
                            Q = Q & "   CITY ,"
                            Q = Q & "   DISTRICT ,"
                            Q = Q & "   REALESTATE,"
                            Q = Q & "   STATUS,"
                            Q = Q & "   OWNER_NAME,"
                            Q = Q & "   OWNER_PHONE,"
                            Q = Q & "   EMP_NO,"
                            Q = Q & "   ADD_DATE,"
                            Q = Q & "   REMARKS"
                            Q = Q & "   ) VALUES "
                            Q = Q & "   ( '" & txtOfferId.Text & "' , "
                            Q = Q & "    '" & ddlCity.SelectedValue.ToString & "' , "
                            Q = Q & "    '" & ddlDistrict.SelectedValue.ToString & "' , "
                            Q = Q & "    '" & ddlRealEstate.SelectedValue.ToString & "' , "
                            Q = Q & "    'O' , "
                            Q = Q & "    N'" & txtOwnerName.Text.ToString & "',  "
                            Q = Q & "    N'" & txtPhone.Text & "' , "
                            Q = Q & "    '" & Session("emp_no").ToString & "' , "
                            Q = Q & "      EnjazVB.GetServerDate(), "
                            Q = Q & "    N'" & txtRemarks.Text.ToString() & "'  "
                            Q = Q & "      "
                            Q = Q & "    ) "
                            cmd.CommandText = Q
                            cmd.ExecuteNonQuery()
                        End If





                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using





        If saveFlag = True Then
            CloseModal(Me.Page, "OfferModal")

            ' ClosePage(Me.Page)
        End If

    End Sub


End Class

Contents of ucReceipt.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucReceipt.ascx.vb" Inherits="EnjazVB.ucReceipt" %>


<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <%-- <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>--%>
    <ContentTemplate>
        <fieldset>
            <legend class="noLegend"></legend>
            <div class="panel panel-primary">
                 <div id="divHeader" runat="server"  class="panel-heading text-center">
                  <h2 id="H2" class="panel-title" runat="server">
                        <asp:Localize ID="headerTxt" runat="server" Text="طلب انشاء سند"></asp:Localize></h2>
                    <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i>
                    </span>
                     </div>
               
                <div class="panel-body">

                    <div class="container-fluid">
                        <div class="form-horizontal">
                            <div style="overflow:no-display">
                                <div style="overflow:auto">
                           <div class="form-group">


                                  <div class="col-sm-12">
                                <div class="col-sm-3">
                                </div>
                                <div class="col-sm-6">

                                    <div runat="server" visible="false" id="DivReqInfo" class="form-group">
                                        <div class="col-sm-6">
                                            <asp:Label ID="Label4" runat="server" Text="رقم الطلب" Font-Bold="True"></asp:Label><span>
                                            <asp:TextBox ID="txtDocNo" ReadOnly="true"  CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                        <div class="col-sm-6">
                                            <asp:Label ID="Label5" runat="server" Text="تاريخ الطلب" Font-Bold="True"></asp:Label><span>
                                            <asp:TextBox ID="txtDocDate" TextMode="Date"   ReadOnly="true"  CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                                 <div runat="server" id="divCustomerdll" class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label2" runat="server" Text="العميل" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlCustomer" AutoPostBack="true" OnSelectedIndexChanged="ddlCustomer_SelectedIndexChanged" runat="server" CssClass="form-control" Width="100%">
                                               </asp:DropDownList>
                                       </div>
                                    </div>
                                    
                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="LabelRequestedBy" runat="server" Text="الاسم كما في الهوية" Font-Bold="True"></asp:Label><span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtname" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtname" placeholder="فضلا ادخل الاسم" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>
                                     <div class="form-group">
                                        <div runat="server" id="iqamaDiv" class="col-sm-8">
                                            <asp:Label ID="Label1" runat="server" Text="رقم الهوية" Font-Bold="True"></asp:Label><span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" ControlToValidate="txtIqama" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtIqama" placeholder="فضلا ادخل رقم الهوية" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>

                                           <div runat="server" id="btnCustDiv" visible="false" class="col-sm-4">
                                            <asp:Label ID="Label8" runat="server" Text="مرجع الطلب" Font-Bold="True"></asp:Label>
                                                <asp:LinkButton ID="btCustomerReq"  runat="server" CssClass="btn btn-primary btn-md" OnClick="btCustomerReq_Click"
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-repeat&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;طلب التمويل
                                                        "></asp:LinkButton>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="LabelRequestID" runat="server" Text="رقم جوال ابشر" Font-Bold="True"></asp:Label><span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtPhone" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <span>
                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                                                    ControlToValidate="txtPhone" ErrorMessage="تحقق من رقم الجوال" ForeColor="Red"
                                                    ValidationExpression="[0-9]{10}"></asp:RegularExpressionValidator>
                                            </span>
                                            <asp:TextBox ID="txtPhone" TextMode="Number" MaxLength="10" placeholder="05 فضلا رقم الجوال" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                                      <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="LabelRequestedDate" runat="server" Text="المبلغ" Font-Bold="True"></asp:Label>
                                            <span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="txtsalary" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtsalary" TextMode="Number" placeholder="فضلا ادخل المبلغ" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                                    <div id="divEmployee" visible="false" runat="server" class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label3" runat="server" Text="المندوب" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList Enabled="false" ID="ddlEmployee" runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>
                                       </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="LabelRemarks" runat="server" Text="ملاحظة او تعليق" Font-Bold="True" ></asp:Label>
                                          
                                    
                                    <asp:TextBox ID="txtProcRemarks" CssClass="form-control" runat="server" TextMode="MultiLine" ></asp:TextBox>
                                </div>
                                        </div>

                                     <div runat="server" id="divCancel" visible="false" class="form-group">
                                        <div class="col-sm-12">
                                  <asp:Label ID="Label7" runat="server" Text="سبب الالغاء" Font-Bold="True" ></asp:Label>
                                    <asp:TextBox ID="txtCancelReason" CssClass="form-control" runat="server" TextMode="MultiLine" ></asp:TextBox>
                                </div>
                                        </div>

                                        <div visible="false" runat="server" id="divAttach" class="form-group">
                                        <div class="col-sm-6">
                                      <asp:Label ID="Label6" runat="server" Text="ارفاق السند" Font-Bold="True" ></asp:Label>
                                   </div>
                                            <div class="col-sm-6">
                                            <asp:FileUpload ID="up" runat="server"  AllowMultiple="false" CssClass="btn btn-default btn-md" Width="100%" meta:resourcekey="upResource1" />
                                     </div>
                                            
                                        </div>
                                  

                                    

                                   

                             
                    
                                    <br />

                                    <div class="form-group">
                                        <div class="col-sm-12">
                                        </div>
                                    </div>


                                    <div class="form-group">
                                        <div class="col-sm-8">
                                            <asp:LinkButton ID="btnSave"  runat="server" CssClass="btn btn-primary btn-md" OnClick="btnSave_Click"
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                        "></asp:LinkButton>

                                            <asp:LinkButton ID="btnCancel" Visible="false" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnCancel_Click"
                                                                             OnClientClick="if (confirm('هل تريد إلغاء الطلب بالفعل ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; الغاء
                                                        " ></asp:LinkButton>
                                          
                                           <%--   <asp:LinkButton ID="btnCopy"  onclick="CopyToClipboard();"  style="background:#C5B358;border-color:#BF953F;"  runat="server" CssClass="btn btn-primary btn-md" 
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; حفظ
                                                        "></asp:LinkButton>--%>

                                    
                                        </div>


                                    </div>

                                </div>
                                <div class="col-sm-3">
                                </div>
                                      </div>

                           
                               </div>
                                </div>
                                </div>

                            
 </div>
                    </div>
                </div>
            </div>
        </fieldset>
    </ContentTemplate>
     <Triggers>
        <asp:PostBackTrigger ControlID="btnSave"  />
     <%--   <asp:AsyncPostBackTrigger ControlID ="btnUpload" EventName="Click" />--%>
    </Triggers>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>



Contents of ucReceipt.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucReceipt

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''divHeader control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divHeader As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''H2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H2 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''headerTxt control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents headerTxt As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''DivReqInfo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents DivReqInfo As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtDocNo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDocNo As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label5 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtDocDate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDocDate As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divCustomerdll control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCustomerdll As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCustomer control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCustomer As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''LabelRequestedBy control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestedBy As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator1 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtname control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtname As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''iqamaDiv control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents iqamaDiv As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator4 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtIqama control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtIqama As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnCustDiv control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnCustDiv As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label8 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label8 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btCustomerReq control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btCustomerReq As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''LabelRequestID control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestID As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator2 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''RegularExpressionValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RegularExpressionValidator1 As Global.System.Web.UI.WebControls.RegularExpressionValidator

    '''<summary>
    '''txtPhone control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPhone As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''LabelRequestedDate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestedDate As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator3 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtsalary control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtsalary As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divEmployee control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divEmployee As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlEmployee control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlEmployee As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''LabelRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRemarks As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtProcRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtProcRemarks As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCancel As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCancelReason control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCancelReason As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divAttach control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divAttach As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label6 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''up control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents up As Global.System.Web.UI.WebControls.FileUpload

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnCancel As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucReceipt.ascx.vb:

Imports Oracle.ManagedDataAccess.Client
Imports WebClass.Sys.Classes
Imports WebClass.Sys.webclass.mainclass
Imports WebClass.Sys.Classes.clsGlobarVar
Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization

Public Class ucReceipt
    Inherits System.Web.UI.UserControl
    Dim q As String = ""

    Public Property DocNo As String
        Get
            Return ViewState("DocNo")
        End Get
        Set(value As String)
            ViewState("DocNo") = value
        End Set
    End Property
    Public Property WorklistId As String
        Get
            Return ViewState("WorklistId")
        End Get
        Set(value As String)
            ViewState("WorklistId") = value
        End Set
    End Property

    Public Property PageProcessId As String
        Get
            Return ViewState("PageProcessId")
        End Get
        Set(value As String)
            ViewState("PageProcessId") = value
        End Set
    End Property

    Public Property PageProcessDesc As String
        Get
            Return ViewState("PageProcessDesc")
        End Get
        Set(value As String)
            ViewState("PageProcessDesc") = value
        End Set
    End Property

    Public Property RefDocNO As String
        Get
            Return ViewState("RefDocNO")
        End Get
        Set(value As String)
            ViewState("RefDocNO") = value
        End Set
    End Property

    Public Property OrigProcessID As String
        Get
            Return ViewState("OrigProcessID")
        End Get
        Set(value As String)
            ViewState("OrigProcessID") = value
        End Set
    End Property


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If

        If Not IsPostBack Then


            If Not (Request.QueryString("P1")) Is Nothing Then
                WorklistId = Request.QueryString("P1").ToString
                DocNo = GetFieldValue("SELECT REF_ID FROM APP_WORKLIST WHERE WL_ID='" & WorklistId & "'  ")
                If DocNo = "" Then
                    DocNo = GetFieldValueCon("SELECT REF_ID FROM APP_WORKLIST WHERE WL_ID='" & WorklistId & "'  ", "Enjazcon")
                End If
                OrigProcessID = GetFieldValue("SELECT REQ_TYPE FROM ARS_REQUEST_HDR WHERE DOC_NO='" & DocNo & "' ")
                If OrigProcessID = "" Then
                    OrigProcessID = GetFieldValueCon("SELECT REQ_TYPE FROM ARS_REQUEST_HDR WHERE DOC_NO='" & DocNo & "' ", "Enjazcon")
                End If
            End If
            If Not (Request.QueryString("P2")) Is Nothing Then
                PageProcessId = Request.QueryString("P2").ToString
            End If
            If Not (Request.QueryString("DocNo")) Is Nothing Then
                DocNo = Request.QueryString("DocNo").ToString
            End If
            PageProcessDesc = GetFieldValue("SELECT PROCESS_DESC FROM APP_PROCESSES WHERE PROCESS_ID='" & PageProcessId & "'")
            headerTxt.Text = PageProcessDesc
            If PageProcessId = AppProcess.ProcCreateReceipt.ToString.ToUpper Then
                divCustomerdll.Visible = True
                ddlCustomer.Enabled = True
                txtname.ReadOnly = False
                txtPhone.ReadOnly = False
                txtIqama.ReadOnly = False
                txtsalary.ReadOnly = False
                txtProcRemarks.ReadOnly = False
                DivReqInfo.Visible = False
                divEmployee.Visible = False
                divAttach.Visible = False
                btnCancel.Visible = False
                iqamaDiv.Attributes.Add("class", "col-sm-12")
                'FillComboSelect(ddlCustomer, "SELECT DOC_NO , REQ_BY FROM ARS_REQUEST_HDR WHERE STATUS='O' AND EMP_NO='" & Session("emp_no").ToString & "'  AND TRAN_TYPE='R' ")
                Dim dtCust = GetTable("SELECT DOC_NO , REQ_BY FROM ARS_REQUEST_HDR WHERE STATUS='O' AND EMP_NO='" & Session("emp_no").ToString & "'  AND TRAN_TYPE='R' ")
                dtCust.Merge(GetTableCon("SELECT DOC_NO , REQ_BY FROM ARS_REQUEST_HDR WHERE STATUS='O' AND EMP_NO='" & Session("emp_no").ToString & "'  AND TRAN_TYPE='R' ", "Enjazcon"))
                dtCust.AcceptChanges()
                FillComboSelectDt(ddlCustomer, dtCust)
            Else

                If PageProcessId = AppProcess.ProcCancelReceipt.ToString.ToUpper Then
                    ' FillComboSelect(ddlCustomer, "SELECT DOC_NO , REQ_BY FROM ARS_REQUEST_HDR WHERE STATUS='C' AND  REQ_TYPE='" & AppProcess.ProcCreateReceipt.ToString.ToUpper & "' AND EMP_NO='" & Session("emp_no").ToString & "' AND TRAN_TYPE='AC' AND DOC_NO='" & DocNo & "'  ")

                    Dim dtCust = GetTable("SELECT DOC_NO , REQ_BY FROM ARS_REQUEST_HDR WHERE STATUS='C' AND  REQ_TYPE='" & AppProcess.ProcCreateReceipt.ToString.ToUpper & "' AND EMP_NO='" & Session("emp_no").ToString & "' AND TRAN_TYPE='AC' AND DOC_NO='" & DocNo & "'  ")
                    dtCust.Merge(GetTableCon("SELECT DOC_NO , REQ_BY FROM ARS_REQUEST_HDR WHERE STATUS='C' AND  REQ_TYPE='" & AppProcess.ProcCreateReceipt.ToString.ToUpper & "' AND EMP_NO='" & Session("emp_no").ToString & "' AND TRAN_TYPE='AC' AND DOC_NO='" & DocNo & "'  ", "Enjazcon"))
                    dtCust.AcceptChanges()
                    FillComboSelectDt(ddlCustomer, dtCust)

                    ddlCustomer_SelectedIndexChanged(Nothing, Nothing)
                    txtProcRemarks.ReadOnly = False
                    DivReqInfo.Visible = False
                    divEmployee.Visible = False
                    divAttach.Visible = False
                    btnCancel.Visible = False
                    divCustomerdll.Visible = True
                    ddlCustomer.Enabled = True
                    iqamaDiv.Attributes.Add("class", "col-sm-12")
                Else
                    iqamaDiv.Attributes.Add("class", "col-sm-8")
                    btnCustDiv.Visible = True
                    divCustomerdll.Visible = False
                    ddlCustomer.Enabled = False
                    DivReqInfo.Visible = True
                    divEmployee.Visible = True
                    txtProcRemarks.ReadOnly = True
                    If PageProcessId = AppProcess.PROCRECEIPTCONFIRM.ToString.ToUpper Then
                        divAttach.Visible = True
                    Else
                        divAttach.Visible = False
                    End If
                    btnCancel.Visible = True
                    loadData()
                End If

                txtname.ReadOnly = True
                txtPhone.ReadOnly = True
                txtIqama.ReadOnly = True
                txtsalary.ReadOnly = True

            End If
            If PageProcessId = AppProcess.APPROVAL.ToString.ToUpper Or PageProcessId = AppProcess.PROCRECEIPTCONFIRM.ToString.ToUpper Then
                btnSave.Text = btnSave.Text & "موافقة "
            Else
                btnSave.Text = btnSave.Text & "حفظ "
                ' btnSave.Text = "&lt;i aria-hidden=&quot;true&quot;class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تم رفع الطلب"
            End If
            FillComboSelect(ddlEmployee, "SELECT EMP_NO , EMP_NAME FROM EMP_MST  ")



            End If
    End Sub

    Protected Sub btTest_Click(sender As Object, e As EventArgs)
        ' ShowPopUpMsg(Me.Page, GetFieldValue("select ref_id from app_worklist"))
        ' Dim currentDate As String = "13/09/2020"
        ' Dim convertedDate As DateTime = DateTime.ParseExact(currentDate, "dd/MM/yyyy", CultureInfo.InvariantCulture)

        ' Convert.ToDateTime(currentDate)
        ShowPopUpMsg(Me.Page, CDate(GetServerDate("", "")).ToString("dd/MM/yyyy"))
    End Sub
    Private Sub loadData()
        q = ""
        q = q & "  SELECT * FROM ARS_REQUEST_HDR WHERE DOC_NO='" & DocNo & "' "
        Dim DT = GetTable(q)
        If DT.Rows.Count = 0 Then
            DT = GetTableCon(q, "Enjazcon")
        End If
        Dim dr = DT(0)
        txtDocDate.Text = CDate(dr("DOC_DATE").ToString).ToString("yyyy-MM-dd")
        txtDocNo.Text = dr("DOC_NO").ToString
        txtPhone.Text = dr("CONTACT_NO").ToString
        txtProcRemarks.Text = dr("REMARKS").ToString
        txtsalary.Text = dr("OTHER2").ToString
        txtIqama.Text = dr("CUST_ID").ToString
        txtname.Text = dr("REQ_BY").ToString
        RefDocNO = dr("REF_DOCNO").ToString
        ddlEmployee.SelectedValue = dr("EMP_NO").ToString
    End Sub
    Protected Sub btnSave_Click(sender As Object, e As EventArgs)
        If PageProcessId = AppProcess.ProcCreateReceipt.ToString.ToUpper Or PageProcessId = AppProcess.ProcCancelReceipt.ToString.ToUpper Then

            If ddlCustomer.SelectedValue = "" Then
                ShowPopUpMsg(Me.Page, "فضلا اختر العميل من القائمة ")
                Exit Sub
            End If

            If txtname.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل الاسم")
                Exit Sub
            End If
            If txtname.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل الاسم")
                Exit Sub
            End If
            If txtPhone.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل الجوال")
                Exit Sub
            End If
            If txtsalary.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل المبلغ")
                Exit Sub
            End If
            If txtProcRemarks.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا اكتب ملاحظة او تعليق")
                Exit Sub
            End If

            Dim chkCustReq = GetFieldValue("SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE STATUS<>'D' AND REF_DOCNO= '" & ddlCustomer.SelectedValue & "' ")
            If chkCustReq = "" Then
                chkCustReq = GetFieldValueCon("SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE STATUS<>'D' AND REF_DOCNO= '" & ddlCustomer.SelectedValue & "' ", "Enjazcon")
            End If
            If chkCustReq <> "" Then
                ShowPopUpMsg(Me.Page, "هناك طلب  لهذا العميل")
                Exit Sub
            End If

        End If
        If PageProcessId = AppProcess.PROCRECEIPTCONFIRM.ToString.ToUpper And OrigProcessID = AppProcess.ProcCreateReceipt.ToString.ToUpper Then
            If up.HasFiles Then
            Else
                ShowPopUpMsg(Me.Page, "فضلا قم بارفاق السند")
                Exit Sub
            End If
        End If



        'Dim cn As New SqlConnection
        '    Dim cmd As New SqlCommand
        '    Dim trans As SqlTransaction

        '    cn = OpenConnection()
        '    trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        '    cmd.Connection = cn
        '    cmd.Transaction = trans

        '    SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)


                        btnSave.Enabled = False

                        ViewState("ServerDate") = GetServerDate(cn, cmd)
                        If PageProcessId = AppProcess.ProcCreateReceipt.ToString.ToUpper Or PageProcessId = AppProcess.ProcCancelReceipt.ToString.ToUpper Then
                            DocNo = GetSeries(cn, cmd, "AC")
                            q = ""
                            q = q & "  INSERT INTO ars_request_hdr  "
                            q = q & "  ( "
                            q = q & "       tran_type, "
                            q = q & "       doc_no, "
                            q = q & "       doc_date, "
                            q = q & "       REQ_DATE ,"
                            q = q & "        yr ,"
                            q = q & "       REQ_TYPE ,"
                            q = q & "      emp_no, "
                            q = q & "       br_assign, "
                            q = q & "      dept_head, "
                            q = q & "       CUST_ID, "
                            q = q & "      req_action, "
                            q = q & "       req_by, "
                            q = q & "      status, "
                            q = q & "      subject, "
                            q = q & "      contact_no, "
                            q = q & "      other2, "
                            q = q & "      REF_DOCNO, "
                            q = q & "      sys_userid, "
                            q = q & "      comp_code, "
                            q = q & "      refcomp_code , "
                            q = q & "      REMARKS "
                            q = q & " ) "
                            q = q & " VALUES ("
                            q = q & "      'AC',"
                            q = q & "      @doc_no,"
                            q = q & "      FORMAT(convert(date,'" & CDate(ViewState("ServerDate")) & "'),'dd/MM/yyyy') , "
                            q = q & "      '" & CDate(ViewState("ServerDate")).ToString("dd/MM/yyyy") & "' , "
                            q = q & "      '" & CInt(CDate(ViewState("ServerDate")).ToString("yyyy")) & "' , "
                            q = q & "      '" & PageProcessId & "' , "
                            q = q & "      '" & Session("emp_no").ToString & "',"
                            q = q & "      '',"
                            q = q & "      '" & GetFieldValue(cn, cmd, "select sup from emp_mst where emp_no='" & Session("emp_no").ToString & "'") & "',"
                            q = q & "      N'" & txtIqama.Text & "',"
                            q = q & "     '1',"
                            q = q & "      N'" & txtname.Text & "',"
                            q = q & "      'O',"
                            q = q & "      N'" & PageProcessDesc & "',"
                            q = q & "      N'" & txtPhone.Text & "', "
                            q = q & "      N'" & txtsalary.Text & "', "
                            q = q & "      N'" & ddlCustomer.SelectedValue.ToString & "', "
                            q = q & "      '" & Session("user_id").ToString() & "',"
                            q = q & "      '',"
                            q = q & "      '' ,"
                            q = q & "      N'" & txtProcRemarks.Text & "' "
                            q = q & "      ) "
                            cmd.CommandText = q
                            If q.ToString.ToUpper.Contains("DELETE") Or q.ToString.ToUpper.Contains("UPDATE") Or q.ToString.ToUpper.Contains("DROP") Or q.ToString.ToUpper.Contains("TRUNCATE") Then
                                Throw New Exception("try again !")
                            End If
                            cmd.Parameters.AddWithValue("@doc_no", DocNo)
                            cmd.ExecuteNonQuery()
                        End If

                        If PageProcessId = AppProcess.ProcCreateReceipt.ToString.ToUpper Or PageProcessId = AppProcess.ProcCancelReceipt.ToString.ToUpper Or PageProcessId = AppProcess.APPROVAL.ToString.ToUpper Then
                            Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                            AppWl.WL03ProcessCode = PageProcessId
                            AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                            AppWl.WL05RefID = DocNo
                            ' AppWl.WL99RefWLID = ViewState("p1")
                            AppWl.WL06RefDate = CDate(ViewState("ServerDate")).ToString("dd/MM/yyyy")
                            AppWl.WL07Priority = "N"
                            AppWl.WL08CompCode = AppWl.WL08CompCode
                            AppWl.WL09SysUserID = AppWl.WL09SysUserID
                            AppWl.WL13Status = "O"

                            If PageProcessId = AppProcess.ProcCreateReceipt.ToString.ToUpper Or PageProcessId = AppProcess.ProcCancelReceipt.ToString.ToUpper Then
                                AppWl.WL14NextProcessCode = AppProcess.APPROVAL.ToString.ToUpper
                                AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & ":" & GetProcessDesc(cn, cmd, PageProcessId)
                            ElseIf PageProcessId = AppProcess.APPROVAL.ToString.ToUpper Then
                                AppWl.WL14NextProcessCode = AppProcess.PROCRECEIPTCONFIRM.ToString.ToUpper
                                'AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & ":" & GetProcessDesc(cn, cmd, PageProcessId)
                                AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & ":" & GetProcessDesc(cn, cmd, OrigProcessID)
                            End If


                            AppWl.WL16RefStationID = ""
                            AppWl.WL17RefTask = ""
                            AppWl.WL18RefOther = "R"
                            If PageProcessId = AppProcess.ProcCreateReceipt.ToString.ToUpper Or PageProcessId = AppProcess.ProcCancelReceipt.ToString.ToUpper Then
                                AppWl.WL99OrigProcessID = PageProcessId
                            Else
                                AppWl.WL99OrigProcessID = OrigProcessID
                            End If
                            If AppWl.WL14NextProcessCode <> AppProcess.PROCRECEIPTCONFIRM.ToString.ToUpper Then
                                AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.Predefined
                                AppWl.WL99Owners = GetTable(cn, cmd, "SELECT EMP_NO FROM APP_PROCESS_OWNER  WHERE PROCESS_ID='" & AppWl.WL14NextProcessCode & "' UNION  select  ISNULL(sup,EMP_NO) from emp_mst where emp_no='" & Session("emp_no").ToString & "' ")
                            Else
                                AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                            End If
                            AppWl.WL99PageLink = "../Pages/Receipt.aspx"
                            AppWl.WL99ModuleID = "R"
                            AppWl.WL99ApprLevel = "0"
                            InsertWorklist(cn, cmd, AppWl)
                        End If

                        If PageProcessId = AppProcess.PROCRECEIPTCONFIRM.ToString.ToUpper Then
                            If up.HasFiles Then
                                Dim g As String = ""
                                Dim UpOK As Boolean = False
                                Dim NewFile As String = ""
                                Dim imgPath As String = ""

                                Dim imgSize As Integer = 0

                                Dim i As Integer = 0
                                For Each postedFile As HttpPostedFile In up.PostedFiles

                                    imgSize = up.PostedFile.ContentLength
                                    g = Guid.NewGuid().ToString
                                    NewFile = g & Mid(up.FileName, up.FileName.LastIndexOf(".") + 1, 4)

                                    If postedFile.ContentLength > 4000000 Then
                                        Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "Alert", "alert('File is too big.')", True)
                                    Else
                                        postedFile.SaveAs(Server.MapPath("~/ImageStorage/" & NewFile))
                                    End If

                                    Dim q As String = ""


                                    q = " insert into app_upload_mst (doc_type, "
                                    q = q & "                         doc_no, "
                                    q = q & "                         sr_no, "
                                    q = q & "                         doc_desc, "
                                    q = q & "                         filename, sys_date, sys_userid) "
                                    q = q & "   values   ('DCOTHERS', "
                                    q = q & "             '" & DocNo & "', "
                                    q = q & "             (select isnull(max(sr_no),0) + 1 from APP_UPLOAD_MST where doc_no='" & DocNo & "'), "
                                    q = q & "             N'سند - حسابات', "
                                    q = q & "             '" & NewFile & "', EnjazVB.GetServerDate(),'" & Session("user_id") & "') "

                                    cmd.CommandText = q
                                    cmd.ExecuteNonQuery()
                                    i = i + 1

                                Next
                            End If

                            q = ""
                            q = q & " UPDATE ARS_REQUEST_HDR SET STATUS='C' "
                            q = q & " WHERE DOC_NO = '" & DocNo & "'   "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(q)
                        End If

                        If Not WorklistId Is Nothing Then
                            CloseWorklist(cn, cmd, WorklistId, Session("user_id").ToString, "C", "")
                        End If
                    End Using
                    trans.Commit()
                    saveFlag = True

                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    '  cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            If PageProcessId = AppProcess.ProcCreateReceipt.ToString.ToUpper Or PageProcessId = AppProcess.ProcCancelReceipt.ToString.ToUpper Then
                ShowPopUpMsg(Me.Page, "تم رفع الطلب بنجاح ")
                RedirectURL("../pages/Worklist.aspx")
            Else
                ClosePage(Me.Page)
            End If
        End If

    End Sub



    Protected Sub btnCopy_Click(sender As Object, e As EventArgs)
        ' Clipboard.SetText("")
        ' My.Computer.Clipboard.SetText("This is a test string.")
        ' Clipboard.SetText("")
    End Sub

    Protected Sub btnCancel_Click(sender As Object, e As EventArgs)
        divCancel.Visible = True
        If txtCancelReason.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اكتب سبب الغاء الطلب")
            Exit Sub
        End If
        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        CloseWorklist(cn, cmd, WorklistId, Session("user_id").ToString, "C", txtCancelReason.Text)
                        q = ""
                        q = q & " update ars_request_hdr set STATUS='D' where doc_no= '" & DocNo & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()

                        RunInOtherDb(q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            'RedirectURL("../pages/Worklist.aspx")
            ClosePage(Me.Page)
        End If
    End Sub

    Protected Sub ddlCustomer_SelectedIndexChanged(sender As Object, e As EventArgs)
        q = ""
        q = q & "  SELECT * FROM ARS_REQUEST_HDR WHERE DOC_NO='" & ddlCustomer.SelectedValue.ToString & "' "
        Dim DT = GetTable(q)
        If DT.Rows.Count = 0 Then
            DT = GetTableCon(q, "Enjazcon")
        End If
        If DT.Rows.Count > 0 Then
            Dim dr = DT(0)
            txtPhone.Text = dr("CONTACT_NO").ToString
            txtIqama.Text = dr("CUST_ID").ToString
            txtname.Text = dr("REQ_BY").ToString
            If PageProcessId = AppProcess.ProcCancelReceipt.ToString.ToUpper Then
                txtsalary.Text = dr("OTHER2").ToString
            End If
        Else
                txtPhone.Text = ""
            txtIqama.Text = ""
            txtname.Text = ""
            txtsalary.Text = ""
        End If
    End Sub

    Protected Sub btCustomerReq_Click(sender As Object, e As EventArgs)
        Dim sArgRefID As String = ""
        If OrigProcessID = AppProcess.ProcCreateReceipt.ToString.ToUpper Then
            sArgRefID = RefDocNO
        Else
            sArgRefID = GetFieldValue("SELECT REF_DOCNO FROM ARS_REQUEST_HDR WHERE DOC_NO='" & RefDocNO & "'")
            If sArgRefID = "" Then
                sArgRefID = GetFieldValueCon("SELECT REF_DOCNO FROM ARS_REQUEST_HDR WHERE DOC_NO='" & RefDocNO & "'", "Enjazcon")
            End If
        End If
        OpenWorklistPage(Me.Page, sArgRefID, "", "", sArgRefID, "O", "../pages/ReqDetails.aspx?p1=" & sArgRefID & "&p2=" & "RT")
    End Sub

    Public Shared Sub FillComboSelectDt(ByVal _cmb As DropDownList, ByVal dtData As DataTable)
        Dim _dt As DataTable

        _dt = dtData
        _cmb.DataSource = _dt
        _cmb.DataValueField = _dt.Columns(0).ColumnName
        _cmb.DataTextField = _dt.Columns(1).ColumnName
        _cmb.DataBind()

        Dim li As ListItem = New ListItem("-فضلا اختر-", "")
        _cmb.Items.Insert(0, li)
    End Sub


End Class

Contents of ucReceipt1.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucReceipt1.ascx.vb" Inherits="EnjazVB.ucReceipt1" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>

       
         <div  class="col-sm-12">
                               
                              <div  class="form-group" >
                                      <div class="col-sm-12">
                                         <div class="row justify-content-center">
                                     <div class="col-sm-1">
                                         </div>
                              <div class="col-sm-4">
                                                <asp:Label ID="Label2" runat="server" Text="الخدمة المطلوبة" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlCustomer" AutoPostBack="true"  runat="server" CssClass="form-control" Width="100%">
                                            </asp:DropDownList>
                                       </div>

                                      <div class="col-sm-2">
                                         </div>

                                      <div class="col-sm-4">
                                <asp:Label ID="LabelRequestedBy" runat="server" Text="الاسم كما في الهوية الوطنية" Font-Bold="True"></asp:Label><span>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtname" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtname" placeholder="فضلا ادخل الاسم" CssClass="form-control" runat="server"></asp:TextBox>
                                         </div>
                                      <div class="col-sm-1">
                                         </div>
</div>
</div>
                                    </div>
                                    
                                       <div runat="server" id="divRealValue" visible="false" class="row justify-content-center">
                                       <div class="col-sm-1">
                                           </div>
                                           <div class="col-sm-4">
                                            <asp:Label ID="lbl" runat="server" Text="قيمة العقار السوقية" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtRealValue" TextMode="Number" placeholder="فضلا ادخل القيمة السوقية" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                           <div class="col-sm-2">
                                           </div>
                                           <div  runat="server" id="divMortegage" class="col-sm-4">
                                                                         <asp:Label ID="Label6" runat="server" Text="مبلغ الرهن" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtMortegage"  TextMode="Number"  placeholder="فضلا ادخل قيمة الرهن" CssClass="form-control" runat="server"></asp:TextBox>
                                           </div>
                                           <div class="col-sm-1">
                                           </div>
                                    </div>

                               


                                    
                                    <div class="row justify-content-center">
                                          <div class="col-sm-1">
                                              </div>
                                        <div class="col-sm-4">
                                            <asp:Label ID="LabelRequestID" runat="server" Text="رقم الجوال" Font-Bold="True"></asp:Label><span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtPhone" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <span>
                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                                                    ControlToValidate="txtPhone" ErrorMessage="تحقق من رقم الجوال" ForeColor="Red"
                                                    ValidationExpression="[0-9]{10}"></asp:RegularExpressionValidator>
                                            </span>
                                            <asp:TextBox ID="txtPhone" TextMode="Number" MaxLength="10" placeholder="05 فضلا رقم الجوال" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    
                                     <div class="col-sm-2">
                                              </div>
                                         <div class="col-sm-4">
                                                                     <asp:Label ID="Label3" runat="server" Text="جهة العمل" Font-Bold="True"></asp:Label><span><asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="ddlWorkPlace"
                                                ErrorMessage="*" ForeColor="Red" InitialValue=""></asp:RequiredFieldValidator></span>
                                            <asp:DropDownList ID="ddlWorkPlace" runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>
 
                                         </div>
                                         <div class="col-sm-1">
                                              </div>
                                    </div>

                                    

                                    <div class="row justify-content-center">
                                           <div class="col-sm-1">
                                               </div>
                                        <div class="col-sm-4">
                                            <asp:Label ID="LabelRequestedDate" runat="server" Text="الراتب" Font-Bold="True"></asp:Label>
                                            <span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="txtsalary" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtsalary" TextMode="Number" placeholder="فضلا ادخل الراتب" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                         <div class="col-sm-2">
                                               </div>

                                         <div class="col-sm-4">
                                                <asp:Label ID="Label4" runat="server" Text="بنك ايداع الراتب" Font-Bold="True"></asp:Label><span><asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="ddlBank"
                                                ErrorMessage="*" ForeColor="Red" InitialValue=""></asp:RequiredFieldValidator></span>
                                            <asp:DropDownList ID="ddlBank" runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>
 </div>
                                         <div class="col-sm-1">
                                               </div>
                                    </div>

                                   

                                    <div class="row justify-content-center">
                                        <div class="col-sm-1">
                                            </div>
                                        <div class="col-sm-4">
                                            <asp:Label ID="Label5" runat="server" Text="العمر" Font-Bold="True"></asp:Label><span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" ControlToValidate="txtAge" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtAge" TextMode="Number" placeholder="فضلا ادخل العمر" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                         <div class="col-sm-2">
                                            </div>
                                         <div runat="server"  id="divCustomEstateValue" class="col-sm-4">
                                                      <asp:Label ID="lblEstateValue" runat="server" Text="قيمة العقار ان وجد" Font-Bold="True"></asp:Label>
                                             <asp:TextBox ID="txtCusEstateValue" Text="0" TextMode="Number" placeholder="ادخل قيمة العقار ان وجد" CssClass="form-control" runat="server"></asp:TextBox>
                                     
                                            </div>
                                         <div class="col-sm-1">
                                            </div>
                                    </div>

               <div class="row justify-content-center">
                                        <div class="col-sm-1">
                                            </div>
                                        <div class="col-sm-4">
                                            <asp:CheckBox runat="server" ID="AgreeChb" Text="الموافقة علي سياسة الخصوصية" />
                                          <asp:LinkButton ValidationGroup="PrivacyGroup" OnClick="btnPolicyDetails_Click" runat="server" Text="Privacy Policy سياسة الخصوصية " ID="btnPolicyDetails"></asp:LinkButton>
                                            </div>
                   </div>
                               
                                      <%--               <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="lblLoans" runat="server" Text="عليك التزامات مالية ؟" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlLoans" runat="server" CssClass="form-control input-sm" Width="100%">
                                                <asp:ListItem Text="نعم" Value="Y" Selected="True"></asp:ListItem>
                                                <asp:ListItem Text="لا" Value="N"></asp:ListItem>
                                            </asp:DropDownList>

                                        </div>
                                    </div>--%>
                                    <br />

                                    <div class="form-group">
                                        <div class="col-sm-12">
                                        </div>
                                    </div>


                                    <div class="row justify-content-center">
                                        <div class="col-sm-2">
                                            </div>
                                        <div class="col-sm-4">
                                            <asp:LinkButton ID="btnSave"  runat="server" CssClass="btn" OnClick="btnSave_Click"
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;bi bi bi-save&quot;&gt;&lt;/i&gt;&nbsp;&nbsp; حفظ
                                                        "></asp:LinkButton>
                                          
                                           <%--   <asp:LinkButton ID="btnCopy"  onclick="CopyToClipboard();"  style="background:#C5B358;border-color:#BF953F;"  runat="server" CssClass="btn btn-primary btn-md" 
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; حفظ
                                                        "></asp:LinkButton>--%>

                                    
                                        </div>


                                    </div>

                                
                               
                                      </div>

        
  
  </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>

Contents of ucReceipt1.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucReceipt1

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCustomer control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCustomer As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''LabelRequestedBy control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestedBy As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator1 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtname control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtname As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divRealValue As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lbl control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lbl As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRealValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divMortegage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divMortegage As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label6 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtMortegage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtMortegage As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''LabelRequestID control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestID As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator2 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''RegularExpressionValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RegularExpressionValidator1 As Global.System.Web.UI.WebControls.RegularExpressionValidator

    '''<summary>
    '''txtPhone control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPhone As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator6 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''ddlWorkPlace control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlWorkPlace As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''LabelRequestedDate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestedDate As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator3 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtsalary control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtsalary As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator5 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''ddlBank control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlBank As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label5 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator4 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtAge control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtAge As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divCustomEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCustomEstateValue As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lblEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblEstateValue As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCusEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCusEstateValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''AgreeChb control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents AgreeChb As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''btnPolicyDetails control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnPolicyDetails As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucReceipt1.ascx.vb:

Public Class ucReceipt1
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

End Class

Contents of ucReceiptHistory.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucReceiptHistory.ascx.vb" Inherits="EnjazVB.ucReceiptHistory" %>
<%@ Register Src="~/Controls/ucApprovals.ascx" TagPrefix="uc1" TagName="ucApprovals" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>                
                <div class="form-horizontal">
                 
     <div class="form-group">
                        
                                     <div style="overflow: auto;">
                            <div style="direction:rtl;" class="table-responsive">
<%--                                <asp:GridView ID="grdWL"   CssClass="table table-hover table-striped" runat="server" AllowPaging="True" PageSize="100" AllowCustomPaging="True" AllowSorting="True"    AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%" meta:resourcekey="grdWLResource1">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />--%>
                                                                <asp:GridView ID="grdWL" PageSize="100"   CssClass="table table-hover table-striped" runat="server" AllowPaging="True" AllowCustomPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%" >
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource1">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnRefresh" runat="server" CssClass="btn btn-primary btn-sm pull-right"  ToolTip="Refresh" meta:resourcekey="btnRefreshResource1" Text="
                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-refresh&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblSrNo" runat="server" Text='<%# Eval("srno") %>' meta:resourcekey="lblSrNoResource1"></asp:Label>
<%--                                                <asp:HiddenField ID="hwl_days" runat="server" Value='<%# Eval("wl_days") %>' />--%>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>  
                                        



                                        <asp:TemplateField HeaderText="رقم الطلب" SortExpression="doc_no" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lbldoc_no" runat="server" Text="رقم الطلب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="ref_id" ></asp:LinkButton>
                                                <asp:TextBox ID="ref_id" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton ID="btnRefStep" runat="server" OnCommand="btnStep_Command"
                                                     Text='<%# Bind("ref_id") %>'
                                                    ToolTip="Click to open the details" CommandName="Step" CommandArgument='<%# string.Concat(Eval("ref_id"), ",", Eval("ref_id"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                   
                                         <asp:TemplateField HeaderText="نوع الطلب" SortExpression="Req_Type" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblReq_Type" runat="server" Text="نوع الطلب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="Req_Type" ></asp:LinkButton>
                                                <asp:TextBox ID="Req_Type" AutoPostBack="True" CssClass="form-control input-sm" OnTextChanged="txtFWL_TextChanged" runat="server"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblReq_Type" runat="server" Text='<%# Eval("Req_Type") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>
                                         
 <asp:TemplateField HeaderText="العميل" SortExpression="customer" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFcustomer" runat="server" Text="العميل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="customer" ></asp:LinkButton>
                                                <asp:TextBox ID="customer" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblcustomer" runat="server" Text='<%# Eval("customer") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                         <asp:TemplateField HeaderText="المبلغ" SortExpression="amount" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblamount" runat="server" Text="المبلغ" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="amount" ></asp:LinkButton>
                                                <asp:TextBox ID="amount" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblamount" runat="server" Text='<%# Eval("amount") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>


                                        <asp:TemplateField HeaderText="رقم الجوال" SortExpression="contact_no" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblfPhone" runat="server" Text="رقم الجوال" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="contact_no" ></asp:LinkButton>
                                                <asp:TextBox ID="contact_no" AutoPostBack="True" CssClass="form-control input-sm" OnTextChanged="txtFWL_TextChanged" runat="server" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblPhone" runat="server" Text='<%# Eval("CONTACT_NO") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="هوية العميل" SortExpression="cust_id" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblcust_id" runat="server" Text="هوية العميل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="cust_id" ></asp:LinkButton>
                                                <asp:TextBox ID="cust_id" AutoPostBack="True" CssClass="form-control input-sm" OnTextChanged="txtFWL_TextChanged" runat="server" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblcust_id" runat="server" Text='<%# Eval("cust_id") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                           <asp:TemplateField HeaderText="تاريخ الطلب" SortExpression="doc_date" meta:resourcekey="TemplateFieldResource3">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWDate" runat="server" Text="تاريخ الطلب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="doc_date" ></asp:LinkButton>
                                                <asp:TextBox ID="doc_date" AutoPostBack="True" CssClass="form-control input-sm" TextMode="Date" runat="server" OnTextChanged="txtFWL_TextChanged" meta:resourcekey="wl_dateResource1"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblDate" runat="server" Text='<%# Eval("doc_date") %>' meta:resourcekey="lblDateResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                          <asp:TemplateField HeaderText="الموظف المتابع" SortExpression="doc_date" meta:resourcekey="TemplateFieldResource3">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblEmployee" runat="server" Text="الموظف المتابع" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="emp_name" ></asp:LinkButton>
                                                <asp:TextBox ID="emp_name" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblemp_name" runat="server" Text='<%# Eval("emp_name") %>' meta:resourcekey="lblDateResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                         <asp:TemplateField HeaderText="حالة الطلب" SortExpression="status" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblfstatus" runat="server" Text="حالة الطلب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="status" ></asp:LinkButton>
                                                <asp:TextBox ID="status" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblstatus" runat="server" Text='<%# Eval("status") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                                 <asp:TemplateField >
                                     <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton Enabled='<%# IIf(Eval("REF_CANCELDOCNO").ToString() = "", True, False) %>' Visible='<%# IIf(Eval("PROCESS_ID").ToString() = "PROCCREATERECEIPT" And Eval("STATUS_CODE").ToString() = "C", True, False) %>' ID="btnDel" runat="server"  OnCommand="btnStep_Command" 
                                                                                         OnClientClick="if (confirm('هل تريد الغاء السند بالفعل ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                     Text="<i aria-hidden='true' class='glyphicon glyphicon-remove-circle'></i>"
                                                    ToolTip="اضغط لالغاء الطلب" CommandName="Cancel" CommandArgument='<%#Eval("ref_id")%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>


  <asp:TemplateField >
                                     <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton ID="btnStep" Enabled='<%# IIf(Eval("REF_CANCELDOCNO").ToString() = "", True, False) %>' Visible='<%# IIf(Eval("FILENAME").ToString() <> "", True, False) %>'  runat="server" OnCommand="btnStep_Command"
                                                     Text="عرض المرفق"
                                                     CommandName="Attach" CommandArgument='<%# Eval("FILENAME") %>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>


                                         

                                    </Columns>
                                  <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="الاول" LastPageText="الاخير" NextPageText="التالي" PreviousPageText="السابق" />
                                    <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                
                    </div>
                <div id="myModal"   data-backdrop="static" data-keyboard="false" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="t4" class="modal-title" runat="server">
                            <asp:Localize ID="Localize3" runat="server" meta:resourcekey="Localize3Resource1" Text="تفاصيل الطلب"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         <div class="form-group">
                               <div class="col-sm-12">
                         <asp:Label ID="Label7" runat="server" Text="الموافقات" Font-Bold="True" ></asp:Label>
                        <div class="form-group">
                                  <div style="height:350px;overflow:auto">
                                 <uc1:ucApprovals runat="server" id="ucApprovals" />
                                      </div>
                                </div>
                                   </div>
                             </div>
                         <hr />
                        <br />
           </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>
                    </div>

                </div>
            </div>
        </div>

                </ContentTemplate>
            </asp:UpdatePanel>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>
  
     

Contents of ucReceiptHistory.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucReceiptHistory

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''grdWL control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdWL As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''t4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents t4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize3 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ucApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucApprovals As Global.EnjazVB.ucApprovals

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucReceiptHistory.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports WebClass.Sys.Classes
Public Class ucReceiptHistory
    Inherits System.Web.UI.UserControl

    Dim sSql As String = ""


    Private Property PendingFlag As String
        Get
            Return Session("PendingFlag")
        End Get
        Set(value As String)
            Session("PendingFlag") = value
        End Set
    End Property


    Public Property isSupper As Boolean
        Get
            Return Session("isSupper")
        End Get
        Set(value As Boolean)
            Session("isSupper") = value
        End Set
    End Property

    Public Property isQulity As Boolean
        Get
            Return Session("isQulity")
        End Get
        Set(value As Boolean)
            Session("isQulity") = value
        End Set
    End Property

    Public Property isSupvisor As Boolean
        Get
            Return Session("isSupvisor")
        End Get
        Set(value As Boolean)
            Session("isSupvisor") = value
        End Set
    End Property

    Public Property filter As Boolean
        Get
            Return Session("filter")
        End Get
        Set(value As Boolean)
            Session("filter") = value
        End Set
    End Property

    Private Property RpWLFilterCondition As String
        Get
            Return Session("RpWLFilterCondition")
        End Get
        Set(value As String)
            Session("RpWLFilterCondition") = value
        End Set
    End Property

    Private Property pWLFilterValue As String
        Get
            Return Session("pWLFilterValue")
        End Get
        Set(value As String)
            Session("pWLFilterValue") = value
        End Set
    End Property

    Public Property requestId As String
        Get
            Return ViewState("requestId")
        End Get
        Set(value As String)
            ViewState("requestId") = value
        End Set
    End Property

    Public Property wl_id As String
        Get
            Return ViewState("wl_id")
        End Get
        Set(value As String)
            ViewState("wl_id") = value
        End Set
    End Property

    Public Property requestOwner As String
        Get
            Return ViewState("requestOwner")
        End Get
        Set(value As String)
            ViewState("requestOwner") = value
        End Set
    End Property

    Public Property Req_Status As String
        Get
            Return ViewState("Req_Status")
        End Get
        Set(value As String)
            ViewState("Req_Status") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If
        Try


            If Not IsPostBack Then

                If Not (Request.QueryString("filter")) Is Nothing Then
                    filter = True
                Else
                    filter = False
                End If

                ' grdWL.VirtualItemCount = GetOpenWL(Session("EmpNo").ToString, False)
                ' grdWL.VirtualItemCount = GetOpenWL(Session("emp_no").ToString, False)
                PendingFlag = "N"
                isSupper = IIf(Session("supper_user").ToString = "True", True, False)
                isSupvisor = IIf(GetFieldValue("SELECT IS_SUP FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
                isQulity = IIf(GetFieldValue("SELECT QUALITY FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
                ' grdWL.VirtualItemCount = GetEmpRequest()
                GetPageData(0, 100)


            End If
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)
        End Try
        SetGridStyle(grdWL)
    End Sub

    Private Sub grd_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles grdWL.RowEditing
    End Sub

    Private Sub grd_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles grdWL.RowCancelingEdit
    End Sub

    Private Sub grd_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles grdWL.RowDeleting
    End Sub
    Protected Sub OnDataBound(sender As Object, e As EventArgs)
        For i As Integer = grdWL.Rows.Count - 1 To 1 Step -1
            Dim row As GridViewRow = grdWL.Rows(i)
            Dim previousRow As GridViewRow = grdWL.Rows(i - 1)
            For j As Integer = 0 To row.Cells.Count - 1
                If row.Cells(j).Text = previousRow.Cells(j).Text Then
                    If previousRow.Cells(j).RowSpan = 0 Then
                        If row.Cells(j).RowSpan = 0 Then
                            previousRow.Cells(j).RowSpan += 2
                        Else
                            previousRow.Cells(j).RowSpan = row.Cells(j).RowSpan + 1
                        End If
                        row.Cells(j).Visible = False
                    End If
                End If
            Next
        Next
        SetGridStyle(grdWL)
    End Sub

    Private Function GetEmpRequest() As String
        Dim s As String = "", sCond As String = ""
        Dim sOut As String = ""
        s = "SELECT COUNT(H.DOC_NO) FROM ARS_REQUEST_HDR H WITH (NOLOCK)  WHERE 1=1   "
        If Session("supper_user").ToString = "True" Then

        ElseIf isQulity Then
            s = s & " and  (emp_no='" & Session("emp_no").ToString & "' OR  dept_head='" & Session("emp_no").ToString & "' OR (DOC_NO NOT in (select ref_id from app_worklist where next_process_id NOT IN ('" & AppProcess.ProcUploadDoc.ToString.ToUpper & "','" & AppProcess.ProcCreate.ToString.ToUpper & "','" & AppProcess.ProcCheck.ToString.ToUpper & "','" & AppProcess.ProcCancelConfirm.ToString.ToUpper & "','" & AppProcess.ProcAssign.ToString.ToUpper & "') and status='O') AND DATEDIFF(DAY,CONVERT(DATE,DOC_DATE,103), ENJAZVB.GETSERVERDATE())>=8 )   )  "
        Else
            s = s & " and  (emp_no='" & Session("emp_no").ToString & "' OR  dept_head='" & Session("emp_no").ToString & "'  )  "
        End If

        s = GetFieldValue(s)
        If s = "" Then
            s = "0"
        End If
        Return s
    End Function


    Private Sub GetPageData(pgIndex As Integer, pgSize As Integer)

        Try
            Dim dt As New DataTable
            'If pWLFilterCondition <> "" Then

            sSql = "             "

            sSql = "   SELECT   DISTINCT  T.* FROM (       "
            sSql = sSql & "   SELECT ROW_NUMBER() OVER (ORDER BY CONVERT(DATE,DOC_DATE,103) DESC, yr desc  ) as SRNO, a.* FROM (  "
            'sSql = sSql & "   SELECT ROW_NUMBER() OVER (ORDER BY yr desc,  cast(right(REF_ID,4) as int)   DESC) as SRNO, a.* FROM (  "
            sSql = sSql & "   select h.doc_no AS REF_ID,h.Q_CANCEL,yr ,req_date as doc_date, REQ_BY  AS customer ,h.initempbank,h.cust_id,H.CONTACT_NO ,s.type_desc as status ,H.STATUS  AS STATUS_CODE,H.ref_procid,ISNULL(H.REF_DOCNO,'O')REF_DOCNO ,H.refcomp_code,ISNULL(H.SERVICE,'F') AS SERVICE,"
            sSql = sSql & "   h.other5 as investment_amt,h.other6 as readEstateAmt,h.other7 as corporate,e.emp_name,H.EMP_NO,H.dept_head,h.last_update,H.cancel_reason,P.PROCESS_DESC AS REQ_TYPE,H.OTHER2 AS AMOUNT,U.FILENAME,H.REQ_TYPE AS PROCESS_ID,REF.DOC_NO AS REF_CANCELDOCNO  "
            sSql = sSql & "   from ARS_REQUEST_HDR h WITH (NOLOCK) left join  emp_mst e WITH (NOLOCK)  on h.emp_no=e.emp_no inner join (select TYPE_CATEGORY,TYPE_DESC from type_mst WITH (NOLOCK) where type_code='RS') S on h.status=s.type_category  "
            sSql = sSql & "   LEFT JOIN APP_PROCESSES P ON H.REQ_TYPE=P.PROCESS_ID "
            sSql = sSql & "   LEFT JOIN APP_UPLOAD_MST U ON H.DOC_NO=U.DOC_NO   "
            sSql = sSql & "   LEFT JOIN (SELECT DOC_NO,REF_DOCNO FROM ARS_REQUEST_HDR WHERE REQ_TYPE='PROCCANCELRECEIPT' AND STATUS='C') REF ON H.DOC_NO=REF.REF_DOCNO "
            sSql = sSql & "    WHERE H.TRAN_TYPE='AC' "
            sSql = sSql & "    AND  H.EMP_NO='" & Session("emp_no").ToString & "' "
            sSql = sSql & "     )a    "

            sSql = sSql & "   where 1=1  "





            If RpWLFilterCondition <> "" Then
                sSql = sSql & " And " & RpWLFilterCondition
            End If

            sSql = sSql & "  )T   "
            sSql = sSql & "   "
            sSql = sSql & "     []   "




            Dim Begin As String = "SELECT COUNT(*) FROM ("
            Dim CLOSE As String = " ) MT"
            Dim ReqCount = GetFieldValue(Begin & sSql.Replace("[]", CLOSE))
            ReqCount = ReqCount + CInt(GetFieldValueCon(Begin & sSql.Replace("[]", CLOSE), "Enjazcon"))
            grdWL.VirtualItemCount = ReqCount

            Dim Cond As String = ""
            ' ALI 29/12/2024
            ''Cond = Cond & "  WHERE  SRNO BETWEEN ((" & pgIndex & "*100)+1) AND ((" & pgIndex & "+1)*" & pgSize & ")"
            ''Cond = Cond & " ORDER BY SRNO"
            ''dt = GetTable(sSql.Replace("[]", Cond))

            Dim dt1 = GetTable(sSql.Replace("[]", ""))
            Dim dt2 = GetTableCon(sSql.Replace("[]", ""), "Enjazcon")
            dt1.Merge(dt2)
            Dim sortedResults = From row In dt1.AsEnumerable()
                                Order By CDate(row.Field(Of String)("DOC_DATE")) Descending

            dt = dt1.Clone() ' Clone the structure (columns) of the original table
            ' Import each sorted row into the new DataTable
            Dim rowNumber As Integer = 1
            For Each row In sortedResults
                row("SRNO") = rowNumber
                dt.ImportRow(row)
                rowNumber += 1
            Next
            dt.AcceptChanges()
            ' Define row number range
            If dt.Rows.Count > 0 Then
                Dim startRow As Integer = (pgIndex * 100) + 1
                Dim endRow As Integer = (pgIndex + 1) * pgSize
                ' Filter rows based on row number
                Dim filteredRows = dt.AsEnumerable().Skip(startRow - 1).Take(endRow - startRow + 1)

                ' Create a new DataTable from filtered rows
                dt = filteredRows.CopyToDataTable()
                dt.AcceptChanges()
            End If


            If dt.Rows.Count = 0 Then
                Dim nr As DataRow = dt.NewRow
                'dinesh(17-04-23) add empty values as error rais null values to slect color
                'nr("priority") = ""
                nr("srno") = 0
                dt.Rows.Add(nr)
                dt.AcceptChanges()
            End If
            grdWL.DataSource = dt
            grdWL.DataBind()
            SetGridStyle(grdWL)
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)

        End Try
        'RpWLFilterCondition = ""
    End Sub

    Protected Sub grdWL_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles grdWL.PageIndexChanging
        grdWL.PageIndex = e.NewPageIndex
        GetPageData(e.NewPageIndex, 100)
        SetGridStyle(grdWL)
    End Sub


    Protected Sub txtFWL_TextChanged(sender As Object, e As EventArgs)
        Dim strText As String = "", strName As String = ""
        strText = CType(sender, TextBox).Text.ToString
        strName = CType(sender, TextBox).ID.ToString

        pWLFilterValue = strText
        RpWLFilterCondition = ""


        If strText <> "" Then
            If strName = "doc_date" Or strName = "ref_date" Then
                strText = CDate(strText).ToString("dd/MM/yyyy")
                RpWLFilterCondition = " format(" & strName & ") = format('" & strText & "','DD/MM/YYYY')"
            Else
                strText = "N'%" & strText.ToUpper & "%'"
                RpWLFilterCondition = " upper(" & strName & ") Like " & strText
            End If
        End If

        GetPageData(0, 100)
        SetGridStyle(grdWL)
    End Sub


    Private Sub grdWL_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles grdWL.RowDataBound
        If IsNothing(RpWLFilterCondition) Then
            RpWLFilterCondition = ""
        End If

        If e.Row.RowType = DataControlRowType.Header Then
            If RpWLFilterCondition.ToLower.ToString.Contains("(ref_id") Then
                CType(e.Row.FindControl("ref_id"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(customer") Then
                CType(e.Row.FindControl("customer"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(contact_no") Then
                CType(e.Row.FindControl("contact_no"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(sec") Then
                CType(e.Row.FindControl("sec"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(inv_bank") Then
                CType(e.Row.FindControl("inv_bank"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(salary_bank") Then
                CType(e.Row.FindControl("salary_bank"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(cust_id") Then
                CType(e.Row.FindControl("cust_id"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(doc_date") Then
                'CType(e.Row.FindControl("wl_date"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", CDate(Session("pWLFilterValue")).ToString("yyyy-mm-dd"))
                CType(e.Row.FindControl("doc_date"), TextBox).Text = CDate(Session("pWLFilterValue")).ToString("yyyy-MM-dd")
            End If

            If RpWLFilterCondition.ToLower.ToString.Contains("(emp_name") Then
                CType(e.Row.FindControl("emp_name"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(req_type") Then
                CType(e.Row.FindControl("req_type"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If

            If RpWLFilterCondition.ToLower.ToString.Contains("(amount") Then
                CType(e.Row.FindControl("amount"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If

            If RpWLFilterCondition.ToLower.ToString.Contains("(status") Then
                CType(e.Row.FindControl("status"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If

        End If


        If e.Row.RowType = DataControlRowType.DataRow Then



        End If


        SetGridStyle(grdWL)
    End Sub


    Protected Sub btnQuality_Command(sender As Object, e As CommandEventArgs)
        Dim count = 0
        For i As Integer = 0 To grdWL.Rows.Count - 1
            Dim r = grdWL.Rows(i)
            If CType(r.FindControl("chk"), CheckBox).Checked Then
                count = count + 1
                Exit For
            End If
        Next
        If count > 0 Then
            OpenModal(Me.Page, "QualityModal")
        Else
            ShowPopUpMsg(Me.Page, "فضلا اختر طلب واحد علي الاقل")
        End If
    End Sub
    Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O" 'rblWLStatus.SelectedValue.ToString


        Dim sWorklistID As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
            Dim sArgRefID As String = ""
        'sWorklistID = e.CommandArgument 'wl_id
        If e.CommandName = "Step" Then
            sWorklistID = e.CommandArgument.ToString.Split(",")(0).ToString
            sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString
            requestId = sArgRefID
            wl_id = sWorklistID
            sRefID = ""
            sCurrentProcessCode = ""
            sNextProcessCode = ""
            sPageLink = ""


            'q = "SELECT MODULE_ID,PROCESS_ID,REF_ID,NEXT_PROCESS_ID,PAGELINK FROM APP_WORKLIST WHERE WL_ID='" & sWorklistID & "' AND STATUS='" & wlStatus & "' "


            'Dim dtr = GetTable(q)
            'For Each rdr As DataRow In dtr.Rows
            '    sRefID = rdr("ref_id").ToString
            '    sCurrentProcessCode = rdr("process_id").ToString
            '    sNextProcessCode = rdr("next_process_id").ToString
            '    sPageLink = rdr("pagelink").ToString
            '    sModuleID = rdr("module_id").ToString
            '    Exit For
            'Next

            ' RedirectURL("../pages/ReqDetails.aspx?p1=" & sArgRefID)
            Req_Status = GetFieldValue("select status from ars_request_hdr where doc_no='" & sArgRefID & "'")
            requestOwner = GetFieldValue("select emp_no from ars_request_hdr where doc_no='" & sArgRefID & "'")

            'ucCustomerInfo.DocNo = sArgRefID
            ucApprovals.DocNo = sArgRefID
            OpenModal(Me.Page, "myModal")
        ElseIf e.CommandName = "Attach" Then
            Dim sFileName = e.CommandArgument.ToString
            Dim url = "../ImageStorage/" & sFileName & " "
            Dim s = "window.open('" & url + "', 'popup_window', 'width=600,height=500,left=100,top=100,resizable=yes');"
            ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "script", s, True)
        ElseIf e.CommandName = "Cancel" Then
            sArgRefID = e.CommandArgument.ToString
            OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/Receipt.aspx?p2=PROCCANCELRECEIPT&DocNo=" & sArgRefID)
        ElseIf e.CommandName = "Detail" Then

            OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)


            'If sPageLink <> "" Then
            '    ' sPageLink = "../../../" & sModuleID & "/" & Session("Language") & "/" & Replace(sPageLink, "../", "") 'format for the new system
            '    sPageLink = "../../../" & Replace(sPageLink, "../", "") 'format for the new system

            '    If Not sPageLink.ToUpper.Contains(".ASPX") Then
            '        ' clsGenClass.OpenTab(Me.Page, sPageLink & "&ViewMode=" & rblWLStatus.SelectedValue.ToString)
            '        'tkID = clsGenClass.InsertToken("N")
            '        'clsGenClass.OpenTab(Me.Page, sModuleLink & "default.aspx?token=" & tkID.ToString & "&div=" & Session("CompCode") & "&lnk=" & Server.UrlEncode(Replace(sPageLink, "..", Session("Language").ToString) & "&ViewMode=" & rblWLStatus.SelectedValue.ToString))
            '        OpenWorklistPage(Me.Page, sWorklistID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, sPageLink)
            '    Else
            '        OpenTab(Me.Page, sPageLink & "&ViewMode=" & wlStatus, sWorklistID)
            '    End If
            'End If
        ElseIf e.CommandName = "Quality" Then
            OpenModal(Me.Page, "QualityModal")
        ElseIf e.CommandName = "addpending" Then
            ' AddtoPending(e.CommandArgument)
            'AddtoPending(e.CommandArgument.ToString.Split(",")(0).ToString)
            'GetPageData(0, 10)
        End If
        SetGridStyle(grdWL)
    End Sub


    Protected Sub CLOSEOPENWORKLIST(cmd As SqlCommand, DOCNO As String)
        Dim Q As String = ""
        Q = ""
        Q = Q & " update app_worklist  set status='C',CLOSED_DATE=EnjazVB.GetServerDate(),CLOSED_REMARKS=N'تحويل بواسطة الجودة'  WHERE STATUS IN ('P','O') AND REF_ID='" & DOCNO & "'   "

        cmd.CommandText = Q
        cmd.ExecuteNonQuery()

    End Sub






End Class

Contents of ucReqDetails.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucReqDetails.ascx.vb" Inherits="EnjazVB.ucReqDetails" %>
 <%@ Register Src="~/Controls/ucApprovals.ascx" TagPrefix="uc1" TagName="ucApprovals" %>
<%@ Register Src="~/Controls/ucAttachment.ascx" TagPrefix="uc1" TagName="ucAttachment" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <%-- <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>--%>
    <ContentTemplate>
        <fieldset>
            <legend class="noLegend"></legend>
            <div class="panel panel-primary">
                <div class="panel-heading text-center">
                    <h2 id="H2" class="panel-title" runat="server"><asp:Localize ID="loc_Details" runat="server" Text="البيانات الاساسية للعميل"></asp:Localize></h2>
                    <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i>
                    </span>
                </div>
                <div class="panel-body">
                  
                    <div class="container-fluid">
                        <div class="form-horizontal">

<div class="form-group">
    <div class="col-sm-3">
        <asp:Label ID="Label1" runat="server" Text="اسم العميل" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtName" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
 <div class="col-sm-3">
        <asp:Label ID="Label2" runat="server" Text="جوال العميل" Font-Bold="True" ></asp:Label>
         <span>
                                                <asp:RegularExpressionValidator ValidationGroup="infoGroup" ID="RegularExpressionValidator1" runat="server"
                                                    ControlToValidate="txtPhone" ErrorMessage="تحقق من رقم الجوال" ForeColor="Red"
                                                    ValidationExpression="[0-9]{10}"></asp:RegularExpressionValidator>
                                            </span>
     <asp:TextBox ID="txtPhone" MaxLength="10"   TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
                                                        <div class="col-sm-3">
        <asp:Label ID="Label3" runat="server" Text="بنك ايداع الراتب" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtBank" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
 <div class="col-sm-3">
        <asp:Label ID="Label4" runat="server" Text="الراتب" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtSalary" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>


            </div>



                             <div class="form-group">
                                    <div class="col-sm-3">
        <asp:Label ID="Label6" runat="server" Text="جهة العمل" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtWorkPlace" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
      <div class="col-sm-3">
        <asp:Label ID="Label5" runat="server" Text="العمر" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtAge" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
    <div class="col-sm-3">
        <asp:Label ID="lblDocNo" runat="server" Text="رقم الطلب" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtDocNo" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
 <div class="col-sm-3">
        <asp:Label ID="lblDocDate" runat="server" Text="تاريخ الطلب" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtDocDate" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    </div>


            </div>
                                <div class="form-group">

                                           <div class="col-sm-3">
                                                  <asp:Label ID="Label35" runat="server" Text="اهمية الطلب" Font-Bold="True" ></asp:Label>
                                               <asp:DropDownList ID="ddlReqImportance"  Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%">
                                                   <asp:ListItem Value="N" Text="عادي"></asp:ListItem>
                                                    <asp:ListItem Value="Y" Text="مهم"></asp:ListItem>
                                               </asp:DropDownList>
                                        <%-- <asp:TextBox ID="txtEmployee"   ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>--%>
                                                </div>
                                                       <div runat="server" id="divCustomEstateValue" visible="false" class="col-sm-3">
       <asp:Label ID="Label42" runat="server" Text="قيمة العقار ان وجد" Font-Bold="True"></asp:Label>
 <asp:TextBox ReadOnly="true" ID="txtCusEstateValue" TextMode="Number" CssClass="form-control" runat="server"></asp:TextBox>
</div>

                                    <div class="col-sm-3">
        <asp:Label ID="Label40" runat="server" Text="الخدمة المطلوبة" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList Enabled="false" ID="ddlCustomService" AutoPostBack="true" OnSelectedIndexChanged="ddlCustomService_SelectedIndexChanged"  runat="server" CssClass="form-control" Width="100%">
                                                <asp:ListItem Value="F" Text="تمويل" ></asp:ListItem>
                                             <asp:ListItem Value="M" Text="فك رهن واعادة تمويل" ></asp:ListItem>
                                            </asp:DropDownList>
 </div>
            <div runat="server" id="divRealValue" visible="false" class="col-sm-3">
       <asp:Label ID="lbl" runat="server" Text="قيمة العقار السوقية" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ReadOnly="true" ID="txtMRealValue" TextMode="Number" CssClass="form-control" runat="server"></asp:TextBox>
                                       
 </div>
            <div runat="server" id="divMortegage" visible="false" class="col-sm-3">
        <asp:Label ID="Label41" runat="server" Text="مبلغ الرهن" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ReadOnly="true" ID="txtMortegage"  TextMode="Number"   CssClass="form-control" runat="server"></asp:TextBox>
                                      
 </div>
                                    </div>
                                                              
                            
                            <div class="form-group">
                                        <div class="col-sm-4">
                                            <span>
                                       <asp:LinkButton ID="btnInfoEdit" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnInfoEdit_Click" 
                                        Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-edit&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تعديل
                                                        " ></asp:LinkButton>
                                                </span>
                                              <span>
                                       <asp:LinkButton ID="btnInfoSave"  ValidationGroup="infoGroup" runat="server"  CssClass="btn btn-primary btn-md" Visible="false" OnClick="btnInfoSave_Click"  
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;حفظ
                                                        " ></asp:LinkButton>
                                                  </span>

                                                                                   <span>
           <asp:LinkButton ID="btnInfoCancel" runat="server"  CssClass="btn btn-primary btn-md"  Visible="false" OnClick="btnInfoCancel_Click"
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; إلغاء
                                                        " ></asp:LinkButton>
                                                  </span>

                                       </div>
                                        </div>

                               <hr />

                              <div runat="server" id="divDocUpload" class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                  المتابعة واكمال المستندات 
                                </div>
                                <div class="panel-body">

                                     <div class="form-group">

                                           <div class="col-sm-3">
                                                  <asp:Label ID="Label33" runat="server" Text="المشرف" Font-Bold="True" ></asp:Label>
                                               <asp:DropDownList ID="ddlSup" AutoPostBack="true" OnSelectedIndexChanged="ddlSup_SelectedIndexChanged" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                        <%-- <asp:TextBox ID="txtEmployee"   ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>--%>
                                                </div>

                                      <div class="col-sm-3">
                                                  <asp:Label ID="Label13" runat="server" Text="الموظف المتابع للطلب" Font-Bold="True" ></asp:Label>
                                               <asp:DropDownList ID="ddlEmployee" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                        <%-- <asp:TextBox ID="txtEmployee"   ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>--%>
                                                </div>

                                         
                                      
                                         
                                         <div class="col-sm-3">
                                              <asp:Label ID="Label21" runat="server" Text="." Font-Bold="True" ></asp:Label>
                                         <div class="form-group">
                                             <div class="col-sm-4">
                                              <asp:LinkButton ID="btnEmpEdit" runat="server"  CssClass="btn btn-primary btn-md"  OnClick="btnEmpEdit_Click" 
                                        Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-edit&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تعديل
                                                        " ></asp:LinkButton>
                                             </div>
                                             <div class="col-sm-4">
                                                                         <asp:LinkButton ID="btnEmpSave" runat="server"  CssClass="btn btn-primary btn-md" Visible="false" OnClick="btnEmpSave_Click"   
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;حفظ
                                                        " ></asp:LinkButton>
                                             </div>
                                             <div class="col-sm-4">
                                                          <asp:LinkButton ID="btnEmpCancel" runat="server"  CssClass="btn btn-primary btn-md"  Visible="false" OnClick="btnEmpCancel_Click"
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; إلغاء
                                                        " ></asp:LinkButton>
                                             </div>
                                             </div>
                                                                              
  
                                               

                                             </div>


                                           <div runat="server" visible="false" id="divStatus" class="col-sm-3">
                                                  <asp:Label ID="lblStatus" runat="server" Text="حالة الطلب" Font-Bold="True" ></asp:Label>
                                               <asp:DropDownList ID="ddlStatus" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                        <%-- <asp:TextBox ID="txtEmployee"   ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>--%>
                                                </div>


                                            
                                         <div runat="server" visible="false" id="divStatusActions"  class="col-sm-3">
                                              <asp:Label ID="Label24" runat="server" Text="." Font-Bold="True" ></asp:Label>
                                         <div class="form-group">
                                             <div class="col-sm-4">
                                              <asp:LinkButton ID="btnStatusEdit" runat="server"  CssClass="btn btn-primary btn-md" Visible="false" OnClick="btnStatusEdit_Click" 
                                        Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-edit&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تعديل
                                                        " ></asp:LinkButton>
                                             </div>
                                             <div class="col-sm-4">
                                                                         <asp:LinkButton ID="btnStatusSave" runat="server"  CssClass="btn btn-primary btn-md" Visible="false" OnClick="btnStatusSave_Click" 
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;حفظ
                                                        " ></asp:LinkButton>
                                             </div>
                                             <div class="col-sm-4">
                                                          <asp:LinkButton ID="btnStatusCancel" runat="server"  CssClass="btn btn-primary btn-md"  Visible="false" OnClick="btnStatusCancel_Click" 
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; إلغاء
                                                        " ></asp:LinkButton>
                                             </div>
                                             </div>
                                                                              
  
                                               

                                             </div>



                                         </div>




                                    <div class="form-group">
                                         <div class="col-sm-3">
        <asp:Label ID="Label7" runat="server" Text="الحسبة علي اي بنك" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlInvestmentAgency" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>
                                        
                                           <%-- <div class="col-sm-3">
                                                  <asp:Label ID="Label8" runat="server" Text="مبلغ الحسبة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtInvestmentIntialAmt" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>--%>
                                         <div class="col-sm-3">
                                              <div class="form-group">
                                                   <div class="col-sm-6">
                                                  <asp:Label ID="Label8" runat="server" Text="موظف البنك" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtInitBankEmp"  ReadOnly="true"     CssClass="form-control" runat="server" ></asp:TextBox>
                                               </div>
                                                   <div class="col-sm-6">
                                                            <asp:Label ID="Label18" runat="server" Text="المدة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtInitLong" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                               </div>
                                                  </div>
                                              </div>

                                        
                                               <div class="col-sm-3">
                                                 
                                                <span>
                                                    <div class="form-group">
                                                           <div class="col-sm-6">
                                                                <asp:Label ID="Label14" runat="server" Text="التمويل العقاري" Font-Bold="True" ></asp:Label>
                                                   <asp:TextBox ID="txtInitReal" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                 </div>
                                                          <div class="col-sm-6">
                                                         <asp:Label ID="Label15" runat="server" Text="التمويل الشخصي" Font-Bold="True" ></asp:Label>
                                                    <asp:TextBox ID="txtInitPersonal" TextMode="Number"  ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>
                                           </div>
                                                              </div>
                                                        </span>
                                                   </div>

      <div class="col-sm-3">
                                                 
   <span>
       <div class="form-group">
            <div class="col-sm-6">
                 <asp:Label ID="Label16" runat="server" Text="القسط" Font-Bold="True" ></asp:Label>
       <asp:TextBox ID="txtInitInstall" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox> 
  </div>
              <div class="col-sm-6">
                   <asp:Label ID="Label17" runat="server" Text="قسط الدعم" Font-Bold="True" ></asp:Label>
                <asp:TextBox ID="txtInitSuppInstall" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
</div>
</div>
  </span>
          </div>



                                    
                                    
                           
                                
                                </div>




                                     <div class="form-group">
                                            <div class="col-sm-3">
                                              <asp:Label ID="Label23" runat="server" Text="الخدمة المطلوبة" Font-Bold="True" ></asp:Label>
                                       <asp:DropDownList ID="ddlService" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                             </div>
                                       

                                             <div class="col-sm-3">
                                              <asp:Label ID="Label22" runat="server" Text="نوع العقار" Font-Bold="True" ></asp:Label>
                                                 <asp:DropDownList ID="ddlRealEstate" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                                
                                                 </div>
                                         <div class="col-sm-3">
                                            <asp:Label ID="lblRealEstatValue" runat="server" Text="قيمة العقار الاصلي" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtRealValue" TextMode="Number"  ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                           <div class="col-sm-1">
                                                  <asp:Label ID="Label9" runat="server" Text="يوجد متضامن" Font-Bold="True" ></asp:Label>
                                               <div class="col-sm-12">

                                           <span><asp:CheckBox  ID="ChYes" runat="server"  Enabled="false"   Text="نعم" onclick="MutExChkList(this);" /></span>
                                               <span><asp:CheckBox  ID="CheNo" runat="server" Enabled="false"  Text="لا" onclick="MutExChkList(this);" /></span>
                                              </div>
                                               </div>
                                         
                                             <div class="col-sm-2">
                                                  <asp:Label ID="Label32" runat="server" Text="هوية العميل" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtCustomId"  ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
                                  
                                         </div>

                                      <div class="form-group">
                                         <div class="col-sm-3">
                                              <asp:Label ID="Label27" runat="server" Text="جوال المالك" Font-Bold="True" ></asp:Label>
                                        <asp:TextBox ID="txtCusPhone" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                             </div>

      <div class="col-sm-3">
                                              <asp:Label ID="Label28" runat="server" Text="مدينة العقار" Font-Bold="True" ></asp:Label>
                                       <asp:DropDownList ID="ddlCity" runat="server" Enabled="false" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                             </div>

      <div class="col-sm-3">
                                              <asp:Label ID="Label29" runat="server" Text="معرفة العميل بالشركة" Font-Bold="True" ></asp:Label>
                                       <asp:DropDownList ID="ddlWayOfKnow" runat="server" Enabled="false" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                             </div>

      </div>
                                     <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label30" runat="server" Text="شرح حالة العميل" Font-Bold="True" ></asp:Label>
                                   <asp:TextBox ID="txtCustom_status" CssClass="form-control" ReadOnly="true" runat="server" TextMode="MultiLine" ></asp:TextBox>
                                </div>
                                        </div>


                                    <div class="form-group">
                                        <div class="col-sm-4">
                                            <span>
                                       <asp:LinkButton ID="btnInitEdit" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnInitEdit_Click" 
                                        Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-edit&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تعديل
                                                        " ></asp:LinkButton>
                                                </span>
                                              <span>
                                       <asp:LinkButton ID="btnInitSave" runat="server"  CssClass="btn btn-primary btn-md" Visible="false" OnClick="btnInitSave_Click"  
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;حفظ
                                                        " ></asp:LinkButton>
                                                  </span>

                                                                                   <span>
           <asp:LinkButton ID="btnInitCancel" runat="server"  CssClass="btn btn-primary btn-md"  Visible="false" OnClick="btnInitCancel_Click"
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; إلغاء
                                                        " ></asp:LinkButton>
                                                  </span>

                                       </div>
                                        </div>


                                </div>
                            </div>
</div>
                                                 
                            <hr />
                                                <div runat="server" id="divEval" class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                 اجراءات التقييم 
                                </div>
                                <div class="panel-body">
  <div class="form-group">
       <div class="col-sm-3">
                                                  <asp:Label ID="Label10" runat="server" Text="مبلغ التقييم" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtEvalutionAmt" ReadOnly="true" TextMode="Number"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
                                       <div class="col-sm-3">
        <asp:Label ID="Label19" runat="server" Text="جهة التمويل" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlFinanceEntity" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>

       <div class="col-sm-3">
                 <asp:Label ID="Label34" runat="server" Text="سير المعاملة" Font-Bold="True" ></asp:Label>
           <asp:DropDownList ID="ddlProcType" Enabled="false" runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
     </div>

              <div runat="server" visible="false" class="col-sm-3">
                                                  <asp:Label ID="Label20" runat="server" Text="موظف البنك" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtEvalBankEmp" ReadOnly="true"    CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>


                                        </div>
                                     <div class="form-group">
                                          <div class="col-sm-3">
                                 
                                                  <asp:Label ID="Label36" runat="server" Text="يوجد التزامات " Font-Bold="True" ></asp:Label>
                                             <asp:DropDownList ID="ddlInstall" Enabled="false" AutoPostBack="true" OnSelectedIndexChanged="ddlInstall_SelectedIndexChanged" runat="server" CssClass="form-control input-sm" Width="100%">
                                                  <asp:ListItem Text="لا يوجد" Value="N"></asp:ListItem>
                                                  <asp:ListItem Text="يوجد" Value="Y"></asp:ListItem>
                                              </asp:DropDownList>
           </div>

      <div runat="server" id="divCompPay" visible="false" class="col-sm-3">
                                  <asp:Label ID="Label37" runat="server" Text="جهة السداد " Font-Bold="True" ></asp:Label>
                                            <asp:DropDownList Enabled="false" ID="ddlCompPay" runat="server" CssClass="form-control input-sm" Width="100%">
                                                <asp:ListItem Text="-اختر طريقة السداد-" Value=""></asp:ListItem>
                                                <asp:ListItem Text="سداد عن طريق الشركة" Value="C"></asp:ListItem>
                                                <asp:ListItem Text="سداد من خارج الشركة" Value="O"></asp:ListItem>
                                            </asp:DropDownList>
                                              </div>
                                         </div>

                                     <div runat="server" visible="false"  id="divInstallments" class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                    <h3 id="H4" class="panel-title" runat="server"><asp:Localize ID="Localize2" runat="server" Text="">بيانات الالتزامات المالية</asp:Localize></h3>
                                </div>
                                <div class="panel-body">
                                         


                          
                                      <div class="form-group">
                                          <div class="col-sm-12">
                                            <div class="col-sm-4">
                                                 <div class="form-group">
    <div class="col-sm-12">
        <asp:Label ID="Label38" runat="server" Text="المبلغ" Font-Bold="True" ></asp:Label>
        <asp:TextBox ID="txtInstallAmt" ReadOnly="true" TextMode="Number"    CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
 
   
 
  <div class="col-sm-12">
        <asp:Label ID="Label39" runat="server" Text="شرح للمبلغ" Font-Bold="True" ></asp:Label>
         <div class="input-group">
      <asp:TextBox ID="txtInstallmentFinanceEntity"  ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
    <span class="input-group-addon" id="basic-addon2">
                        <asp:LinkButton ID="btnAddInstall" Enabled="false"  ToolTip="اضافة القسط" OnClick="btnAddInstall_Click"
                            runat="server" CausesValidation="False" >
                        <i aria-hidden="true" class="glyphicon glyphicon-plus-sign"></i>
                        </asp:LinkButton>
                  </span>
         
         </div>
         </div>

   

            </div>

                                                </div>
                                          <div class="col-sm-8">
                                                        <asp:GridView ID="grdInstall" runat="server" CssClass="table table-hover table-striped" AutoGenerateColumns="False" 
                        CellPadding="4" ForeColor="#333333" EmptyDataText="لا يوجد سجلات" GridLines="None" Width="100%" ShowFooter="True" >
                        <AlternatingRowStyle BackColor="White" />

                        <Columns>
                          
                            <asp:BoundField DataField="installAmt" DataFormatString="{0:d}" HeaderText="المبلغ" meta:resourcekey="BoundFieldResource1">
                                <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" />
                            </asp:BoundField>
 <asp:BoundField DataField="InstallmentEntity" HeaderText="شرح للمبلغ" >
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:BoundField>

 <asp:TemplateField HeaderText="إزالة">
                                <ItemTemplate>
                                    <asp:LinkButton ID="lnkDel" Enabled= '<%# If(EnableBt = True, True, False) %>'  runat="server" OnCommand="imgInstallDel_Command" CommandArgument='<%# Container.DataItemIndex %>' ToolTip="Delete" meta:resourcekey="lnkDel" Text="
                                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-trash&quot;&gt;&lt;/i&gt;
                                "></asp:LinkButton>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" CssClass="gridBtn" />
                            </asp:TemplateField>
                        </Columns>

                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                        <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                                          </div>
                                      </div>
                                      </div>


                                    </div>
        </div>  
</div>




                                                <div class="form-group">
                                        <div class="col-sm-4">
                                            <span>
                                       <asp:LinkButton ID="btEvalEdit" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btEvalEdit_Click" 
                                        Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-edit&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تعديل
                                                        " ></asp:LinkButton>
                                                </span>
                                              <span>
                                       <asp:LinkButton ID="btEvalSave" runat="server"  CssClass="btn btn-primary btn-md" Visible="false" OnClick="btEvalSave_Click" 
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;حفظ
                                                        " ></asp:LinkButton>
                                                  </span>
  <span>
           <asp:LinkButton ID="btEvalCancel" runat="server"  CssClass="btn btn-primary btn-md"  Visible="false" OnClick="btEvalCancel_Click"
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; إلغاء
                                                        " ></asp:LinkButton>
                                                  </span>
                                       </div>
                                        </div>

                                    </div>
        </div>
</div>

                            <hr />
<div runat="server" id="divFinalApprove" class="form-group">
    <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                الموافقة النهائية 
                                </div>
                                <div class="panel-body">
  <div class="form-group">
       <div class="col-sm-3">
                                                  <asp:Label ID="lblPersonal" runat="server" Text="التمويل الشخصي" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtPersonalFin" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
             <div class="col-sm-3">
                                                  <asp:Label ID="lblRealEstate" runat="server" Text="التمويل العقاري" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtRealEstateFin" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
      <div class="col-sm-3">
                                                  <asp:Label ID="lblInstallment" runat="server" Text="القسط" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtInstallment" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
            <div class="col-sm-3">
                                                  <asp:Label ID="lblSupportInst" runat="server" Text="قسط الدعم" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtSupportInst" TextMode="Number"  ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                        </div>

                                      <div class="form-group">
                                          <div class="col-sm-3">
                                                  <asp:Label ID="lblLongtime" runat="server" Text="المدة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtLong" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
                                            <div class="col-sm-3">
                                                  <asp:Label ID="lblTax" runat="server" Text="الضريبة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtTax" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                            <div class="col-sm-3">
                                                  <asp:Label ID="lblPatch" runat="server" Text="الدفعة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtPatch" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                           <div class="col-sm-3">
                                                  <asp:Label ID="Label11" runat="server" Text="قيمة الشيك" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtChequAmt" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

 </div>

 <div class="form-group">
                                     <div class="col-sm-3">
                                                  <asp:Label ID="lblcommition" runat="server" Text="سعي من العميل" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtCustomerCommition" TextMode="Number" ReadOnly="true"   CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>

                                           <div class="col-sm-3">
                                                  <asp:Label ID="Label12" runat="server" Text="سعي من البنك" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtBankCommition" TextMode="Number"  ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>
                                                </div>
     


                                        </div>

                                   



                                       <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label31" runat="server" Text="ملاحظة او شرح" Font-Bold="True" ></asp:Label>
                                   <asp:TextBox ID="txtFinalStatus" ReadOnly="true" CssClass="form-control" runat="server" TextMode="MultiLine" ></asp:TextBox>
                                </div>
                                        </div>

                                      <div class="form-group">
                                        <div class="col-sm-4">
                                            <span>
                                       <asp:LinkButton ID="btFinalEdit" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btFinalEdit_Click" 
                                        Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-edit&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تعديل
                                                        " ></asp:LinkButton>
                                                </span>
                                              <span>
                                       <asp:LinkButton ID="btFinalSave" runat="server"  CssClass="btn btn-primary btn-md" Visible="false" OnClick="btFinalSave_Click" 
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;حفظ
                                                        " ></asp:LinkButton>
                                                  </span>
                                                                                                                                                 <span>
           <asp:LinkButton ID="btFinalCancel" runat="server"  CssClass="btn btn-primary btn-md"  Visible="false" OnClick="btFinalCancel_Click"
 Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ban-circle&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; إلغاء
                                                        " ></asp:LinkButton>
                                                  </span>
                                       </div>
                                        </div>






                                    </div>
        </div>
</div>

                              <div id="divInfoTabs" runat="server" class="form-group">
                            <div class="col-sm-12">
                                <ul class="nav nav-tabs">

                                           <li class="active"><a data-toggle="tab" href="#Attachment"><asp:Localize ID="lblApprovals" runat="server" Text="المرفقات" ></asp:Localize></a></li>
                                    <li><a data-toggle="tab" href="#Approvals"><asp:Localize ID="lblClearance" runat="server" Text="الموافقات" ></asp:Localize></a></li>


                                       </ul>
                                <div class="well tab-content">
                                    <div id="Attachment" class="tab-pane fade in active">
                                         <div style="height:350px;overflow:auto">
                                        <uc1:ucAttachment runat="server" id="ucAttachment" />
                                             </div>
                                    </div>
                                    <div id="Approvals" class="tab-pane fade">
                                         <div style="height:350px;overflow:auto">
                                       <uc1:ucApprovals runat="server" id="ucApprovals" />
                                             </div>
                                    </div>
                                    </div>
                                </div>
                                                                                </div>

  <div id="divNotes" runat="server" class="form-group">
       <div class="col-sm-11">
                                                   <asp:Label ID="Label25" runat="server" Text="اضافة ملاحظة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtRemarks"    CssClass="form-control" runat="server" ></asp:TextBox>
                                               
                                               </div>
                                          <div class="col-sm-1">
                                               <asp:Label ID="Label26" runat="server" Text="." Font-Bold="True" ></asp:Label>
                                                <asp:LinkButton ID="btnAddRemarks" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnAddRemarks_Click" 
                                       OnClientClick="if (confirm('هل تريد اضافة الملاحظة ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;اضافة ملاحظة 
                                                        " ></asp:LinkButton>
                                              </div>
  </div>


           <%--  <div class="form-group">
                                 <uc1:ucApprovals runat="server" id="ucApprovals" />
                                </div>--%>



                            </div>
                        </div>
                    </div>
                </div>
            </fieldset>
        </ContentTemplate>
     </asp:UpdatePanel>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>

<script type = "text/javascript">
    function MutExChkList(chk)
    {
        var chkList = chk.parentNode.parentNode.parentNode;
        var chks = chkList.getElementsByTagName("input");
        for(var i=0;i<chks.length;i++)
        {
            if(chks[i] != chk && chk.checked)
            {
                chks[i].checked=false;
            }
        }
    }
</script>

Contents of ucReqDetails.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucReqDetails

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''H2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H2 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''loc_Details control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents loc_Details As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtName control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtName As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RegularExpressionValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RegularExpressionValidator1 As Global.System.Web.UI.WebControls.RegularExpressionValidator

    '''<summary>
    '''txtPhone control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPhone As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtBank control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtBank As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtSalary control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtSalary As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label6 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtWorkPlace control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtWorkPlace As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label5 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtAge control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtAge As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblDocNo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblDocNo As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtDocNo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDocNo As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblDocDate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblDocDate As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtDocDate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDocDate As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label35 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label35 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlReqImportance control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlReqImportance As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divCustomEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCustomEstateValue As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label42 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label42 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCusEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCusEstateValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label40 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label40 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCustomService control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCustomService As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divRealValue As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lbl control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lbl As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtMRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtMRealValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divMortegage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divMortegage As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label41 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label41 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtMortegage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtMortegage As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnInfoEdit control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnInfoEdit As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnInfoSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnInfoSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnInfoCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnInfoCancel As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''divDocUpload control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divDocUpload As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label33 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label33 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlSup control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlSup As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label13 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label13 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlEmployee control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlEmployee As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label21 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label21 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnEmpEdit control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnEmpEdit As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnEmpSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnEmpSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnEmpCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnEmpCancel As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''divStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divStatus As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lblStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblStatus As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlStatus As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divStatusActions control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divStatusActions As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label24 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label24 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnStatusEdit control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnStatusEdit As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnStatusSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnStatusSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnStatusCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnStatusCancel As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlInvestmentAgency control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlInvestmentAgency As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label8 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label8 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitBankEmp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitBankEmp As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label18 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label18 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitLong control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitLong As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label14 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label14 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitReal control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitReal As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label15 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label15 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitPersonal control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitPersonal As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label16 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label16 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitInstall As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label17 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label17 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInitSuppInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInitSuppInstall As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label23 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label23 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlService control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlService As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label22 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label22 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlRealEstate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlRealEstate As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''lblRealEstatValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblRealEstatValue As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRealValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label9 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label9 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ChYes control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ChYes As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''CheNo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents CheNo As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''Label32 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label32 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCustomId control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCustomId As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label27 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label27 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCusPhone control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCusPhone As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label28 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label28 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCity control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCity As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label29 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label29 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlWayOfKnow control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlWayOfKnow As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label30 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label30 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCustom_status control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCustom_status As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnInitEdit control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnInitEdit As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnInitSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnInitSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnInitCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnInitCancel As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''divEval control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divEval As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label10 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label10 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtEvalutionAmt control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtEvalutionAmt As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label19 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label19 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlFinanceEntity control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlFinanceEntity As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label34 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label34 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlProcType control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlProcType As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label20 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label20 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtEvalBankEmp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtEvalBankEmp As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label36 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label36 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlInstall As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divCompPay control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCompPay As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label37 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label37 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlCompPay control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCompPay As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divInstallments control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divInstallments As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''H4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize2 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''Label38 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label38 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInstallAmt control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInstallAmt As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label39 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label39 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInstallmentFinanceEntity control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInstallmentFinanceEntity As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnAddInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnAddInstall As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''grdInstall control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdInstall As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''btEvalEdit control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btEvalEdit As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btEvalSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btEvalSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btEvalCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btEvalCancel As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''divFinalApprove control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divFinalApprove As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lblPersonal control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblPersonal As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtPersonalFin control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPersonalFin As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblRealEstate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblRealEstate As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRealEstateFin control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRealEstateFin As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblInstallment control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblInstallment As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtInstallment control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtInstallment As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblSupportInst control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblSupportInst As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtSupportInst control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtSupportInst As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblLongtime control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblLongtime As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtLong control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtLong As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblTax control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblTax As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtTax control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtTax As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblPatch control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblPatch As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtPatch control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPatch As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label11 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label11 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtChequAmt control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtChequAmt As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblcommition control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblcommition As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCustomerCommition control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCustomerCommition As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label12 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label12 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtBankCommition control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtBankCommition As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label31 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label31 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtFinalStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtFinalStatus As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btFinalEdit control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btFinalEdit As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btFinalSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btFinalSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btFinalCancel control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btFinalCancel As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''divInfoTabs control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divInfoTabs As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lblApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblApprovals As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''lblClearance control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblClearance As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucAttachment control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucAttachment As Global.EnjazVB.ucAttachment

    '''<summary>
    '''ucApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucApprovals As Global.EnjazVB.ucApprovals

    '''<summary>
    '''divNotes control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divNotes As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label25 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label25 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRemarks As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label26 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label26 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnAddRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnAddRemarks As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucReqDetails.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Public Class ucReqDetails
    Inherits System.Web.UI.UserControl
    Dim q As String = ""
    Dim dtInstallment As New DataTable

    Public Property requestId As String
        Get
            Return ViewState("requestId")
        End Get
        Set(value As String)
            ViewState("requestId") = value
        End Set
    End Property

    Public Property empNo As String
        Get
            Return ViewState("empNo")
        End Get
        Set(value As String)
            ViewState("empNo") = value
        End Set
    End Property

    Public Property isSupper As Boolean
        Get
            Return Session("isSupper")
        End Get
        Set(value As Boolean)
            Session("isSupper") = value
        End Set
    End Property

    Public Property isSupvisor As Boolean
        Get
            Return Session("isSupvisor")
        End Get
        Set(value As Boolean)
            Session("isSupvisor") = value
        End Set
    End Property

    Public Property isQualityCancel As Boolean
        Get
            Return Session("isQualityCancel")
        End Get
        Set(value As Boolean)
            Session("isQualityCancel") = value
        End Set
    End Property

    Public Property EnableBt As Boolean
        Get
            Return Session("EnableBt")
        End Get
        Set(value As Boolean)
            Session("EnableBt") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If
        If Not IsPostBack Then

            ' btnSave.Visible = IIf(clsGenClass.GetFieldValue("select status from app_worklist where wl_id='" & ViewState("p1") & "'").Equals("C"), False, True)
            isSupper = IIf(Session("supper_user").ToString = "True", True, False)
            isSupvisor = IIf(GetFieldValue("SELECT IS_SUP FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)

            If isSupper Then
                btnEmpEdit.Visible = True
            Else
                btnEmpEdit.Visible = False
            End If
            If Not (Request.QueryString("p1")) Is Nothing Then
                FillComboSelect(ddlInvestmentAgency, "SELECT type_category , type_desc FROM type_mst WHERE type_code='BK' ")
                FillComboSelect(ddlFinanceEntity, "SELECT type_category , type_desc FROM type_mst WHERE type_code='BK' ")
                FillComboSelect(ddlProcType, "SELECT type_category , type_desc FROM type_mst WHERE type_code='PT' ")
                FillComboSelect(ddlEmployee, "SELECT EMP_NO , EMP_NAME FROM EMP_MST ")
                FillComboSelect(ddlSup, "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A'")
                FillComboSelect(ddlService, "SELECT type_category , type_desc FROM type_mst WHERE type_code='SR' ")
                FillComboSelect(ddlRealEstate, "SELECT type_category , type_desc FROM type_mst WHERE type_code='RT' ")
                FillComboSelect(ddlStatus, "select type_category, type_Desc from type_mst where type_code='RS' and type_category='O'")
                requestId = Request.QueryString("p1").ToString

                FillComboSelect(ddlCity, "SELECT type_category , type_desc FROM type_mst WHERE type_code='CT' ")
                FillComboSelect(ddlWayOfKnow, "SELECT type_category , type_desc FROM type_mst WHERE type_code='WN' ")

            End If
            isQualityCancel = IIf(GetFieldValue("SELECT Q_CANCEL FROM ARS_REQUEST_HDR WHERE DOC_NO='" & requestId & "'") = "Y", True, False)



            ucApprovals.DocNo = requestId
            ucAttachment.requestId = requestId
            EnableBt = False
            loadData()
            If isSupper Or isSupvisor Then
                divDocUpload.Visible = True
                divEval.Visible = True
                divFinalApprove.Visible = True
                divInfoTabs.Visible = True
                divNotes.Visible = True
            Else
                divDocUpload.Visible = False
                divEval.Visible = False
                divFinalApprove.Visible = False
                divInfoTabs.Visible = False
                divNotes.Visible = False
                Dim ReqStatus = GetFieldValue("select status from ars_request_hdr where doc_no='" & requestId & "'")
                If ReqStatus = "D" Or ReqStatus = "C" Then
                    btnInfoEdit.Enabled = False
                End If

            End If

            If isQualityCancel Then
                btnEmpEdit.Enabled = False
                EnableBt = False
                btnStatusCancel.Enabled = False
                btnStatusEdit.Enabled = False
                btnStatusSave.Enabled = False
                btnInitEdit.Enabled = False
                btnInfoCancel.Enabled = False
                btnInfoEdit.Enabled = False
                btnAddInstall.Enabled = False
                btnAddRemarks.Enabled = False
            End If

            If Not (Request.QueryString("p2")) Is Nothing Then '=FOR RECEIPT
                If Request.QueryString("p2").ToString = "RT" Then
                    btnEmpEdit.Visible = False
                    EnableBt = False
                    btnStatusCancel.Visible = False
                    btnStatusEdit.Visible = False
                    btnStatusSave.Visible = False
                    btnInitEdit.Visible = False
                    btnInfoCancel.Visible = False
                    btnInfoEdit.Visible = False
                    btnAddInstall.Visible = False
                    btnAddRemarks.Visible = False
                End If
            End If
        End If

    End Sub


    Private Sub loadData()
        q = ""
        q = q & " Select  h.trs_from as age, h.dept_head, ISNULL(ref_procid,'N') AS req_Importance,ISNULL(H.SERVICE,'F') AS SERVICE,M_REAL_VALUE,MORTEGAGE_VALUE,     "
        q = q & " h.REQ_BY As customer,h.emp_no,H.STATUS,H.CusEstateValue,  "
        q = q & " h.CONTACT_NO AS phone, BK2.TYPE_DESC As BANK_DESC,WE.TYPE_DESC AS WORKPLACE,H.other2 as salary,  "
        q = q & " h.doc_no, Format(h.doc_date,'dd/MM/yyyy')doc_date , h.refcomp_code AS installments ,ISNULL(REF_DOCNO,'O')AS INSTALL_PAY, "
        q = q & " h.other4 as bank,h.other5 as investment_amt,h.other6 as readEstateAmt,h.other7 as corporate,e.emp_name , "
        q = q & "  h.other9 as financeEntity, h.other10 as  EvalutionAmt,h.other11 as PersonalFin, h.other12 as RealEstateFin, h.other13 as  Installment,    "
        q = q & " h.other14 as SupportInst,h.other15 as Longtime,h.other16 as Tax, h.other17 Patch, h.other18 as chequeAmt,h.other19 as CustomerCommition,h.other20 as BankCommition,   "
        q = q & " h.initPersonal,h.initReal,h.initInstall,h.initInSuppInstall,h.initLong,h.initEmpBank,h.EvalEmpBank ,h.service_req,h.realEstate_req "
        q = q & " ,h.CUSTOM_PHONE,h.CITY,h.WAY,h.CUSTOM_STATUS,h.FINAL_STATUS,H.CUST_ID,H.PAY_TRANCODE  "
        q = q & " from ARS_REQUEST_HDR h left join  emp_mst e  on h.emp_no=e.emp_no "
        'q = q & " left join app_worklist  w  on h.doc_no=w.ref_id  "
        'q = q & " left join app_processes p on w.next_process_id=p.process_id "
        q = q & "  left join      (SELECT        TYPE_CODE, TYPE_CATEGORY, TYPE_DESC, TYPE_ABBR, PERCENTAGE, COMP_CODE, CAT_SHORTNAME, REFCOMP_CODE, OTHER_CODE "
        q = q & "               From  TYPE_MST"
        q = q & "        Where (TYPE_CODE = 'BK')) BK2 ON   H.OTHER1 = BK2.TYPE_CATEGORY LEFT JOIN "
        q = q & "        (SELECT        TYPE_CODE, TYPE_CATEGORY, TYPE_DESC, TYPE_ABBR, PERCENTAGE, COMP_CODE, CAT_SHORTNAME, REFCOMP_CODE, OTHER_CODE "
        q = q & "               From  TYPE_MST"
        q = q & "        Where (TYPE_CODE = 'WE')) AS WE ON  H.OTHER3 = WE.TYPE_CATEGORY  "
        q = q & " where H.DOC_NO= '" & requestId & "' "

        Dim dt = GetTable(q)
        If dt.Rows.Count = 0 Then
            dt = GetTableCon(q, "Enjazcon")
        End If
        If dt.Rows.Count > 0 Then
            txtName.Text = dt(0)("customer").ToString
            txtPhone.Text = dt(0)("phone").ToString
            txtBank.Text = dt(0)("BANK_DESC").ToString
            txtSalary.Text = dt(0)("salary").ToString

            txtWorkPlace.Text = dt(0)("WORKPLACE").ToString
            txtAge.Text = dt(0)("age").ToString
            txtDocNo.Text = dt(0)("doc_no").ToString
            txtDocDate.Text = dt(0)("doc_DATE").ToString
            ddlReqImportance.SelectedValue = dt(0)("req_Importance").ToString
            ddlCustomService.SelectedValue = dt(0)("SERVICE").ToString
            txtCusEstateValue.Text = dt(0)("CusEstateValue").ToString
            If dt(0)("SERVICE").ToString = "M" Then
                txtMRealValue.Text = dt(0)("M_REAL_VALUE").ToString
                txtMortegage.Text = dt(0)("MORTEGAGE_VALUE").ToString
                divRealValue.Visible = True
                divMortegage.Visible = True
                divCustomEstateValue.Visible = False
            Else
                divRealValue.Visible = False
                divMortegage.Visible = False
                divCustomEstateValue.Visible = True
            End If

            empNo = dt(0)("emp_no").ToString
            If dt(0)("status").ToString <> "O" And dt(0)("status").ToString <> "C" Then
                divStatus.Visible = True
                btnStatusEdit.Visible = True
                divStatusActions.Visible = True
            End If

            If dt(0)("bank").ToString <> "" Then
                ddlInvestmentAgency.SelectedValue = dt(0)("bank").ToString
                'txtInvestmentIntialAmt.Text = dt(0)("investment_amt").ToString
                txtInitBankEmp.Text = dt(0)("initEmpBank").ToString
                txtRealValue.Text = dt(0)("readEstateAmt").ToString
                txtCustomId.Text = dt(0)("CUST_ID").ToString

                txtInitReal.Text = dt(0)("initReal").ToString
                txtInitPersonal.Text = dt(0)("initPersonal").ToString
                txtInitInstall.Text = dt(0)("initInstall").ToString
                txtInitSuppInstall.Text = dt(0)("initInSuppInstall").ToString
                txtInitLong.Text = dt(0)("initLong").ToString

                If dt(0)("corporate").ToString = "Y" Then
                    ChYes.Checked = True
                Else
                    CheNo.Checked = True
                End If
            End If

            If dt(0)("service_req").ToString <> "" Then
                ddlService.SelectedValue = dt(0)("service_req").ToString
            End If
            If dt(0)("realEstate_req").ToString <> "" Then
                ddlRealEstate.SelectedValue = dt(0)("realEstate_req").ToString
            End If

            If dt(0)("financeEntity").ToString <> "" Then
                ddlFinanceEntity.SelectedValue = dt(0)("financeEntity").ToString
            End If

            If dt(0)("PAY_TRANCODE").ToString <> "" Then
                ddlProcType.SelectedValue = dt(0)("PAY_TRANCODE").ToString
            End If

            If dt(0)("CITY").ToString <> "" Then
                ddlCity.SelectedValue = dt(0)("CITY").ToString
            End If
            If dt(0)("WAY").ToString <> "" Then
                ddlWayOfKnow.SelectedValue = dt(0)("WAY").ToString
            End If

            txtCusPhone.Text = dt(0)("CUSTOM_PHONE").ToString
            txtFinalStatus.Text = dt(0)("FINAL_STATUS").ToString
            txtCustom_status.Text = dt(0)("CUSTOM_STATUS").ToString

            txtEvalBankEmp.Text = dt(0)("EvalEmpBank").ToString
            txtEvalutionAmt.Text = dt(0)("EvalutionAmt").ToString
            txtPersonalFin.Text = dt(0)("PersonalFin").ToString
            txtRealEstateFin.Text = dt(0)("RealEstateFin").ToString
            txtInstallment.Text = dt(0)("Installment").ToString
            txtSupportInst.Text = dt(0)("SupportInst").ToString
            txtLong.Text = dt(0)("Longtime").ToString
            txtTax.Text = dt(0)("Tax").ToString
            txtPatch.Text = dt(0)("Patch").ToString
            txtChequAmt.Text = dt(0)("chequeAmt").ToString
            txtCustomerCommition.Text = dt(0)("CustomerCommition").ToString
            txtBankCommition.Text = dt(0)("BankCommition").ToString
            ' txtEmployee.Text = dt(0)("emp_name").ToString

            If dt(0)("installments").ToString = "Y" Then
                ddlInstall.SelectedValue = "Y"
                'ChInstallYes.Checked = True
                'ChInstallNo.Checked = False
                q = ""
                q = q & " SELECT * FROM INSTALLMENTS WHERE DOC_NO= '" & requestId & "' "

                dtInstallment = GetTable(q)
                If dtInstallment.Rows.Count = 0 Then
                    dtInstallment = GetTableCon(q, "Enjazcon")
                End If
                ViewState("dtInstallment") = dtInstallment

                grdInstall.DataSource = dtInstallment
                grdInstall.DataBind()
                MainClass.SetGridStyle(grdInstall)
                ddlCompPay.SelectedValue = dt(0)("INSTALL_PAY").ToString
                divInstallments.Visible = True
                divCompPay.Visible = True
            Else
                ddlInstall.SelectedValue = "N"
                divInstallments.Visible = False
                divCompPay.Visible = False
            End If

            ddlEmployee.SelectedValue = dt(0)("emp_no").ToString
            If dt(0)("dept_head").ToString <> "" Then
                ddlSup.SelectedValue = dt(0)("dept_head").ToString
            End If



        End If

        Dim CheckInit = GetFieldValue("select wl_id from app_worklist where ref_id='" & requestId & "' and status='C' AND NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "'")
        If CheckInit = "" Then
            CheckInit = GetFieldValueCon("select wl_id from app_worklist where ref_id='" & requestId & "' and status='C' AND NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "'", "Enjazcon")
        End If
        If CheckInit <> "" Then
            btnInitEdit.Visible = True
        Else
            btnInitEdit.Visible = False
        End If

        Dim CheckEval = GetFieldValue("select wl_id from app_worklist where ref_id='" & requestId & "' and status='C' AND NEXT_PROCESS_ID='" & AppProcess.ProcEval.ToString.ToUpper & "'")
        If CheckEval = "" Then
            CheckEval = GetFieldValueCon("select wl_id from app_worklist where ref_id='" & requestId & "' and status='C' AND NEXT_PROCESS_ID='" & AppProcess.ProcEval.ToString.ToUpper & "'", "Enjazcon")
        End If
        If CheckEval <> "" Then
            btEvalEdit.Visible = True
            EnableBt = True
        Else
            btEvalEdit.Visible = False
            EnableBt = False
        End If

        Dim ChecFinal = GetFieldValue("select wl_id from app_worklist where ref_id='" & requestId & "' and status='C' AND NEXT_PROCESS_ID='" & AppProcess.ProcFinalAppr.ToString.ToUpper & "'")
        If ChecFinal = "" Then
            ChecFinal = GetFieldValueCon("select wl_id from app_worklist where ref_id='" & requestId & "' and status='C' AND NEXT_PROCESS_ID='" & AppProcess.ProcFinalAppr.ToString.ToUpper & "'", "Enjazcon")
        End If
        If ChecFinal <> "" Then
            btFinalEdit.Visible = True

        Else
            btFinalEdit.Visible = False

        End If

    End Sub


    Protected Sub btnAddRemarks_Click(sender As Object, e As EventArgs)
        If txtRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الملاحظة ")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False

        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        AppWl.WL03ProcessCode = AppProcess.ProcCheck.ToString.ToUpper
                        AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                        AppWl.WL05RefID = requestId
                        ' AppWl.WL99RefWLID = ViewState("p1")
                        AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL121ClosedRemarks = txtRemarks.Text.ToString
                        AppWl.WL11ClosedDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL12ClosedBy = Session("user_id").ToString

                        AppWl.WL07Priority = "N"
                        AppWl.WL08CompCode = AppWl.WL08CompCode
                        AppWl.WL09SysUserID = AppWl.WL09SysUserID
                        AppWl.WL13Status = "C"

                        AppWl.WL14NextProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
                        AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & "(ملاحظة إشراف)"
                        AppWl.WL16RefStationID = ""
                        AppWl.WL17RefTask = ""
                        AppWl.WL18RefOther = "R"
                        AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper


                        ' AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                        AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        AppWl.WL98OnlyOwner = Session("emp_no").ToString

                        'AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        'AppWl.WL98OnlyOwner = ddlEmployee.SelectedValue.ToString
                        AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                        AppWl.WL99ModuleID = "R"
                        AppWl.WL99ApprLevel = "0"
                        InsertRemarks(cn, cmd, AppWl)
                        'InsertNewRemarks(cn, cmd, AppWl)
                        'InsertWorklist(cn, cmd, AppWl)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            '  RedirectURL("../pages/Worklist.aspx")
            txtRemarks.Text = ""
            ucApprovals.DocNo = requestId
            ' Page_Load(Nothing, Nothing)
        End If
    End Sub

    Protected Sub btnInitEdit_Click(sender As Object, e As EventArgs)
        btnInitEdit.Enabled = False
        btnInitSave.Visible = True
        btnInitCancel.Visible = True
        ddlInvestmentAgency.Enabled = True
        ddlService.Enabled = True
        ddlRealEstate.Enabled = True
        'txtInvestmentIntialAmt.ReadOnly = False
        txtInitBankEmp.ReadOnly = False
        txtInitReal.ReadOnly = False
        txtInitPersonal.ReadOnly = False
        txtInitInstall.ReadOnly = False
        txtInitSuppInstall.ReadOnly = False
        txtInitLong.ReadOnly = False
        txtRealValue.ReadOnly = False
        txtCustomId.ReadOnly = False
        CheNo.Enabled = True
        ChYes.Enabled = True
        'ddlEmployee.Enabled = True

        ddlCity.Enabled = True
        ddlWayOfKnow.Enabled = True
        txtCustom_status.ReadOnly = False
        txtCusPhone.ReadOnly = False

    End Sub

    Protected Sub btnInitCancel_Click(sender As Object, e As EventArgs)
        btnInitEdit.Enabled = True
        btnInitSave.Visible = False
        btnInitCancel.Visible = False
        ddlInvestmentAgency.Enabled = False
        'txtInvestmentIntialAmt.ReadOnly = True
        txtInitBankEmp.ReadOnly = True
        txtInitReal.ReadOnly = True
        txtInitPersonal.ReadOnly = True
        txtInitInstall.ReadOnly = True
        txtInitSuppInstall.ReadOnly = True
        txtInitLong.ReadOnly = True
        txtRealValue.ReadOnly = True
        txtCustomId.ReadOnly = True
        CheNo.Enabled = False
        ChYes.Enabled = False
        'ddlEmployee.Enabled = False
        ddlRealEstate.Enabled = False
        ddlService.Enabled = False

        ddlCity.Enabled = False
        ddlWayOfKnow.Enabled = False
        txtCustom_status.ReadOnly = True
        txtCusPhone.ReadOnly = True

        loadData()
    End Sub
    Protected Sub btnInitSave_Click(sender As Object, e As EventArgs)
        If ddlInvestmentAgency.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر البنك")
            Exit Sub
        End If
        'If txtInvestmentIntialAmt.Text = "" Then
        '    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الحسبة")
        '    Exit Sub
        'End If
        If txtInitBankEmp.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل موظف البنك")
            Exit Sub
        End If

        If txtInitReal.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ التمويل العقاري")
            Exit Sub
        End If
        If txtInitPersonal.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ التمويل الشخصي")
            Exit Sub
        End If
        If txtInitInstall.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ القسط")
            Exit Sub
        End If
        If txtInitSuppInstall.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ قسط الدعم")
            Exit Sub
        End If
        If txtInitLong.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل المدة")
            Exit Sub
        End If



        If ddlService.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر الخدمة المطلوبة")
            Exit Sub
        End If

        If ddlRealEstate.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر العقار المطلوب")
            Exit Sub
        End If

        If txtRealValue.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل قيمة العقار")
            Exit Sub
        End If

        If txtCustomId.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل هوية المالك")
            Exit Sub
        End If


        If ChYes.Checked <> True And CheNo.Checked <> True Then
            ShowPopUpMsg(Me.Page, "فضلا حدد اذا هناك متضامن ام لا ")
            Exit Sub
        End If

        If ddlWayOfKnow.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد طريقة معرفة العميل بالشركة")
            Exit Sub
        End If
        If ddlCity.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد مدينة العقار")
            Exit Sub
        End If

        If txtCusPhone.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل جوال المالك")
            Exit Sub
        End If
        If txtCustom_status.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اكتب شرح لحالة العميل ")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)


                        q = ""
                        q = q & "    update ars_request_hdr set other4='" & ddlInvestmentAgency.SelectedValue.ToString & "',other6='" & txtRealValue.Text & "',other7='" & IIf(ChYes.Checked, "Y", "N") & "',initPersonal='" & txtInitPersonal.Text & "',initReal='" & txtInitReal.Text & "',initInstall='" & txtInitInstall.Text & "',initInSuppInstall='" & txtInitSuppInstall.Text & "',initLong='" & txtInitLong.Text & "',initEmpBank=N'" & txtInitBankEmp.Text & "',service_req='" & ddlService.SelectedValue.ToString & "',realEstate_req='" & ddlRealEstate.SelectedValue.ToString & "' "
                        q = q & "  , CUSTOM_PHONE= '" & txtCusPhone.Text & "',CITY='" & ddlCity.SelectedValue.ToString & "' ,WAY='" & ddlWayOfKnow.SelectedValue.ToString & "',CUSTOM_STATUS= N'" & txtCustom_status.Text.ToString & "', CUST_ID='" & txtCustomId.Text & "' "
                        q = q & "    where doc_no = '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()

                        RunInOtherDb(q)

                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()
                Finally
                    '  cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            btnInitCancel_Click(Nothing, Nothing)
            'loadData()
        End If


    End Sub






    Protected Sub btEvalEdit_Click(sender As Object, e As EventArgs)
        btEvalEdit.Enabled = False
        btEvalCancel.Visible = True
        btEvalSave.Visible = True
        txtEvalutionAmt.ReadOnly = False
        txtEvalBankEmp.ReadOnly = False
        ddlFinanceEntity.Enabled = True
        ddlProcType.Enabled = True

        ddlInstall.Enabled = True
        ddlCompPay.Enabled = True
        btnAddInstall.Enabled = True
        txtInstallAmt.ReadOnly = False
        txtInstallmentFinanceEntity.ReadOnly = False
        EnableBt = True
        If ddlInstall.SelectedValue = "Y" Then
            q = ""
            q = q & " SELECT * FROM INSTALLMENTS WHERE DOC_NO= '" & requestId & "' "

            dtInstallment = GetTable(q)
            If dtInstallment.Rows.Count = 0 Then
                dtInstallment = GetTableCon(q, "Enjazcon")
            End If

            ViewState("dtInstallment") = dtInstallment

            grdInstall.DataSource = dtInstallment
            grdInstall.DataBind()
            MainClass.SetGridStyle(grdInstall)
        End If
    End Sub

    Protected Sub btEvalCancel_Click(sender As Object, e As EventArgs)
        btEvalEdit.Enabled = True
        btEvalCancel.Visible = False
        btEvalSave.Visible = False
        txtEvalutionAmt.ReadOnly = True
        txtEvalBankEmp.ReadOnly = True
        ddlFinanceEntity.Enabled = False
        ddlProcType.Enabled = False

        ddlInstall.Enabled = False
        ddlCompPay.Enabled = False
        btnAddInstall.Enabled = False
        txtInstallAmt.ReadOnly = True
        txtInstallmentFinanceEntity.ReadOnly = True
        EnableBt = False

        loadData()
    End Sub

    Protected Sub btEvalSave_Click(sender As Object, e As EventArgs)
        If txtEvalutionAmt.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا مبلغ التمويل")
            Exit Sub
        End If
        'If txtEvalBankEmp.Text = "" Then
        '    ShowPopUpMsg(Me.Page, "فضلا ادخل موظف البنك")
        '    Exit Sub
        'End If

        If ddlFinanceEntity.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر جهة التمويل")
            Exit Sub
        End If

        If ddlProcType.SelectedValue.ToString = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد سير المعاملة")
            Exit Sub
        End If


        If ddlInstall.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا حدد اذا كان هناك التزام علي العميل ام لا ")
            Exit Sub
        End If
        If ddlInstall.SelectedValue = "Y" And grdInstall.Rows.Count < 1 Then
            ShowPopUpMsg(Me.Page, "فضلااضف بيانات الاقساط من خلال الضغط على + ")
            Exit Sub
        End If
        If ddlInstall.SelectedValue = "Y" Then
            If ddlCompPay.SelectedValue = "" Then
                ShowPopUpMsg(Me.Page, "فضلا حدد جهة سداد الالتزامات المالية")
                Exit Sub
            End If
        End If


        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)


                        q = ""
                        q = q & " update ars_request_hdr set other9='" & ddlFinanceEntity.SelectedItem.Value & "',PAY_TRANCODE='" & ddlProcType.SelectedValue.ToString & "', other10='" & txtEvalutionAmt.Text & "',EvalEmpBank=N'" & txtEvalBankEmp.Text & "' "
                        q = q & "  ,refcomp_code='" & ddlInstall.SelectedValue.ToString & "'"
                        q = q & "   ,REF_DOCNO='" & IIf(ddlInstall.SelectedValue = "Y", ddlCompPay.SelectedValue.ToString, "") & "'  "
                        q = q & " where doc_no = '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()

                        RunInOtherDb(q)

                        q = ""
                        q = q & "  DELETE FROM INSTALLMENTS WHERE DOC_NO='" & requestId & "' "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(q)
                        If ddlInstall.SelectedValue = "Y" Then
                            dtInstallment = ViewState("dtInstallment")
                            For Each r In dtInstallment.Rows
                                q = ""
                                q = q & "  INSERT INTO INSTALLMENTS  "
                                q = q & "   (DOC_NO,"
                                q = q & "   installAmt ,"
                                q = q & "   InstallmentEntity"
                                q = q & "   ) VALUES "
                                q = q & "   ( '" & requestId & "' , "
                                q = q & "    '" & r("installAmt").ToString & "' , "
                                q = q & "    N'" & r("InstallmentEntity").ToString & "'  "
                                q = q & "      "
                                q = q & "    ) "


                                cmd.CommandText = q
                                cmd.ExecuteNonQuery()
                                'RunInOtherDb
                            Next
                        End If

                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()
                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            btEvalCancel_Click(Nothing, Nothing)
            'loadData()
        End If

    End Sub

    Protected Sub btFinalEdit_Click(sender As Object, e As EventArgs)
        btFinalEdit.Enabled = False
        btFinalCancel.Visible = True
        btFinalSave.Visible = True
        txtPersonalFin.ReadOnly = False
        txtRealEstateFin.ReadOnly = False
        txtInstallment.ReadOnly = False
        txtSupportInst.ReadOnly = False
        txtLong.ReadOnly = False
        txtTax.ReadOnly = False
        txtPatch.ReadOnly = False
        txtChequAmt.ReadOnly = False
        txtCustomerCommition.ReadOnly = False
        txtBankCommition.ReadOnly = False
        txtFinalStatus.ReadOnly = False

    End Sub

    Protected Sub btFinalCancel_Click(sender As Object, e As EventArgs)
        btFinalEdit.Enabled = True
        btFinalCancel.Visible = False
        btFinalSave.Visible = False
        txtPersonalFin.ReadOnly = True
        txtRealEstateFin.ReadOnly = True
        txtInstallment.ReadOnly = True
        txtSupportInst.ReadOnly = True
        txtLong.ReadOnly = True
        txtTax.ReadOnly = True
        txtPatch.ReadOnly = True
        txtChequAmt.ReadOnly = True
        txtCustomerCommition.ReadOnly = True
        txtBankCommition.ReadOnly = True
        txtFinalStatus.ReadOnly = True



        loadData()
    End Sub

    Protected Sub imgInstallDel_Command(sender As Object, e As CommandEventArgs)

        If grdInstall.Rows.Count > 1 Then
            dtInstallment = ViewState("dtInstallment")
            dtInstallment.Rows.Remove(dtInstallment.Rows(Int(e.CommandArgument)))
            dtInstallment.AcceptChanges()
        Else

            dtInstallment = ViewState("dtInstallment")
            If dtInstallment Is Nothing Then
                Exit Sub
            End If
            If dtInstallment.Rows.Count <> 0 Then
                dtInstallment.Rows.Remove(dtInstallment.Rows(Int(e.CommandArgument)))
                dtInstallment.AcceptChanges()

            End If


            ViewState("dtInstallment") = Nothing

            'Exit Sub

        End If





        grdInstall.DataSource = dtInstallment
        grdInstall.DataBind()
        SetGridStyle(grdInstall, True)
        ViewState("dtInstallment") = dtInstallment
        'ViewState("Action") = clsGlobalVar.FormState.adStateDeleteMode
        'AddDel()
    End Sub

    Protected Sub btFinalSave_Click(sender As Object, e As EventArgs)
        If txtPersonalFin.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ التويل الشخصي")
            Exit Sub
        End If

        If txtRealEstateFin.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ التويل العقاري")
            Exit Sub
        End If

        If txtInstallment.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ القسط")
            Exit Sub
        End If

        If txtSupportInst.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ قسط الدعم")
            Exit Sub
        End If

        If txtLong.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل المدة")
            Exit Sub
        End If

        If txtTax.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الضريبة")
            Exit Sub
        End If

        If txtChequAmt.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الشيك")
            Exit Sub
        End If

        If txtCustomerCommition.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ السعي من العميل")
            Exit Sub
        End If


        If txtBankCommition.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ السعي من البنك")
            Exit Sub
        End If

        If txtFinalStatus.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا تحقق من الملاحظة")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)


                        q = ""
                        q = q & "   update ars_request_hdr set other11='" & txtPersonalFin.Text & "',other12='" & txtRealEstateFin.Text & "', "
                        q = q & "   other13 ='" & txtInstallment.Text & "',other14='" & txtSupportInst.Text & "',other15='" & txtLong.Text & "', "
                        q = q & "   other16 ='" & txtTax.Text & "',other17='" & txtPatch.Text & "',other18='" & txtChequAmt.Text & "',other19= '" & txtCustomerCommition.Text & "',other20='" & txtBankCommition.Text & "'  "
                        q = q & "  , FINAL_STATUS =N'" & txtFinalStatus.Text & "' "
                        q = q & "    where doc_no= '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()

                        RunInOtherDb(q)

                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()
                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            btFinalCancel_Click(Nothing, Nothing)
            ' loadData()
        End If

    End Sub

    Protected Sub btnEmpEdit_Click(sender As Object, e As EventArgs)
        If GetFieldValue("select ref_id from app_worklist where ref_id='" & requestId & "' and next_process_id='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "'") <> "" Then
            ddlEmployee.Enabled = True
            ddlSup.Enabled = True
            btnEmpSave.Visible = True
            btnEmpCancel.Visible = True
            btnEmpEdit.Enabled = False
        Else
            ShowPopUpMsg(Me.Page, "يمكن تعديل الطلب بعد اسناد الطلب لموظف")
        End If
    End Sub

    Protected Sub btnEmpSave_Click(sender As Object, e As EventArgs)
        If ddlEmployee.SelectedItem.Value = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر الموظف")
            Exit Sub
        End If

        If ddlSup.SelectedItem.Value <> "" Then
            Dim CHECK_SUP = GetFieldValue("SELECT EMP_NO FROM EMP_MST WHERE STATUS_FLAG='A' AND IS_SUP='Y' AND EMP_NO='" & ddlSup.SelectedValue.ToString & "' ")
            If CHECK_SUP = "" Then
                ShowPopUpMsg(Me.Page, "هذا الموظف ليس بمشرف")
                Exit Sub
            End If
        End If

        If empNo <> ddlEmployee.SelectedItem.Value.ToString Then
            If GetFieldValue("SELECT STATUS_FLAG FROM EMP_MST WHERE EMP_NO='" & ddlEmployee.SelectedItem.Value.ToString & "'") = "N" Then
                ShowPopUpMsg(Me.Page, "لا يمكن اسناد الطلب لموظف غير نشط")
                Exit Sub
            End If
        End If

        If GetFieldValue("SELECT REF_ID FROM APP_WORKLIST WHERE REF_ID='" & requestId & "' AND  REF_ID in (select ref_id from app_worklist where next_process_id NOT IN ('" & AppProcess.ProcUploadDoc.ToString.ToUpper & "','" & AppProcess.ProcCreate.ToString.ToUpper & "','" & AppProcess.ProcCheck.ToString.ToUpper & "') and status='O') ") <> "" Then
        Else
            ShowPopUpMsg(Me.Page, "يتم تحويل الطلبات المرفوعة فقط من هنا")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)


                        q = ""
                        q = q & " update ars_request_hdr set emp_no='" & ddlEmployee.SelectedItem.Value.ToString & "',dept_head='" & ddlSup.SelectedItem.Value.ToString & "' where doc_no= '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()

                        RunInOtherDb(q)

                        Dim wl_id = GetFieldValue("select wl_id from app_worklist where ref_id='" & requestId & "' and next_process_id='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "' and status='O'")
                        If wl_id <> "" Then
                            q = ""
                            q = q & " update app_workowner  set owner='" & ddlEmployee.SelectedItem.Value.ToString & "' where wl_id= '" & wl_id & "'   "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()

                            RunInOtherDb(q)
                        End If

                        'Dim SupWl_id = GetFieldValue("select wl_id from app_worklist where ref_id='" & requestId & "' and next_process_id='" & AppProcess.ProcAssign.ToString.ToUpper & "' and status='O'")
                        Dim SupWl_id = GetFieldValue("select wl_id from app_workowner where wl_id in (select wl_id from app_worklist where ref_id='" & requestId & "' and status='O') and OWNER=(SELECT SUP FROM EMP_MST WHERE EMP_NO='" & empNo & "')")
                        If SupWl_id <> "" Then
                            q = ""
                            q = q & " update app_workowner  set owner='" & ddlSup.SelectedItem.Value.ToString & "' where wl_id= '" & SupWl_id & "'   "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()
                            RunInOtherDb(q)

                        End If


                        If empNo <> ddlEmployee.SelectedItem.Value.ToString Then
                            Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                            AppWl.WL03ProcessCode = AppProcess.ProcCreate.ToString.ToUpper
                            AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                            AppWl.WL05RefID = requestId
                            ' AppWl.WL99RefWLID = ViewState("p1")
                            AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                            AppWl.WL07Priority = "N"
                            AppWl.WL08CompCode = AppWl.WL08CompCode
                            AppWl.WL09SysUserID = AppWl.WL09SysUserID
                            AppWl.WL13Status = "P"
                            AppWl.WL19SubProc2 = empNo
                            AppWl.WL14NextProcessCode = AppProcess.ProcTrans.ToString.ToUpper
                            AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                            AppWl.WL16RefStationID = ""
                            AppWl.WL17RefTask = ""
                            AppWl.WL18RefOther = "R"
                            AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper
                            AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                            AppWl.WL98OnlyOwner = ddlEmployee.SelectedValue.ToString
                            AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                            AppWl.WL99ModuleID = "R"
                            AppWl.WL99ApprLevel = "0"
                            InsertWorklist(cn, cmd, AppWl)

                        End If


                    End Using


                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()
                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            btnEmpCancel_Click(Nothing, Nothing)
            loadData()
        End If
    End Sub

    Protected Sub btnEmpCancel_Click(sender As Object, e As EventArgs)
        ddlEmployee.Enabled = False
        ddlSup.Enabled = False
        btnEmpSave.Visible = False
        btnEmpCancel.Visible = False
        btnEmpEdit.Enabled = True
        loadData()
    End Sub

    Protected Sub btnStatusEdit_Click(sender As Object, e As EventArgs)
        ddlStatus.Enabled = True
        btnStatusCancel.Visible = True
        btnStatusSave.Visible = True
    End Sub

    Protected Sub btnAddInstall_Click(sender As Object, e As EventArgs)
        AddDelInstall()
    End Sub

    Public Sub CreateTableInstall()
        dtInstallment = New DataTable
        dtInstallment.Columns.Add("installAmt", Type.GetType("System.String"))
        dtInstallment.Columns.Add("InstallmentEntity", Type.GetType("System.String"))

        ViewState("dtInstallment") = dtInstallment

        grdInstall.DataSource = dtInstallment
        grdInstall.DataBind()
        MainClass.SetGridStyle(grdInstall)
    End Sub

    Private Sub AddDelInstall()
        If txtInstallAmt.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل المبلغ  ")
            Exit Sub
        End If

        If txtInstallmentFinanceEntity.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل وصف وشرح للمبلغ ")
            Exit Sub
        End If

        If ViewState("dtInstallment") Is Nothing Then
            CreateTableInstall()
        Else
            dtInstallment = ViewState("dtInstallment")

        End If

        Dim nr As DataRow = dtInstallment.NewRow
        nr("installAmt") = txtInstallAmt.Text
        nr("InstallmentEntity") = txtInstallmentFinanceEntity.Text








        dtInstallment.Rows.Add(nr)


        ViewState("dtInstallment") = dtInstallment




        grdInstall.DataSource = dtInstallment
        grdInstall.DataBind()
        MainClass.SetGridStyle(grdInstall)


    End Sub

    Protected Sub btnStatusSave_Click(sender As Object, e As EventArgs)
        If ddlStatus.SelectedItem.Value = "" Then
            ShowPopUpMsg(Me.Page, "فضلا اختر الحالة")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        If GetFieldValue(cn, cmd, "SELECT STATUS FROM ARS_REQUEST_HDR WHERE DOC_NO='" & requestId & "'  ") <> "O" Then
                            q = ""
                            q = q & " update ars_request_hdr set status='" & ddlStatus.SelectedItem.Value.ToString & "' where doc_no= '" & requestId & "'   "
                            cmd.CommandText = q
                            cmd.ExecuteNonQuery()

                            RunInOtherDb(q)

                            Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                            AppWl.WL03ProcessCode = AppProcess.ProcQuality.ToString.ToUpper
                            AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                            AppWl.WL05RefID = requestId
                            ' AppWl.WL99RefWLID = ViewState("p1")
                            AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                            AppWl.WL07Priority = "N"
                            AppWl.WL08CompCode = AppWl.WL08CompCode
                            AppWl.WL09SysUserID = AppWl.WL09SysUserID
                            AppWl.WL13Status = "O"
                            ' If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                            AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper()
                            AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                            AppWl.WL16RefStationID = ""
                            AppWl.WL17RefTask = ""
                            AppWl.WL18RefOther = "R"
                            AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                            AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                            AppWl.WL98OnlyOwner = ddlEmployee.SelectedValue.ToString
                            'If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                            AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"



                            AppWl.WL99ModuleID = "R"
                            AppWl.WL99ApprLevel = "0"
                            InsertWorklist(cn, cmd, AppWl)




                            'q = ""
                            'q = q & " update app_worklist set status='" & ddlStatus.SelectedItem.Value.ToString & "' where ref_id= '" & requestId & "'  and status not in ('C','O','U','P')  "
                            'cmd.CommandText = q
                            'cmd.ExecuteNonQuery()

                        End If

                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()
                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            btnStatusCancel_Click(Nothing, Nothing)
            loadData()
        End If
    End Sub

    Protected Sub btnStatusCancel_Click(sender As Object, e As EventArgs)
        ddlStatus.Enabled = False
        btnStatusCancel.Visible = False
        btnStatusSave.Visible = False
    End Sub

    Protected Sub btnInfoEdit_Click(sender As Object, e As EventArgs)
        btnInfoEdit.Enabled = False
        btnInfoSave.Visible = True
        btnInfoCancel.Visible = True
        If isSupper Or isSupvisor Then
            txtPhone.ReadOnly = False
            txtSalary.ReadOnly = False
            txtName.ReadOnly = False
            ddlReqImportance.Enabled = True
            ddlCustomService.Enabled = True
            txtMRealValue.ReadOnly = False
            txtMortegage.ReadOnly = False
            txtCusEstateValue.ReadOnly = False
        Else
            txtName.ReadOnly = False
            ddlReqImportance.Enabled = True
        End If
    End Sub

    Protected Sub btnInfoSave_Click(sender As Object, e As EventArgs)

        If txtName.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا تحقق من اسم العميل")
            Exit Sub
        End If

        If txtPhone.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا تحقق من جوال العميل")
            Exit Sub
        End If

        If txtSalary.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا تحقق من راتب العميل")
            Exit Sub
        End If
        If ddlCustomService.SelectedValue = "M" Then
            If txtMRealValue.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل القيمة السوقية للعقار")
                Exit Sub
            End If
            If txtMortegage.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الرهن")
                Exit Sub
            End If
        End If
        If ddlCustomService.SelectedValue = "F" Then
            If txtCusEstateValue.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل قيمة العقار ان وجد وان لم يوجد ادخل 0")
                Exit Sub
            End If
        End If

        If GetFieldValue("SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE LTRIM(RTRIM(CONTACT_NO)) = LTRIM(RTRIM(N'" & txtPhone.Text & "')) AND DOC_NO <> '" & requestId & "'  ") <> "" Then
            ShowPopUpMsg(Me.Page, "هناك طلب اخر بنفس رقم الجوال")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)


                        q = ""
                        q = q & " update ars_request_hdr set REQ_BY=N'" & txtName.Text & "', contact_no=N'" & txtPhone.Text & "',other2='" & txtSalary.Text & "',ref_procid='" & ddlReqImportance.SelectedValue.ToString() & "',SERVICE='" & ddlCustomService.SelectedValue.ToString() & "',M_REAL_VALUE='" & txtMRealValue.Text.ToString() & "',MORTEGAGE_VALUE='" & txtMortegage.Text.ToString() & "',CusEstateValue='" & txtCusEstateValue.Text.ToString() & "' where doc_no= '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()

                        RunInOtherDb(q)

                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()
                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            btnInfoCancel_Click(Nothing, Nothing)
            'loadData()
        End If

    End Sub

    Protected Sub btnInfoCancel_Click(sender As Object, e As EventArgs)
        btnInfoEdit.Enabled = True
        btnInfoSave.Visible = False
        btnInfoCancel.Visible = False
        txtPhone.ReadOnly = True
        txtSalary.ReadOnly = True
        txtName.ReadOnly = True
        ddlReqImportance.Enabled = False
        ddlCustomService.Enabled = False
        txtMRealValue.ReadOnly = True
        txtMortegage.ReadOnly = True
        txtCusEstateValue.ReadOnly = True
        loadData()
    End Sub

    Protected Sub ddlSup_SelectedIndexChanged(sender As Object, e As EventArgs)
        If ddlSup.SelectedValue.ToString <> "" Then
            FillComboSelect(ddlEmployee, "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE  SUP='" & ddlSup.SelectedValue.ToString & "' ")
        End If
    End Sub
    Protected Sub ddlInstall_SelectedIndexChanged(sender As Object, e As EventArgs)
        If ddlInstall.SelectedValue.ToString = "Y" Then
            divInstallments.Visible = True
            divCompPay.Visible = True
        Else
            divInstallments.Visible = False
            divCompPay.Visible = False
        End If
    End Sub

    Protected Sub ddlCustomService_SelectedIndexChanged(sender As Object, e As EventArgs)
        If ddlCustomService.SelectedValue.ToString = "M" Then
            divRealValue.Visible = True
            divMortegage.Visible = True
        Else
            txtRealValue.Text = ""
            txtMortegage.Text = ""
            divRealValue.Visible = False
            divMortegage.Visible = False
        End If
    End Sub
End Class

Contents of ucReqHistory.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucReqHistory.ascx.vb" Inherits="EnjazVB.ucReqHistory" %>
  <%@ Register Src="~/Controls/ucCustomerInfo.ascx" TagPrefix="uc1" TagName="ucCustomerInfo" %>
<%@ Register Src="~/Controls/ucApprovals.ascx" TagPrefix="uc1" TagName="ucApprovals" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>                
                <div class="form-horizontal">
                    <div  class="form-group">
                             <%--   <div class="col-sm-1 control-label">
                                    <label>
                                        <asp:Localize ID="Localize2" runat="server" meta:resourcekey="Localize2Resource1" Text="حالة الطلب"></asp:Localize></label>
                                </div>--%>
                                <div class="col-sm-3">
                                    <asp:DropDownList ID="ddlStatus" CssClass="form-control" runat="server" AutoPostBack="True"
                                        OnSelectedIndexChanged="ddlStatus_SelectedIndexChanged" >
                                    </asp:DropDownList>
                                </div>

                         <div runat="server" visible="false" id="divCancelType" class="col-sm-2">
                              <asp:DropDownList ID="ddlCancelType" CssClass="form-control" runat="server" OnSelectedIndexChanged="ddlCancelType_SelectedIndexChanged"
                                  AutoPostBack="True"
                                        >
                                    </asp:DropDownList>
                             </div>

                        <%-- <div class="col-sm-1 control-label">
                                    <label>
                                        <asp:Localize ID="Localize1" runat="server"  Text="مرحلة الطلب"></asp:Localize></label>
                                </div>--%>
                                <div runat="server" id="StepDiv" class="col-sm-2">
                                    <asp:DropDownList ID="ddlStep" CssClass="form-control" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlStep_SelectedIndexChanged"
                                        >
                                    </asp:DropDownList>
                                </div>

                         <%--<div class="col-sm-1 control-label">
                                    <label>
                                        <asp:Localize ID="Localize4" runat="server"  Text="جهة السداد"></asp:Localize></label>
                                </div>--%>
                                <div class="col-sm-2">
                                     <asp:DropDownList ID="ddlCompPay" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlCompPay_SelectedIndexChanged" CssClass="form-control" Width="100%">
                                                 <asp:ListItem Text="-جهة السداد-" Value=""></asp:ListItem>
                                         <asp:ListItem Text="سداد عن طريق الشركة" Value="C"></asp:ListItem>
                                                <asp:ListItem Text="سداد من خارج الشركة" Value="O"></asp:ListItem>
                                            </asp:DropDownList>
                                    </div>

                          <div class="col-sm-2">
                               <asp:DropDownList ID="ddlCustomService"  runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlCustomService_SelectedIndexChanged" CssClass="form-control" Width="100%">
                                               <asp:ListItem Text="-الخدمة المطلوبة-" Value=""></asp:ListItem>
                                   <asp:ListItem Value="F" Text="تمويل" ></asp:ListItem>
                                             <asp:ListItem Value="M" Text="فك رهن واعادة تمويل" ></asp:ListItem>
                                            </asp:DropDownList>
                              </div>

                          <div runat="server" id="divSup" class="col-sm-3">
                                    <asp:DropDownList ID="ddlSup" CssClass="form-control" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlSup_SelectedIndexChanged"
                                        >
                                    </asp:DropDownList>
                                </div>
                         
                   
                        </div>

                          <div class="form-group">
                        
                                     <div style="overflow: auto;">
                            <div style="direction:rtl;" class="table-responsive">
<%--                                <asp:GridView ID="grdWL"   CssClass="table table-hover table-striped" runat="server" AllowPaging="True" PageSize="100" AllowCustomPaging="True" AllowSorting="True"    AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%" meta:resourcekey="grdWLResource1">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />--%>
                                                                <asp:GridView ID="grdWL" PageSize="100"   CssClass="table table-hover table-striped" runat="server" AllowPaging="True" AllowCustomPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%" >
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource1">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnRefresh" runat="server" CssClass="btn btn-primary btn-sm pull-right"  ToolTip="Refresh" meta:resourcekey="btnRefreshResource1" Text="
                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-refresh&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblSrNo" runat="server" Text='<%# Eval("srno") %>' meta:resourcekey="lblSrNoResource1"></asp:Label>
<%--                                                <asp:HiddenField ID="hwl_days" runat="server" Value='<%# Eval("wl_days") %>' />--%>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>  
                                        
                                         <asp:TemplateField >
                                          <HeaderTemplate>
                                              <asp:LinkButton ID="btQuality"  Enabled='<%# IIf(isSupper Or isSupvisor Or (isQulity And isSupvisor), True, False) %>'    runat="server" OnCommand="btnQuality_Command" Text="تحويل" CssClass="control-label" Style="color: white;" ></asp:LinkButton>
                                              <br />
                                              <asp:LinkButton ID="btnChangeCateg"  Enabled='<%# IIf(isSupper Or isSupvisor Or (isQulity And isSupvisor), True, False) %>'     runat="server"  OnCommand="btnChangeCateg_Command"   Text='<%# IIf(IsCateg, " إزالة تصنيف", "تصنيف") %>' CssClass="control-label" Style="color: white;" ></asp:LinkButton>
                                           </HeaderTemplate>

                                             <%-- <HeaderTemplate>
                                                            <asp:LinkButton ID="lblSEND" runat="server" Text="اسناد الطلب"  CssClass="control-label" Style="color: white;" OnCommand="btnSend_Command"  ></asp:LinkButton>
                                                 </HeaderTemplate>--%>

                                                <ItemTemplate>
                                                            <asp:CheckBox ID="chk" Enabled='<%# IIf((isSupper Or isSupvisor Or (isQulity And isSupvisor)) And (Eval("Q_CANCEL").ToString <> "Y" Or isSupper Or isQulity) And Eval("STATUS_CODE").ToString <> "C" And Eval("UPLOADED").ToString = "", True, False) %>' runat="server"   />
                                                        </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>


                                     <asp:TemplateField Visible="false" >
                                          <HeaderTemplate>
                                              <asp:LinkButton ID="btQualityCancel"  Enabled='<%# IIf((isQulity And isSupvisor), True, False) %>'    runat="server" OnCommand="btQualityCancel_Command" Text="إلغاء" CssClass="control-label" Style="color: white;" ></asp:LinkButton>
                                           </HeaderTemplate>
                                                     <ItemTemplate>
                                                            <asp:CheckBox ID="chkCancel" Enabled='<%# IIf(((isQulity And isSupvisor)) And (Eval("Q_CANCEL").ToString <> "Y") And  Eval("STATUS_CODE").ToString = "D", True, False) %>' runat="server"   />
                                                        </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="رقم الطلب" SortExpression="doc_no" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lbldoc_no" runat="server" Text="رقم الطلب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="ref_id" ></asp:LinkButton>
                                                <asp:TextBox ID="ref_id" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton ID="btnRefStep" runat="server" OnCommand="btnStep_Command"
                                                     Text='<%# Bind("ref_id") %>'
                                                    ToolTip="Click to open the details" CommandName="Step" CommandArgument='<%# string.Concat(Eval("ref_id"), ",", Eval("ref_id"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <%-- Enabled='<%# IIf(isSupper Or isSupvisor, True, False) %>'--%>
                                             <asp:TemplateField >
                                          <ItemTemplate>
                                              <asp:LinkButton ID="btDetails" Enabled="true"  runat="server" OnCommand="btnStep_Command"
                                                Text="<i aria-hidden='true' class='glyphicon glyphicon-pencil'></i>"
                                                    ToolTip="Click to open the details" CommandName="Detail" CommandArgument='<%#String.Concat(Eval("ref_id"), ",", Eval("ref_id"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                         
 <asp:TemplateField HeaderText="العميل" SortExpression="customer" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFcustomer" runat="server" Text="العميل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="customer" ></asp:LinkButton>
                                                <asp:TextBox ID="customer" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblcustomer" runat="server" Text='<%# Eval("customer") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="رقم الجوال" SortExpression="contact_no" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblfPhone" runat="server" Text="رقم الجوال" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="contact_no" ></asp:LinkButton>
                                                <asp:TextBox ID="contact_no" AutoPostBack="True" CssClass="form-control input-sm" OnTextChanged="txtFWL_TextChanged" runat="server" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblPhone" runat="server" Text='<%# Eval("CONTACT_NO") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="هوية العميل" SortExpression="cust_id" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblcust_id" runat="server" Text="هوية العميل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="cust_id" ></asp:LinkButton>
                                                <asp:TextBox ID="cust_id" AutoPostBack="True" CssClass="form-control input-sm" OnTextChanged="txtFWL_TextChanged" runat="server" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblcust_id" runat="server" Text='<%# Eval("cust_id") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>



                                        <asp:TemplateField HeaderText="موظف البنك" SortExpression="initempbank" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblinitempbank" runat="server" Text="موظف البنك" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="EvalEmpBank" ></asp:LinkButton>
                                                <asp:TextBox ID="initempbank" AutoPostBack="True" CssClass="form-control input-sm" OnTextChanged="txtFWL_TextChanged" runat="server"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lbllinitempbank" runat="server" Text='<%# Eval("initempbank") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <%--  <asp:TemplateField HeaderText="جهة العمل" SortExpression="sec" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblsec" runat="server" Text="جهة العمل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="sec" ></asp:LinkButton>
                                                <asp:TextBox ID="sec" AutoPostBack="True" CssClass="form-control input-sm" runat="server" meta:resourcekey="process_descResource2"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lbllsec" runat="server" Text='<%# Eval("sec") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>

                                  <asp:TemplateField HeaderText="بنك التمويل" SortExpression="INV_bank"  >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblINV_bank" runat="server" Text="بنك التمويل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="inv_bank" ></asp:LinkButton>
                                                <asp:TextBox ID="inv_bank" AutoPostBack="True" CssClass="form-control input-sm" runat="server" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblINV_bank" runat="server" Text='<%# Eval("INV_bank") %>' meta:resourcekey="lblPriorityResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                            <%--  <asp:TemplateField HeaderText="بنك الراتب" SortExpression="salary_bank"  >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblBank" runat="server" Text="بنك الراتب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="salary_bank" ></asp:LinkButton>
                                                <asp:TextBox ID="salary_bank" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblBank" runat="server" Text='<%# Eval("salary_bank") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>



                                        <asp:TemplateField HeaderText="تاريخ الطلب" SortExpression="doc_date" meta:resourcekey="TemplateFieldResource3">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWDate" runat="server" Text="تاريخ الطلب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="doc_date" ></asp:LinkButton>
                                                <asp:TextBox ID="doc_date" AutoPostBack="True" CssClass="form-control input-sm" TextMode="Date" runat="server" OnTextChanged="txtFWL_TextChanged" meta:resourcekey="wl_dateResource1"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblDate" runat="server" Text='<%# Eval("doc_date") %>' meta:resourcekey="lblDateResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                          <asp:TemplateField HeaderText="الموظف المتابع" SortExpression="doc_date" meta:resourcekey="TemplateFieldResource3">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblEmployee" runat="server" Text="الموظف المتابع" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="emp_name" ></asp:LinkButton>
                                                <asp:TextBox ID="emp_name" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblemp_name" runat="server" Text='<%# Eval("emp_name") %>' meta:resourcekey="lblDateResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                         <asp:TemplateField HeaderText="حالة الطلب" SortExpression="status" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblfstatus" runat="server" Text="حالة الطلب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="status" ></asp:LinkButton>
                                                <asp:TextBox ID="status" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblstatus" runat="server" Text='<%# Eval("status") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>



                                            <asp:TemplateField HeaderText="اخر تحديث"  >
                                          <HeaderTemplate>
                                                <asp:LinkButton ID="lbllast_update" runat="server" Text="اخر تحديث" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="last_update" ></asp:LinkButton>
                                               <asp:TextBox ID="last_update" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblWlID" runat="server" Text='<%# Eval("last_update") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

<%--                                        <asp:BoundField DataField="next_process_id" HeaderText="NextProcessID" Visible="False"  />
                                        <asp:BoundField DataField="process_id" HeaderText="ProcessID" Visible="False"  />--%>

                                  <%--      <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource13">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnpending" runat="server" CssClass="btn btn-primary btn-sm pull-right" ToolTip="Pending List"  Text="
                                                        &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-right&quot;&gt;&lt;/i&gt;
                                                " ></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:LinkButton ID="btnPending" runat="server"
                                                    ToolTip="Add to Pending" CssClass="btn btn-primary btn-sm pull-right" CommandName="addpending" CommandArgument='<%# Eval("wl_id") %>'  OnClientClick="javascript:return confirm('Are you sure add to pending?');" meta:resourcekey="btnPendingResource2" Text="
                                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-left&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>

                                        <asp:TemplateField Visible="false" >
                                          <HeaderTemplate>
                                              <asp:LinkButton ID="btDelete"  Enabled='<%# IIf(IsDeptHead, True, False) %>'      OnCommand="btnDelete_Command"    OnClientClick="if (confirm('هل تريد الحذف بالفعل ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"    runat="server"  Text="حذف نهائي" CssClass="control-label" Style="color: white;" ></asp:LinkButton>
                                         </HeaderTemplate>

                                             <%-- <HeaderTemplate>
                                                            <asp:LinkButton ID="lblSEND" runat="server" Text="اسناد الطلب"  CssClass="control-label" Style="color: white;" OnCommand="btnSend_Command"  ></asp:LinkButton>
                                                 </HeaderTemplate>--%>

                                                <ItemTemplate>
                                                            <asp:CheckBox ID="chkDelete" Enabled='<%# IIf(Eval("Q_CANCEL").ToString = "Y" And Eval("STATUS_CODE").ToString <> "C" And Eval("STATUS_CODE").ToString <> "O", True, False) %>' runat="server"   />
                                                        </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                    </Columns>
                                                                        <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="الاول" LastPageText="الاخير" NextPageText="التالي" PreviousPageText="السابق" />
                                    <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
             <%--                       <EditRowStyle BackColor="#2461BF" />
                       <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="الاول" LastPageText="الاخير" NextPageText="التالي" PreviousPageText="السابق" />
                                     <RowStyle BackColor="#EFF3FB" />
                                     <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />--%>
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                
                    </div>
                <div id="myModal"   data-backdrop="static" data-keyboard="false" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="t4" class="modal-title" runat="server">
                            <asp:Localize ID="Localize3" runat="server" meta:resourcekey="Localize3Resource1" Text="تفاصيل الطلب"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         <div class="form-group">
                             <div class="col-sm-12">
                        <uc1:ucCustomerInfo runat="server" id="ucCustomerInfo" />
                       </div>
                             </div>
                         
                         <div class="form-group">
                               <div class="col-sm-12">
                         <asp:Label ID="Label7" runat="server" Text="الموافقات" Font-Bold="True" ></asp:Label>
                        <div class="form-group">
                                  <div style="height:350px;overflow:auto">
                                 <uc1:ucApprovals runat="server" id="ucApprovals" />
                                      </div>
                                </div>
                                   </div>
                             </div>
                         <hr />
                        <br />
                        
                        <div runat="server" visible="false" id="ForUploadDiv" class="form-group">
                            <div class="col-sm-10">
                                 <asp:DropDownList ID="ddlForUpload"  runat="server" CssClass="form-control input-sm" Width="100%">
                                                  <asp:ListItem Text="على وشك الرفع" Value="Y"></asp:ListItem>
                                                  <asp:ListItem Text="ليس بعد" Value="N"></asp:ListItem>
                                              </asp:DropDownList>
                                </div>
                               <div class="col-sm-2">
                                                                      <asp:LinkButton ID="btnUpdateForUpload" runat="server"   CssClass="btn btn-danger btn-md" OnClick="btnUpdateForUpload_Click"   
 Text=" &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;تحديث الحالة  
                                                        " ></asp:LinkButton>
                                   </div>
                        </div>
                         <div runat="server" visible="false" id="NotesDiv" class="form-group">
                                <div class="col-sm-10">
                                                   <asp:Label ID="Label21" runat="server" Text="تحديث الحالة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtRemarks"    CssClass="form-control" runat="server" ></asp:TextBox>
                                               </div>
                               <div class="col-sm-2">
                                              <asp:Label ID="Label22" runat="server" Text="." Font-Bold="True" ></asp:Label>
                                               <%--                                      OnClientClick="if (confirm('هل تريد تحديث الحالة ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"--%>
                                   <asp:LinkButton ID="btnAddRemarks" runat="server" OnClientClick="return userValid();"  CssClass="btn btn-primary btn-md" OnClick="btnAddRemarks_Click" 
 Text=" &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;تحديث  حالة  الطلب
                                                        " ></asp:LinkButton>
                                              </div>
                             </div>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>
                    </div>

                </div>
            </div>
        </div>

                </ContentTemplate>
            </asp:UpdatePanel>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>
  
       <div id="QualityModal" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="H1" class="modal-title" runat="server">
                            <asp:Localize ID="Localize1" runat="server" meta:resourcekey="Localize3Resource1" Text="الجودة"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         
                         
                         <div class="form-group">
                               <div class="col-sm-8">
                         <asp:Label ID="Label1" runat="server" Text="الى الموظف" Font-Bold="True" ></asp:Label>
                          <asp:DropDownList ID="ddlEmp"   runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                              </div>
                              <div class="col-sm-4">
                                   <br />
                                               <asp:LinkButton ID="btnSave" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnSave_Click"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; تحويل
                                                        " ></asp:LinkButton> 
                              </div>
                             </div>
                         <hr />
                        <br />
                        
                         
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>
                    </div>

                </div>
            </div>
        </div>


<div id="ChangeCategModal" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="H2" class="modal-title" runat="server">
                            <asp:Localize ID="Localize2" runat="server" meta:resourcekey="Localize3Resource1" Text="تصنيف الطلبات"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         
                         
                         <div class="form-group">
                               <div class="col-sm-8">
                         <asp:Label ID="Label2" runat="server" Text="التصنيف" Font-Bold="True" ></asp:Label>
                          <asp:DropDownList ID="ddlTypeCateg"   runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                              </div>
                              <div class="col-sm-4">
                                   <br />
                                               <asp:LinkButton ID="btnChangeType" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnChangeType_Click"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; تغيير
                                                        " ></asp:LinkButton> 
                              </div>
                             </div>
                         <hr />
                        <br />
                        
                         
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>
                    </div>

                </div>
            </div>
        </div>

<script type="text/javascript">    
    
        function userValid() {    
            var Remarks = document.getElementById('<%=txtRemarks.ClientID%>').value;
            if (Remarks == '')
           {    
               alert("فضلا ادخل الملاحظة");
            return false;    
           }       
        }    
</script> 

Contents of ucReqHistory.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucReqHistory

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''ddlStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlStatus As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divCancelType control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCancelType As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''ddlCancelType control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCancelType As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''StepDiv control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents StepDiv As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''ddlStep control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlStep As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''ddlCompPay control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCompPay As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''ddlCustomService control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlCustomService As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divSup control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divSup As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''ddlSup control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlSup As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''grdWL control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdWL As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''t4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents t4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize3 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucCustomerInfo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucCustomerInfo As Global.EnjazVB.ucCustomerInfo

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ucApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucApprovals As Global.EnjazVB.ucApprovals

    '''<summary>
    '''ForUploadDiv control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ForUploadDiv As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''ddlForUpload control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlForUpload As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''btnUpdateForUpload control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnUpdateForUpload As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''NotesDiv control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents NotesDiv As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label21 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label21 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRemarks As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label22 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label22 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnAddRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnAddRemarks As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress

    '''<summary>
    '''H1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H1 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize1 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlEmp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlEmp As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''H2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H2 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize2 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlTypeCateg control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlTypeCateg As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''btnChangeType control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnChangeType As Global.System.Web.UI.WebControls.LinkButton
End Class

Contents of ucReqHistory.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports WebClass.Sys.Classes
Imports ClosedXML.Excel
Imports System.Transactions
Imports System.Activities.Statements

Public Class ucReqHistory
    Inherits System.Web.UI.UserControl

    Dim sSql As String = ""


    Private Property PendingFlag As String
        Get
            Return Session("PendingFlag")
        End Get
        Set(value As String)
            Session("PendingFlag") = value
        End Set
    End Property


    Public Property isSupper As Boolean
        Get
            Return Session("isSupper")
        End Get
        Set(value As Boolean)
            Session("isSupper") = value
        End Set
    End Property

    Public Property isQulity As Boolean
        Get
            Return Session("isQulity")
        End Get
        Set(value As Boolean)
            Session("isQulity") = value
        End Set
    End Property

    Public Property isSupvisor As Boolean
        Get
            Return Session("isSupvisor")
        End Get
        Set(value As Boolean)
            Session("isSupvisor") = value
        End Set
    End Property

    Public Property filter As Boolean
        Get
            Return Session("filter")
        End Get
        Set(value As Boolean)
            Session("filter") = value
        End Set
    End Property

    Private Property RpWLFilterCondition As String
        Get
            Return Session("RpWLFilterCondition")
        End Get
        Set(value As String)
            Session("RpWLFilterCondition") = value
        End Set
    End Property

    Private Property pWLFilterValue As String
        Get
            Return Session("pWLFilterValue")
        End Get
        Set(value As String)
            Session("pWLFilterValue") = value
        End Set
    End Property

    Public Property requestId As String
        Get
            Return ViewState("requestId")
        End Get
        Set(value As String)
            ViewState("requestId") = value
        End Set
    End Property

    Public Property wl_id As String
        Get
            Return ViewState("wl_id")
        End Get
        Set(value As String)
            ViewState("wl_id") = value
        End Set
    End Property

    Public Property requestOwner As String
        Get
            Return ViewState("requestOwner")
        End Get
        Set(value As String)
            ViewState("requestOwner") = value
        End Set
    End Property

    Public Property Req_Status As String
        Get
            Return ViewState("Req_Status")
        End Get
        Set(value As String)
            ViewState("Req_Status") = value
        End Set
    End Property

    Public Property IsCustPhone As Boolean
        Get
            Return Session("IsCustPhone")
        End Get
        Set(value As Boolean)
            Session("IsCustPhone") = value
        End Set
    End Property

    Public Property TYPE_CAT As String
        Get
            Return ViewState("TYPE_CAT")
        End Get
        Set(value As String)
            ViewState("TYPE_CAT") = value
        End Set
    End Property

    Public Property IsCateg As Boolean
        Get
            Return Session("IsCateg")
        End Get
        Set(value As Boolean)
            Session("IsCateg") = value
        End Set
    End Property

    Public Property IsDeptHead As Boolean
        Get
            Return Session("IsDeptHead")
        End Get
        Set(value As Boolean)
            Session("IsDeptHead") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If
        Try


            If Not IsPostBack Then

                If Not (Request.QueryString("filter")) Is Nothing Then
                    filter = True
                Else
                    filter = False
                End If
                If Not (Request.QueryString("TC")) Is Nothing Then
                    TYPE_CAT = Request.QueryString("TC").ToString
                    IsCateg = True
                Else
                    TYPE_CAT = ""
                    IsCateg = False
                End If

                If Session("emp_no").ToString = "0001" Then
                    IsDeptHead = True
                Else
                    IsDeptHead = False
                End If

                If IsDeptHead Then
                    grdWL.Columns(14).Visible = True
                Else
                    grdWL.Columns(14).Visible = False
                End If

                ' grdWL.VirtualItemCount = GetOpenWL(Session("EmpNo").ToString, False)
                ' grdWL.VirtualItemCount = GetOpenWL(Session("emp_no").ToString, False)
                IsCustPhone = False
                    PendingFlag = "N"
                    isSupper = IIf(Session("supper_user").ToString = "True", True, False)
                    isSupvisor = IIf(GetFieldValue("SELECT IS_SUP FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
                    isQulity = IIf(GetFieldValue("SELECT QUALITY FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
                    ' grdWL.VirtualItemCount = GetEmpRequest()
                    If isQulity Then
                        grdWL.Columns(2).Visible = True
                    End If



                    GetPageData(0, 100)
                    FillComboSelectText(ddlStatus, "select type_category, type_Desc from type_mst where type_code='RS'  UNION SELECT 'IMPORTANCE' AS TYPE_CATEGORY ,N'طلبات مهمة' AS TYPE_DESC UNION SELECT 'FORUPLOAD' AS TYPE_CATEGORY ,N'طلبات علي وشك الرفع' AS TYPE_DESC UNION SELECT 'PROCCHKPAY' AS TYPE_CATEGORY ,N'طلبات بمرحلة السداد' AS TYPE_DESC UNION SELECT PROCESS_ID,PROCESS_DESC FROM APP_PROCESSES WHERE PROCESS_ID='PROCCOLLECT' ", "حالة الطلب")
                    FillComboSelectText(ddlStep, "select type_category, type_Desc from type_mst where type_code='SP'", "مرحلة الطلب")
                    FillComboSelectText(ddlCancelType, "select type_category, type_Desc from type_mst where type_code='CR' ORDER BY TYPE_ABBR", "سبب الإلغاء")
                    Dim Q = ""
                    Q = "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A'  "
                    If isSupvisor And Not isQulity Then
                        Q = "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' AND (EMP_NO='" & Session("emp_no").ToString & "' OR SUP='" & Session("emp_no").ToString & "')  "
                    End If
                    FillComboSelect(ddlEmp, Q)
                    FillComboSelect(ddlTypeCateg, "select type_category, type_Desc from type_mst where type_code='TC' ORDER BY PERCENTAGE ")
                    FillComboSelectText(ddlSup, "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' AND IS_SUP='Y'  ", "المشرف")
                    ddlEmp.SelectedValue = Session("emp_no").ToString
                    ddlStatus.SelectedIndex = 0
                End If
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)
        End Try
        SetGridStyle(grdWL)

        Dim sm As ScriptManager = ScriptManager.GetCurrent(Me.Page)
        ' sm.RegisterPostBackControl(btnExport)
    End Sub

    Protected Sub ddlStatus_SelectedIndexChanged(sender As Object, e As EventArgs)
        If Not (ddlStatus.SelectedValue Is Nothing) Then
            If ddlStatus.SelectedValue.ToString = "D" Then
                divCancelType.Visible = True
                divSup.Visible = False
                ddlSup.SelectedIndex = -1
            Else
                divCancelType.Visible = False
                divSup.Visible = True
                ddlCancelType.SelectedIndex = -1
            End If
            GetPageData(0, 100)
        End If
    End Sub

    Protected Sub OnDataBound(sender As Object, e As EventArgs)
        For i As Integer = grdWL.Rows.Count - 1 To 1 Step -1
            Dim row As GridViewRow = grdWL.Rows(i)
            Dim previousRow As GridViewRow = grdWL.Rows(i - 1)
            For j As Integer = 0 To row.Cells.Count - 1
                If row.Cells(j).Text = previousRow.Cells(j).Text Then
                    If previousRow.Cells(j).RowSpan = 0 Then
                        If row.Cells(j).RowSpan = 0 Then
                            previousRow.Cells(j).RowSpan += 2
                        Else
                            previousRow.Cells(j).RowSpan = row.Cells(j).RowSpan + 1
                        End If
                        row.Cells(j).Visible = False
                    End If
                End If
            Next
        Next
        SetGridStyle(grdWL)
    End Sub

    Private Function GetEmpRequest() As String
        Dim s As String = "", sCond As String = ""
        Dim sOut As String = ""
        s = "SELECT COUNT(H.DOC_NO) FROM ARS_REQUEST_HDR H WITH (NOLOCK)  WHERE 1=1   "
        If Session("supper_user").ToString = "True" Then

        ElseIf isQulity Then
            s = s & " and  (emp_no='" & Session("emp_no").ToString & "' OR  dept_head='" & Session("emp_no").ToString & "' OR (DOC_NO NOT in (select ref_id from app_worklist where next_process_id NOT IN ('" & AppProcess.ProcUploadDoc.ToString.ToUpper & "','" & AppProcess.ProcCreate.ToString.ToUpper & "','" & AppProcess.ProcCheck.ToString.ToUpper & "','" & AppProcess.ProcCancelConfirm.ToString.ToUpper & "','" & AppProcess.ProcAssign.ToString.ToUpper & "') and status='O') AND DATEDIFF(DAY,CONVERT(DATE,DOC_DATE,103), ENJAZVB.GETSERVERDATE())>=8 )   )  "
        Else
            s = s & " and  (emp_no='" & Session("emp_no").ToString & "' OR  dept_head='" & Session("emp_no").ToString & "'  )  "
        End If

        s = GetFieldValue(s)
        If s = "" Then
            s = "0"
        End If
        Return s
    End Function


    Private Sub GetPageData(pgIndex As Integer, pgSize As Integer)

        Try
            Dim dt As New DataTable
            'If pWLFilterCondition <> "" Then

            sSql = "             "
            'sSql = sSql & "   SELECT  ROW_NUMBER() OVER (ORDER BY  Convert(date,doc_date,103) DESC) as srno,a.* FROM (  "
            If IsCustPhone Then
                sSql = "   SELECT   DISTINCT  REPLACE(T.customer,N'(محول)','') AS CUSTOMER ,'966'+RIGHT (CONTACT_NO,9) AS PHONE FROM (       "
            Else
                sSql = "   SELECT   DISTINCT  T.* FROM (       "
            End If


            sSql = sSql & "   SELECT ROW_NUMBER() OVER (ORDER BY ISNULL(TRANS_DATE,CONVERT(DATE,DOC_DATE,103)) DESC, yr desc  ) as SRNO, a.* FROM (  "
            'sSql = sSql & "   SELECT ROW_NUMBER() OVER (ORDER BY yr desc,  cast(right(REF_ID,4) as int)   DESC) as SRNO, a.* FROM (  "
            sSql = sSql & "   select h.doc_no AS REF_ID,h.Q_CANCEL,yr ,req_date as doc_date, REQ_BY +(CASE WHEN TRANS_DATE IS NOT NULL THEN N'(محول)' ELSE '' END ) AS customer ,h.initempbank,h.cust_id, BK.TYPE_DESC AS salary_bank, W.TYPE_dESC AS SEC,H.CONTACT_NO ,s.type_desc as status ,H.STATUS  AS STATUS_CODE,H.ref_procid,H.FORUPLOAD,ISNULL(H.REF_DOCNO,'O')REF_DOCNO ,H.refcomp_code,ISNULL(H.SERVICE,'F') AS SERVICE,"
            sSql = sSql & "   IK.TYPE_DESC  as INV_bank,h.other5 as investment_amt,h.other6 as readEstateAmt,h.other7 as corporate,e.emp_name,H.EMP_NO,H.dept_head,h.last_update,H.cancel_reason ,U.REF_ID AS UPLOADED  ,CK.REF_ID AS FORCHECK,H.TRANS_DATE "
            ' sSql = sSql & "   IK.TYPE_DESC  as INV_bank,h.other5 as investment_amt,h.other6 as readEstateAmt,h.other7 as corporate,e.emp_name,H.EMP_NO,H.dept_head,FORMAT(H.lastUpdateDate,'dd/MM/yyyy')+' - '+H.LAST_REMARKS as last_update  "
            sSql = sSql & "   from ARS_REQUEST_HDR h WITH (NOLOCK) left join  emp_mst e WITH (NOLOCK)  on h.emp_no=e.emp_no inner join (select TYPE_CATEGORY,TYPE_DESC from type_mst WITH (NOLOCK) where type_code='RS') S on h.status=s.type_category  "
            sSql = sSql & "   left join (select TYPE_CATEGORY,TYPE_DESC from type_mst WITH (NOLOCK) where type_Code='BK') BK ON H.OTHER1=BK.TYPE_cATEGORY "
            sSql = sSql & "   left join (select TYPE_CATEGORY,TYPE_DESC from type_mst WITH (NOLOCK) where type_Code='BK') IK ON H.OTHER4=IK.TYPE_cATEGORY "
            sSql = sSql & "   left join (select TYPE_CATEGORY,TYPE_DESC from type_mst WITH (NOLOCK) where type_Code='WE')W ON H.OTHER3=W.TYPE_CATEGORY "
            sSql = sSql & "   left join (SELECT  REF_ID FROM APP_WORKLIST  WITH (NOLOCK) WHERE NEXT_PROCESS_ID NOT IN ('" & AppProcess.ProcUploadDoc.ToString.ToUpper & "','" & AppProcess.ProcCreate.ToString.ToUpper & "','" & AppProcess.ProcCheck.ToString.ToUpper & "','" & AppProcess.ProcCancelConfirm.ToString.ToUpper & "','" & AppProcess.ProcAssign.ToString.ToUpper & "') AND STATUS='O') U ON H.DOC_NO=U.REF_ID  "
            sSql = sSql & "   LEFT JOIN (SELECT REF_ID FROM APP_WORKLIST   WITH (NOLOCK) WHERE NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "' AND STATUS='O') CK ON  H.DOC_NO=CK.REF_ID "
            'sSql = sSql & "   LEFT JOIN  APP_WORKLIST L WITH (NOLOCK)  ON L.WL_ID=(SELECT TOP 1 WL_ID FROM APP_WORKLIST WHERE CLOSED_DATE IS NOT NULL AND  REF_ID=H.DOC_NO  ORDER BY CLOSED_DATE DESC)"
            'sSql = sSql & "   OUTER APPLY (SELECT TOP 1 CLOSED_REMARKS, CLOSED_DATE  FROM APP_WORKLIST WITH (NOLOCK) WHERE CLOSED_DATE IS NOT NULL  and ref_id=H.DOC_NO   ORDER BY CLOSED_DATE DESC)  L  "
            sSql = sSql & "    WHERE H.TRAN_TYPE='R' "
            If TYPE_CAT = "" Then
                sSql = sSql & "    AND H.TYPE_CAT IS NULL  "
            Else
                sSql = sSql & "    AND H.TYPE_CAT ='" & TYPE_CAT & "'  "
            End If

            sSql = sSql & "     )a    "

            sSql = sSql & "   where 1=1  "
            If Session("supper_user").ToString = "True" Then
            ElseIf isQulity Then
                Dim Q As String = ""
                Q = Q & "   WITH N ( EMP_NO,EMP_NAME  ) AS ( "
                Q = Q & "   SELECT   EMP_NO,EMP_NAME FROM EMP_MST WITH (NOLOCK)  WHERE  EMP_NO='" & Session("emp_no").ToString & "'  "
                Q = Q & "   UNION  ALL "
                Q = Q & "   SELECT    C.EMP_NO,C.EMP_NAME FROM EMP_MST C WITH (NOLOCK)  JOIN N    ON C.SUP=N.EMP_NO "
                Q = Q & "   )    SELECT DISTINCT '' + STUFF(( SELECT    TOP 100  ', '''+ EMP_NO +''+'''' FROM   N X  WITH (NOLOCK)  "
                Q = Q & "   FOR XML  PATH(''), TYPE).value('.', 'VARCHAR(MAX)'), 1, 2, '') AS EMP  "
                ' Dim EMPS = GetFieldValue(Q)
                ' sSql = sSql & " and  (emp_no in (" & EMPS & " )  OR  dept_head in (" & EMPS & " ) OR REF_ID NOT in (select ref_id from app_worklist where next_process_id NOT IN ('" & AppProcess.ProcUploadDoc.ToString.ToUpper & "','" & AppProcess.ProcCreate.ToString.ToUpper & "','" & AppProcess.ProcCheck.ToString.ToUpper & "','" & AppProcess.ProcCancelConfirm.ToString.ToUpper & "','" & AppProcess.ProcAssign.ToString.ToUpper & "') and status='O')    )  "

                sSql = sSql & " and  (emp_no='" & Session("emp_no").ToString & "' OR  dept_head='" & Session("emp_no").ToString & "' OR (REF_ID NOT in (select ref_id from app_worklist where next_process_id NOT IN ('" & AppProcess.ProcUploadDoc.ToString.ToUpper & "','" & AppProcess.ProcCreate.ToString.ToUpper & "','" & AppProcess.ProcCheck.ToString.ToUpper & "','" & AppProcess.ProcCancelConfirm.ToString.ToUpper & "','" & AppProcess.ProcAssign.ToString.ToUpper & "') and status='O') AND DATEDIFF(DAY,CONVERT(DATE,DOC_DATE,103), ENJAZVB.GETSERVERDATE())>=8 )   )  "
            Else
                If filter And isSupvisor Then
                Else

                    Dim Q As String = ""
                    Q = Q & "   WITH N ( EMP_NO,EMP_NAME  ) AS ( "
                    Q = Q & "   SELECT   EMP_NO,EMP_NAME FROM EMP_MST WITH (NOLOCK)  WHERE  EMP_NO='" & Session("emp_no").ToString & "'  "
                    Q = Q & "   UNION  ALL "
                    Q = Q & "   SELECT    C.EMP_NO,C.EMP_NAME FROM EMP_MST C WITH (NOLOCK)  JOIN N    ON C.SUP=N.EMP_NO "
                    Q = Q & "   )    SELECT DISTINCT '' + STUFF(( SELECT    TOP 100  ', '''+ EMP_NO +''+'''' FROM   N X  WITH (NOLOCK)  "
                    Q = Q & "   FOR XML  PATH(''), TYPE).value('.', 'VARCHAR(MAX)'), 1, 2, '') AS EMP  "
                    ' Dim EMPS = GetFieldValue(Q)
                    'sSql = sSql & " and  (emp_no  in (" & EMPS & " )   OR  dept_head  in (" & EMPS & " )    )  "
                    sSql = sSql & " and  (emp_no='" & Session("emp_no").ToString & "' OR  dept_head='" & Session("emp_no").ToString & "'  )  "

                End If
            End If

            If ddlCancelType.SelectedValue.ToString <> "" Then
                sSql = sSql & "  AND  cancel_reason='" & ddlCancelType.SelectedValue.ToString & "' "
            End If

            If ddlSup.SelectedValue.ToString <> "" Then
                sSql = sSql & " and  (dept_head='" & ddlSup.SelectedValue.ToString & "'  )  "
            End If
            If filter Then
                sSql = sSql & " and  (emp_no in (select emp_no from emp_mst where status_flag='N') AND STATUS_CODE <> 'C' AND Q_CANCEL <>'Y' )  "
            End If

            If (ddlStatus.SelectedIndex > 0) Then                          '==================================updated by ali 22/05/2018=================='
                If ddlStatus.SelectedValue = "IMPORTANCE" Then
                    sSql = sSql & "  AND STATUS_CODE = 'O' AND ref_procid='Y'  "
                ElseIf ddlStatus.SelectedValue = "FORUPLOAD" Then
                    sSql = sSql & "  AND STATUS_CODE = 'O' AND FORUPLOAD='Y'  "
                ElseIf ddlStatus.SelectedValue = "PROCCHKPAY" Then
                    sSql = sSql & "  AND STATUS_CODE = 'O' AND (REF_ID IN (SELECT DISTINCT REF_ID FROM APP_WORKLIST WHERE NEXT_PROCESS_ID='" & AppProcess.ProcChkPay.ToString.ToUpper & "' AND STATUS='O') [PAY]) "
                ElseIf ddlStatus.SelectedValue = AppProcess.ProcCollect.ToString.ToUpper Then
                    sSql = sSql & "   AND (REF_ID IN (SELECT DISTINCT REF_ID FROM APP_WORKLIST WHERE NEXT_PROCESS_ID='" & AppProcess.ProcCollect.ToString.ToUpper & "' AND STATUS='O') [COLL]) "
                Else

                    If ddlStatus.SelectedValue = "C" And isQulity Then
                        sSql = sSql & "  AND ( STATUS_CODE = '" & ddlStatus.SelectedValue & "' AND emp_no='" & Session("emp_no").ToString & "' ) "
                    Else
                        sSql = sSql & "  AND STATUS_CODE = '" & ddlStatus.SelectedValue & "' "
                    End If

                End If
            Else

                If isQulity Then
                    sSql = sSql & "  AND (STATUS_CODE <> 'C'  OR (STATUS_CODE ='C' AND emp_no='" & Session("emp_no").ToString & "' ))"
                End If

            End If


            If (ddlStep.SelectedIndex > 0) Then                          '==================================updated by ali 22/05/2018=================='
                If ddlStep.SelectedIndex = 1 Then
                    sSql = sSql & "  AND (FORCHECK<>''  [CHK]) "
                    'sSql = sSql & "  AND REF_ID in (select ref_id from app_worklist where next_process_id='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "' and status='O') "
                Else
                    sSql = sSql & "  AND (UPLOADED<>''  [UP] ) "
                    'sSql = sSql & "  AND REF_ID in (select ref_id from app_worklist where next_process_id NOT IN ('" & AppProcess.ProcUploadDoc.ToString.ToUpper & "','" & AppProcess.ProcCreate.ToString.ToUpper & "','" & AppProcess.ProcCheck.ToString.ToUpper & "','" & AppProcess.ProcCancelConfirm.ToString.ToUpper & "','" & AppProcess.ProcAssign.ToString.ToUpper & "') and status='O') "
                End If
            End If

            If (ddlCompPay.SelectedValue <> "") Then                          '==================================updated by ali 22/05/2018=================='
                sSql = sSql & "  AND  REF_DOCNO='" & ddlCompPay.SelectedValue.ToString & "' AND REFCOMP_CODE='Y' "
            End If
            If (ddlCustomService.SelectedValue <> "") Then
                sSql = sSql & "  AND  SERVICE='" & ddlCustomService.SelectedValue.ToString & "' "
            End If

            If RpWLFilterCondition <> "" Then
                sSql = sSql & " And " & RpWLFilterCondition
            End If

            sSql = sSql & "  )T   "
            sSql = sSql & "   "
            sSql = sSql & "     []   "



            '    sSql = "SELECT WL.*  FROM ("
            '    sSql = sSql & " SELECT ROW_NUMBER() OVER (ORDER BY  WL_DAYS DESC, CAST(WL_ID AS NUMERIC(38, 10)) DESC) SRNO, A.* FROM VOPENWORKLIST A WHERE 1=1 "
            '    sSql = sSql & " AND OWNER='" & Session("emp_no").ToString & "' AND PENDING_FLAG='" & PendingFlag & "'"
            '    sSql = sSql & " AND " & pWLFilterCondition
            '    sSql = sSql & " ) WL"
            '    sSql = sSql & "  WHERE SRNO BETWEEN ((" & pgIndex & "*10)+1) AND ((" & pgIndex & "+1)*" & pgSize & ")"
            '    sSql = sSql & " ORDER BY SRNO"
            'Else
            '    sSql = " SELECT WL.* FROM ("
            '    sSql = sSql & " SELECT ROW_NUMBER() OVER (ORDER BY  WL_DAYS DESC, CAST(WL_ID AS NUMERIC(38, 10)) DESC) SRNO, A.* FROM VOPENWORKLIST A WHERE 1=1"
            '    sSql = sSql & " AND OWNER='" & Session("emp_no").ToString & "' AND PENDING_FLAG='" & PendingFlag & "'"
            '    sSql = sSql & ") WL"
            '    sSql = sSql & " WHERE  "
            '    sSql = sSql & "  SRNO BETWEEN ((" & pgIndex & "*10)+1) AND ((" & pgIndex & "+1)*" & pgSize & ")"
            '    sSql = sSql & " ORDER BY SRNO"
            'End If




            'Using Str As New SqlConnection(GetConnString)
            '    Using cmd As New SqlCommand(sSql, Str)
            '        Str.Open()
            '        dt.Load(cmd.ExecuteReader)
            '    End Using
            'End Using

            If Not IsCustPhone Then
                Dim Begin As String = "SELECT COUNT(*) FROM ("
                Dim CLOSE As String = " ) MT"
                Dim ReqCount = GetFieldValue(Begin & sSql.Replace("[]", CLOSE).Replace("[PAY]", "").Replace("[COLL]", "").Replace("[CHK]", "").Replace("[UP]", ""))

                Dim PAY = ""
                Dim COLL = ""
                Dim CHK = ""
                Dim UP = ""
                Dim Q = ""
                If ddlStatus.SelectedValue = "PROCCHKPAY" Then
                    Q = "  SELECT DISTINCT '' + STUFF(( SELECT    TOP 1200  ', '''+ REF_ID +''+'''' FROM   APP_WORKLIST X  WITH (NOLOCK)  "
                    Q = Q & "     WHERE NEXT_PROCESS_ID='" & AppProcess.ProcChkPay.ToString.ToUpper & "'   AND STATUS='O' "
                    Q = Q & "      AND REF_ID NOT IN (SELECT DISTINCT DOC_NO FROM ARS_REQUEST_HDR   WITH (NOLOCK)  ) "
                    Q = Q & "      FOR XML  PATH(''), TYPE).value('.', 'VARCHAR(MAX)'), 1, 2, '') AS REFS   "
                    Dim REFS = GetFieldValue(Q)
                    PAY = " OR REF_ID IN (" & REFS & " )"
                End If

                If ddlStatus.SelectedValue = AppProcess.ProcCollect.ToString.ToUpper Then
                    Q = "  SELECT DISTINCT '' + STUFF(( SELECT    TOP 1200  ', '''+ REF_ID +''+'''' FROM   APP_WORKLIST X  WITH (NOLOCK)  "
                    Q = Q & "     WHERE NEXT_PROCESS_ID='" & AppProcess.ProcCollect.ToString.ToUpper & "'   AND STATUS='O' "
                    Q = Q & "      AND REF_ID NOT IN (SELECT DISTINCT DOC_NO FROM ARS_REQUEST_HDR   WITH (NOLOCK)  ) "
                    Q = Q & "      FOR XML  PATH(''), TYPE).value('.', 'VARCHAR(MAX)'), 1, 2, '') AS REFS   "
                    Dim REFS = GetFieldValue(Q)
                    COLL = " OR REF_ID IN (" & REFS & " )"
                End If


                If (ddlStep.SelectedIndex > 0) Then                          '==================================updated by ali 22/05/2018=================='
                    If ddlStep.SelectedIndex = 1 Then

                        Q = "  SELECT DISTINCT '' + STUFF(( SELECT    TOP 1200  ', '''+ REF_ID +''+'''' FROM   APP_WORKLIST X  WITH (NOLOCK)  "
                        Q = Q & "     WHERE NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "'   AND STATUS='O' "
                        Q = Q & "      AND REF_ID NOT IN (SELECT DISTINCT DOC_NO FROM ARS_REQUEST_HDR   WITH (NOLOCK)  ) "
                        Q = Q & "      FOR XML  PATH(''), TYPE).value('.', 'VARCHAR(MAX)'), 1, 2, '') AS REFS   "
                        Dim REFS = GetFieldValue(Q)
                        CHK = " OR REF_ID IN (" & REFS & " )"
                    Else

                        Q = "  SELECT DISTINCT '' + STUFF(( SELECT    TOP 1200  ', '''+ REF_ID +''+'''' FROM   APP_WORKLIST X  WITH (NOLOCK)  "
                        Q = Q & "     WHERE NEXT_PROCESS_ID  NOT IN ('" & AppProcess.ProcUploadDoc.ToString.ToUpper & "','" & AppProcess.ProcCreate.ToString.ToUpper & "','" & AppProcess.ProcCheck.ToString.ToUpper & "','" & AppProcess.ProcCancelConfirm.ToString.ToUpper & "','" & AppProcess.ProcAssign.ToString.ToUpper & "')   AND STATUS='O' "
                        Q = Q & "      AND REF_ID NOT IN (SELECT DISTINCT DOC_NO FROM ARS_REQUEST_HDR   WITH (NOLOCK)  ) "
                        Q = Q & "      FOR XML  PATH(''), TYPE).value('.', 'VARCHAR(MAX)'), 1, 2, '') AS REFS   "

                        Dim REFS = GetFieldValue(Q)
                        UP = " OR REF_ID IN (" & REFS & " )"
                    End If
                End If

                ReqCount = ReqCount + CInt(GetFieldValueCon(Begin & sSql.Replace("[]", CLOSE).Replace("[PAY]", PAY).Replace("[COLL]", COLL).Replace("[CHK]", CHK).Replace("[UP]", UP), "Enjazcon"))
                grdWL.VirtualItemCount = ReqCount




                Dim Cond As String = ""
                '' 23/12/2024
                ''Cond = Cond & "  WHERE  SRNO BETWEEN ((" & pgIndex & "*100)+1) AND ((" & pgIndex & "+1)*" & pgSize & ")"
                ''Cond = Cond & " ORDER BY SRNO"
                '' dt = GetTable(sSql.Replace("[]", Cond))

                Dim dt1 = GetTable(sSql.Replace("[]", "").Replace("[PAY]", "").Replace("[COLL]", "").Replace("[CHK]", "").Replace("[UP]", ""))



                Dim dt2 = GetTableCon(sSql.Replace("[]", "").Replace("[PAY]", PAY).Replace("[COLL]", COLL).Replace("[CHK]", CHK).Replace("[UP]", UP), "Enjazcon")
                dt1.Merge(dt2)
                Dim sortedResults = From row In dt1.AsEnumerable()
                                    Order By CDate(row.Field(Of String)("DOC_DATE")) Descending

                dt = dt1.Clone() ' Clone the structure (columns) of the original table
                ' Import each sorted row into the new DataTable
                Dim rowNumber As Integer = 1
                For Each row In sortedResults
                    row("SRNO") = rowNumber
                    dt.ImportRow(row)
                    rowNumber += 1
                Next
                dt.AcceptChanges()
                ' Define row number range
                If dt.Rows.Count > 0 Then
                    Dim startRow As Integer = (pgIndex * 100) + 1
                    Dim endRow As Integer = (pgIndex + 1) * pgSize
                    ' Filter rows based on row number
                    Dim filteredRows = dt.AsEnumerable().Skip(startRow - 1).Take(endRow - startRow + 1)

                    ' Create a new DataTable from filtered rows
                    dt = filteredRows.CopyToDataTable()
                    dt.AcceptChanges()
                End If
                If dt.Rows.Count = 0 Then
                        Dim nr As DataRow = dt.NewRow
                        'dinesh(17-04-23) add empty values as error rais null values to slect color
                        'nr("priority") = ""
                        nr("srno") = 0
                        dt.Rows.Add(nr)
                        dt.AcceptChanges()
                    End If
                    grdWL.DataSource = dt
                    grdWL.DataBind()
                    SetGridStyle(grdWL)
                Else
                Dim dtCustPhones = GetTable(sSql.Replace("[]", "").Replace("[PAY]", "").Replace("[COLL]", "").Replace("[CHK]", "").Replace("[UP]", ""))
                dtCustPhones.Merge(GetTableCon(sSql.Replace("[]", "").Replace("[PAY]", "").Replace("[COLL]", "").Replace("[CHK]", "").Replace("[UP]", ""), "Enjazcon"))
                dtCustPhones.AcceptChanges()
                ViewState("CustPhones") = dtCustPhones
            End If
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)

        End Try
        'RpWLFilterCondition = ""
    End Sub

    Protected Sub grdWL_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles grdWL.PageIndexChanging
        grdWL.PageIndex = e.NewPageIndex
        GetPageData(e.NewPageIndex, 100)
        SetGridStyle(grdWL)
    End Sub


    Protected Sub txtFWL_TextChanged(sender As Object, e As EventArgs)
        Dim strText As String = "", strName As String = ""
        strText = CType(sender, TextBox).Text.ToString
        strName = CType(sender, TextBox).ID.ToString

        pWLFilterValue = strText
        RpWLFilterCondition = ""


        If strText <> "" Then
            If strName = "doc_date" Or strName = "ref_date" Then
                strText = CDate(strText).ToString("dd/MM/yyyy")
                RpWLFilterCondition = " format(" & strName & ") = format('" & strText & "','DD/MM/YYYY')"
            Else
                strText = "N'%" & strText.ToUpper & "%'"
                RpWLFilterCondition = " upper(" & strName & ") Like " & strText
            End If
        End If

        GetPageData(0, 100)
        SetGridStyle(grdWL)
    End Sub


    Private Sub grdWL_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles grdWL.RowDataBound
        If IsNothing(RpWLFilterCondition) Then
            RpWLFilterCondition = ""
        End If

        If e.Row.RowType = DataControlRowType.Header Then
            If RpWLFilterCondition.ToLower.ToString.Contains("(ref_id") Then
                CType(e.Row.FindControl("ref_id"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(customer") Then
                CType(e.Row.FindControl("customer"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(contact_no") Then
                CType(e.Row.FindControl("contact_no"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(sec") Then
                CType(e.Row.FindControl("sec"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(inv_bank") Then
                CType(e.Row.FindControl("inv_bank"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(salary_bank") Then
                CType(e.Row.FindControl("salary_bank"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(cust_id") Then
                CType(e.Row.FindControl("cust_id"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(doc_date") Then
                'CType(e.Row.FindControl("wl_date"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", CDate(Session("pWLFilterValue")).ToString("yyyy-mm-dd"))
                CType(e.Row.FindControl("doc_date"), TextBox).Text = CDate(Session("pWLFilterValue")).ToString("yyyy-MM-dd")
            End If

            If RpWLFilterCondition.ToLower.ToString.Contains("(emp_name") Then
                CType(e.Row.FindControl("emp_name"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(status") Then
                CType(e.Row.FindControl("status"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If

            If RpWLFilterCondition.ToLower.ToString.Contains("(last_update") Then
                CType(e.Row.FindControl("last_update"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If

        End If


        If e.Row.RowType = DataControlRowType.DataRow Then



        End If


        SetGridStyle(grdWL)
    End Sub


    Protected Sub btnQuality_Command(sender As Object, e As CommandEventArgs)
        Dim count = 0
        For i As Integer = 0 To grdWL.Rows.Count - 1
            Dim r = grdWL.Rows(i)
            If CType(r.FindControl("chk"), CheckBox).Checked Then
                count = count + 1
                Exit For
            End If
        Next
        If count > 0 Then
            OpenModal(Me.Page, "QualityModal")
        Else
            ShowPopUpMsg(Me.Page, "فضلا اختر طلب واحد علي الاقل")
        End If
    End Sub


    Protected Sub btnDelete_Command(sender As Object, e As CommandEventArgs)
        Dim count = 0
        For i As Integer = 0 To grdWL.Rows.Count - 1
            Dim r = grdWL.Rows(i)
            If CType(r.FindControl("chkDelete"), CheckBox).Checked Then
                count = count + 1
                Exit For
            End If
        Next
        If count > 0 Then


            Dim saveFlag As Boolean = False



            'Dim cn As New SqlConnection
            'Dim cmd As New SqlCommand
            'Dim trans As SqlTransaction



            'cn = OpenConnection()
            'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
            'cmd.Connection = cn
            'cmd.Transaction = trans

            'SetDateSession(cn, cmd)

            Using cn As New SqlConnection(GetConnString)
                cn.Open()
                Using trans As SqlTransaction = cn.BeginTransaction()
                    Try

                        Using cmd As New SqlCommand()
                            cmd.Connection = cn        ' Set the connection
                            cmd.Transaction = trans    ' Set the transaction
                            SetDateSession(cn, cmd)
                            For i As Integer = 0 To grdWL.Rows.Count - 1
                                Dim r = grdWL.Rows(i)
                                If CType(r.FindControl("chkDelete"), CheckBox).Checked Then

                                    Dim ReqId = CType(r.FindControl("btnRefStep"), LinkButton).Text
                                    Dim q = ""





                                    q = ""
                                    q = q & " DELETE FROM  APP_WORKOWNER WHERE  WL_ID IN ( SELECT WL_ID FROM APP_WORKLIST    WHERE REF_ID= '" & ReqId & "' )  "
                                    cmd.CommandText = q
                                    cmd.ExecuteNonQuery()
                                    RunInOtherDb(q)

                                    q = ""
                                    q = q & " DELETE FROM  APP_WORKLIST    where REF_ID= '" & ReqId & "'   "
                                    cmd.CommandText = q
                                    cmd.ExecuteNonQuery()
                                    RunInOtherDb(q)


                                    q = ""
                                    q = q & " DELETE FROM  APP_WORKOWNER WHERE  WL_ID IN ( SELECT WL_ID FROM APP_REMARKS    WHERE REF_ID= '" & ReqId & "' )  "
                                    cmd.CommandText = q
                                    cmd.ExecuteNonQuery()
                                    RunInOtherDb(q)

                                    q = ""
                                    q = q & " DELETE FROM  APP_REMARKS    where REF_ID= '" & ReqId & "'   "
                                    cmd.CommandText = q
                                    cmd.ExecuteNonQuery()
                                    RunInOtherDb(q)

                                    q = ""
                                    q = q & " DELETE FROM  ars_request_hdr    where doc_no= '" & ReqId & "'   "
                                    cmd.CommandText = q
                                    cmd.ExecuteNonQuery()
                                    RunInOtherDb(q)


                                End If
                            Next
                        End Using
                        trans.Commit()
                        saveFlag = True
                    Catch ex As Exception
                        ShowPopUpMsg(Me.Page, ex.ToString)
                        trans.Rollback()

                    Finally
                        'cmd.Dispose()
                        trans.Dispose()
                        cn.Close()
                        cn.Dispose()
                    End Try

                End Using
            End Using





            If saveFlag = True Then
                GetPageData(0, 100)
                ' ClosePage(Me.Page)
            End If
        Else
            ShowPopUpMsg(Me.Page, "فضلا اختر طلب واحد علي الاقل")
        End If
    End Sub
    Protected Sub btnChangeCateg_Command(sender As Object, e As CommandEventArgs)
        Dim count = 0
        For i As Integer = 0 To grdWL.Rows.Count - 1
            Dim r = grdWL.Rows(i)
            If CType(r.FindControl("chk"), CheckBox).Checked Then
                count = count + 1
                Exit For
            End If
        Next
        If count > 0 Then
            If TYPE_CAT = "" Then
                OpenModal(Me.Page, "ChangeCategModal")
            Else
                Dim saveFlag As Boolean = False



                'Dim cn As New SqlConnection
                'Dim cmd As New SqlCommand
                'Dim trans As SqlTransaction



                'cn = OpenConnection()
                'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
                'cmd.Connection = cn
                'cmd.Transaction = trans

                'SetDateSession(cn, cmd)

                'Try
                Using cn As New SqlConnection(GetConnString)
                    cn.Open()
                    Using trans As SqlTransaction = cn.BeginTransaction()
                        Try

                            Using cmd As New SqlCommand()
                                cmd.Connection = cn        ' Set the connection
                                cmd.Transaction = trans    ' Set the transaction
                                SetDateSession(cn, cmd)
                                For i As Integer = 0 To grdWL.Rows.Count - 1
                                    Dim r = grdWL.Rows(i)
                                    If CType(r.FindControl("chk"), CheckBox).Checked Then

                                        Dim ReqId = CType(r.FindControl("btnRefStep"), LinkButton).Text
                                        Dim q = ""
                                        q = ""
                                        q = q & " update ars_request_hdr set  TYPE_CAT =NULL   where doc_no= '" & ReqId & "'   "
                                        cmd.CommandText = Q
                                        cmd.ExecuteNonQuery()

                                        RunInOtherDb(q)

                                    End If
                                Next
                            End Using
                            trans.Commit()
                            saveFlag = True
                        Catch ex As Exception
                            ShowPopUpMsg(Me.Page, ex.ToString)
                            trans.Rollback()

                        Finally
                            'cmd.Dispose()
                            trans.Dispose()
                            cn.Close()
                            cn.Dispose()
                        End Try
                    End Using
                End Using






                If saveFlag = True Then
                    GetPageData(0, 100)
                    ' ClosePage(Me.Page)
                End If
            End If
        Else
                ShowPopUpMsg(Me.Page, "فضلا اختر طلب واحد علي الاقل")
        End If
    End Sub


    Protected Sub btQualityCancel_Command(sender As Object, e As CommandEventArgs)
        Dim count = 0
        For i As Integer = 0 To grdWL.Rows.Count - 1
            Dim r = grdWL.Rows(i)
            If CType(r.FindControl("chkCancel"), CheckBox).Checked Then
                count = count + 1
                Exit For
            End If
        Next
        If count > 0 Then
            'OpenModal(Me.Page, "QualityModal")


            Dim Q = ""

            Dim saveFlag As Boolean = False



            'Dim cn As New SqlConnection
            'Dim cmd As New SqlCommand
            'Dim trans As SqlTransaction



            'cn = OpenConnection()
            'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
            'cmd.Connection = cn
            'cmd.Transaction = trans

            'SetDateSession(cn, cmd)

            Using cn As New SqlConnection(GetConnString)
                cn.Open()
                Using trans As SqlTransaction = cn.BeginTransaction()
                    Try

                        Using cmd As New SqlCommand()
                            cmd.Connection = cn        ' Set the connection
                            cmd.Transaction = trans    ' Set the transaction
                            SetDateSession(cn, cmd)

                            For i As Integer = 0 To grdWL.Rows.Count - 1
                                Dim r = grdWL.Rows(i)
                                If CType(r.FindControl("chkCancel"), CheckBox).Checked Then

                                    Dim ReqId = CType(r.FindControl("btnRefStep"), LinkButton).Text
                                    CLOSEOPENWORKLIST(cmd, ReqId, "إلغاء بواسطة الجودة")

                                    Q = ""
                                    Q = Q & " update ars_request_hdr set status='D',TYPE_CAT =NULL  "
                                    Q = Q & " ,Q_CANCEL='Y'"
                                    Q = Q & "  where doc_no = '" & ReqId & "'   "
                                    cmd.CommandText = Q
                                    cmd.ExecuteNonQuery()
                                    RunInOtherDb(Q)
                                End If
                            Next
                        End Using
                        trans.Commit()
                        saveFlag = True
                    Catch ex As Exception
                        ShowPopUpMsg(Me.Page, ex.ToString)
                        trans.Rollback()

                    Finally
                        'cmd.Dispose()
                        trans.Dispose()
                        cn.Close()
                        cn.Dispose()
                    End Try
                End Using
            End Using
            If saveFlag Then
                GetPageData(0, 100)
            End If



        Else
            ShowPopUpMsg(Me.Page, "فضلا اختر طلب واحد علي الاقل")
        End If
    End Sub
    Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O" 'rblWLStatus.SelectedValue.ToString


        Dim sWorklistID As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
        Dim sArgRefID As String = ""
        'sWorklistID = e.CommandArgument 'wl_id
        sWorklistID = e.CommandArgument.ToString.Split(",")(0).ToString
        sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString
        requestId = sArgRefID
        wl_id = sWorklistID
        sRefID = ""
        sCurrentProcessCode = ""
        sNextProcessCode = ""
        sPageLink = ""


        'q = "SELECT MODULE_ID,PROCESS_ID,REF_ID,NEXT_PROCESS_ID,PAGELINK FROM APP_WORKLIST WHERE WL_ID='" & sWorklistID & "' AND STATUS='" & wlStatus & "' "


        'Dim dtr = GetTable(q)
        'For Each rdr As DataRow In dtr.Rows
        '    sRefID = rdr("ref_id").ToString
        '    sCurrentProcessCode = rdr("process_id").ToString
        '    sNextProcessCode = rdr("next_process_id").ToString
        '    sPageLink = rdr("pagelink").ToString
        '    sModuleID = rdr("module_id").ToString
        '    Exit For
        'Next

        ' RedirectURL("../pages/ReqDetails.aspx?p1=" & sArgRefID)
        Req_Status = GetFieldValue("select status from ars_request_hdr where doc_no='" & sArgRefID & "'")
        If Req_Status = "" Then
            Req_Status = GetFieldValueCon("select status from ars_request_hdr where doc_no='" & sArgRefID & "'", "Enjazcon")
        End If
        requestOwner = GetFieldValue("select emp_no from ars_request_hdr where doc_no='" & sArgRefID & "'")
        If requestOwner = "" Then
            requestOwner = GetFieldValueCon("select emp_no from ars_request_hdr where doc_no='" & sArgRefID & "'", "Enjazcon")
        End If
        If e.CommandName = "Step" Then
            ucCustomerInfo.DocNo = sArgRefID
            ucApprovals.DocNo = sArgRefID

            Dim ReqStatus = Req_Status
            Dim UploadDocStep = GetFieldValue("select WL_ID from APP_WORKLIST where REF_ID='" & sArgRefID & "' AND NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "' AND STATUS='O'")
            If UploadDocStep = "" Then
                UploadDocStep = GetFieldValueCon("select WL_ID from APP_WORKLIST where REF_ID='" & sArgRefID & "' AND NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "' AND STATUS='O'", "Enjazcon")
            End If
            'And ReqStatus <> "D"
            If requestOwner = Session("emp_no").ToString And ReqStatus <> "C" And (ReqStatus = "N" Or UploadDocStep <> "") Then
                NotesDiv.Visible = True
                ddlForUpload.SelectedValue = ucCustomerInfo.ForUpload
                ForUploadDiv.Visible = True
            Else
                NotesDiv.Visible = False
                ForUploadDiv.Visible = False
            End If

            OpenModal(Me.Page, "myModal")
            '  OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)
        ElseIf e.CommandName = "Detail" Then

            OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)


            'If sPageLink <> "" Then
            '    ' sPageLink = "../../../" & sModuleID & "/" & Session("Language") & "/" & Replace(sPageLink, "../", "") 'format for the new system
            '    sPageLink = "../../../" & Replace(sPageLink, "../", "") 'format for the new system

            '    If Not sPageLink.ToUpper.Contains(".ASPX") Then
            '        ' clsGenClass.OpenTab(Me.Page, sPageLink & "&ViewMode=" & rblWLStatus.SelectedValue.ToString)
            '        'tkID = clsGenClass.InsertToken("N")
            '        'clsGenClass.OpenTab(Me.Page, sModuleLink & "default.aspx?token=" & tkID.ToString & "&div=" & Session("CompCode") & "&lnk=" & Server.UrlEncode(Replace(sPageLink, "..", Session("Language").ToString) & "&ViewMode=" & rblWLStatus.SelectedValue.ToString))
            '        OpenWorklistPage(Me.Page, sWorklistID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, sPageLink)
            '    Else
            '        OpenTab(Me.Page, sPageLink & "&ViewMode=" & wlStatus, sWorklistID)
            '    End If
            'End If
        ElseIf e.CommandName = "Quality" Then
            OpenModal(Me.Page, "QualityModal")
        ElseIf e.CommandName = "addpending" Then
            ' AddtoPending(e.CommandArgument)
            'AddtoPending(e.CommandArgument.ToString.Split(",")(0).ToString)
            'GetPageData(0, 10)
        End If
        SetGridStyle(grdWL)
    End Sub

    Protected Sub btnSave_Click(sender As Object, e As EventArgs)

        Dim Q = ""

        Dim saveFlag As Boolean = False



        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction



        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        For i As Integer = 0 To grdWL.Rows.Count - 1
                                Dim r = grdWL.Rows(i)
                                If CType(r.FindControl("chk"), CheckBox).Checked Then

                                    Dim ReqId = CType(r.FindControl("btnRefStep"), LinkButton).Text
                                    Dim ReqOwner = GetFieldValue(cn, cmd, "select emp_no from ars_request_hdr where doc_no='" & ReqId & "'")
                                If ReqOwner = "" Then
                                    ReqOwner = GetFieldValueCon("select emp_no from ars_request_hdr where doc_no='" & ReqId & "'", "Enjazcon")
                                End If
                                Dim ReqStatus = GetFieldValue(cn, cmd, "select status from ars_request_hdr where doc_no='" & ReqId & "'")
                                If ReqStatus = "" Then
                                    ReqStatus = GetFieldValueCon("select status from ars_request_hdr where doc_no='" & ReqId & "'", "Enjazcon")
                                End If
                                If ddlEmp.SelectedValue.ToString <> ReqOwner Then

                                        ''If ReqStatus = "N" Or ReqStatus = "D" Then
                                        ''    Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                                        ''    AppWl.WL03ProcessCode = AppProcess.ProcQuality.ToString.ToUpper
                                        ''    AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                                        ''    AppWl.WL05RefID = ReqId
                                        ''    ' AppWl.WL99RefWLID = ViewState("p1")
                                        ''    AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                                        ''    AppWl.WL07Priority = "N"
                                        ''    AppWl.WL08CompCode = AppWl.WL08CompCode
                                        ''    AppWl.WL09SysUserID = AppWl.WL09SysUserID
                                        ''    AppWl.WL13Status = "O"
                                        ''    ' If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                                        ''    AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper()
                                        ''    AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & "(طلب محول)"
                                        ''    AppWl.WL16RefStationID = ""
                                        ''    AppWl.WL17RefTask = ""
                                        ''    AppWl.WL18RefOther = "R"
                                        ''    AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                                        ''    AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                                        ''    AppWl.WL98OnlyOwner = ddlEmp.SelectedValue.ToString
                                        ''    'If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                                        ''    AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"



                                        ''    AppWl.WL99ModuleID = "R"
                                        ''    AppWl.WL99ApprLevel = "0"
                                        ''    InsertWorklist(cn, cmd, AppWl)
                                        ''    ' CloseWorklist(cn, cmd, worklistId, Session("UserID"), txtProcRemarks.Text)
                                        ''    ' CloseWorklist(cn, cmd, WL_ID, Session("user_id").ToString, "C", "")


                                        ''ElseIf ReqStatus = "O" Then
                                        ''    Dim OpenWL = GetFieldValue(cn, cmd, "SELECT WL_ID FROM APP_WORKLIST WHERE REF_ID='" & ReqId & "' AND NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper() & "' AND STATUS='O'  ")
                                        ''    If OpenWL <> "" Then

                                        ''        CloseWorklist(cn, cmd, OpenWL, Session("user_id").ToString, "C", "تم تحويل الطلب عن طريق الجودة")
                                        ''        Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                                        ''        AppWl.WL03ProcessCode = AppProcess.ProcQuality.ToString.ToUpper
                                        ''        AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                                        ''        AppWl.WL05RefID = ReqId
                                        ''        ' AppWl.WL99RefWLID = ViewState("p1")
                                        ''        AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                                        ''        AppWl.WL07Priority = "N"
                                        ''        AppWl.WL08CompCode = AppWl.WL08CompCode
                                        ''        AppWl.WL09SysUserID = AppWl.WL09SysUserID
                                        ''        AppWl.WL13Status = "O"
                                        ''        ' If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                                        ''        AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper()
                                        ''        AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & "(طلب محول)"
                                        ''        AppWl.WL16RefStationID = ""
                                        ''        AppWl.WL17RefTask = ""
                                        ''        AppWl.WL18RefOther = "R"
                                        ''        AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                                        ''        AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                                        ''        AppWl.WL98OnlyOwner = ddlEmp.SelectedValue.ToString
                                        ''        'If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                                        ''        AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"



                                        ''        AppWl.WL99ModuleID = "R"
                                        ''        AppWl.WL99ApprLevel = "0"
                                        ''        InsertWorklist(cn, cmd, AppWl)




                                        ''    End If


                                        ''End If


                                        CLOSEOPENWORKLIST(cmd, ReqId)


                                        Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                                        AppWl.WL03ProcessCode = AppProcess.ProcQuality.ToString.ToUpper
                                        AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                                        AppWl.WL05RefID = ReqId
                                        ' AppWl.WL99RefWLID = ViewState("p1")
                                        AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                                        AppWl.WL07Priority = "N"
                                        AppWl.WL08CompCode = AppWl.WL08CompCode
                                        AppWl.WL09SysUserID = AppWl.WL09SysUserID
                                        AppWl.WL13Status = "O"
                                        ' If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                                        AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper()
                                        AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & "(طلب محول)"
                                        AppWl.WL16RefStationID = ""
                                        AppWl.WL17RefTask = ""
                                        AppWl.WL18RefOther = "R"
                                        AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                                        AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                                        AppWl.WL98OnlyOwner = ddlEmp.SelectedValue.ToString
                                        'If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                                        AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"



                                        AppWl.WL99ModuleID = "R"
                                        AppWl.WL99ApprLevel = "0"
                                        InsertWorklist(cn, cmd, AppWl)

                                        Q = ""
                                        Q = Q & " update ars_request_hdr set STATUS='O',TYPE_CAT =NULL,Q_CANCEL=NULL , emp_no ='" & ddlEmp.SelectedValue.ToString & "',DEPT_HEAD='" & GetFieldValue(cn, cmd, "select sup from emp_mst where emp_no='" & ddlEmp.SelectedValue.ToString & "'") & "',TRANS_DATE= FORMAT(convert(date,'" & CDate(GetServerDate(cn, cmd)) & "'),'dd/MM/yyyy')  where doc_no= '" & ReqId & "'   "
                                        cmd.CommandText = Q
                                        cmd.ExecuteNonQuery()
                                        RunInOtherDb(Q)
                                        Dim AppWl_TRANS As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                                        AppWl_TRANS.WL03ProcessCode = AppProcess.ProcCreate.ToString.ToUpper
                                        AppWl_TRANS.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl_TRANS.WL03ProcessCode)
                                        AppWl_TRANS.WL05RefID = ReqId
                                        ' AppWl.WL99RefWLID = ViewState("p1")
                                        AppWl_TRANS.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                                        AppWl_TRANS.WL07Priority = "N"
                                        AppWl_TRANS.WL08CompCode = AppWl_TRANS.WL08CompCode
                                        AppWl_TRANS.WL09SysUserID = AppWl_TRANS.WL09SysUserID
                                        AppWl_TRANS.WL13Status = "P"
                                        AppWl_TRANS.WL19SubProc2 = ReqOwner
                                        AppWl_TRANS.WL14NextProcessCode = AppProcess.ProcTrans.ToString.ToUpper
                                        AppWl_TRANS.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl_TRANS.WL14NextProcessCode)
                                        AppWl_TRANS.WL16RefStationID = ""
                                        AppWl_TRANS.WL17RefTask = ""
                                        AppWl_TRANS.WL18RefOther = "R"
                                        AppWl_TRANS.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper
                                        AppWl_TRANS.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                                        AppWl_TRANS.WL98OnlyOwner = ReqOwner
                                        AppWl_TRANS.WL99PageLink = "../Pages/ProcessingPage.aspx"
                                        AppWl_TRANS.WL99ModuleID = "R"
                                        AppWl_TRANS.WL99ApprLevel = "0"
                                        InsertWorklist(cn, cmd, AppWl_TRANS)

                                        Dim AppWl_TRANS2 As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                                        AppWl_TRANS2.WL03ProcessCode = AppProcess.ProcCreate.ToString.ToUpper
                                        AppWl_TRANS2.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl_TRANS2.WL03ProcessCode)
                                        AppWl_TRANS2.WL05RefID = ReqId
                                        ' AppWl.WL99RefWLID = ViewState("p1")
                                        AppWl_TRANS2.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                                        AppWl_TRANS2.WL07Priority = "N"
                                        AppWl_TRANS2.WL08CompCode = AppWl_TRANS2.WL08CompCode
                                        AppWl_TRANS2.WL09SysUserID = AppWl_TRANS2.WL09SysUserID
                                        AppWl_TRANS2.WL13Status = "P"
                                        AppWl_TRANS2.WL19SubProc2 = ReqOwner
                                        AppWl_TRANS2.WL14NextProcessCode = AppProcess.ProcTrans.ToString.ToUpper
                                        AppWl_TRANS2.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl_TRANS2.WL14NextProcessCode)
                                        AppWl_TRANS2.WL16RefStationID = ""
                                        AppWl_TRANS2.WL17RefTask = ""
                                        AppWl_TRANS2.WL18RefOther = "R"
                                        AppWl_TRANS2.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper
                                        AppWl_TRANS2.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                                        AppWl_TRANS2.WL98OnlyOwner = ddlEmp.SelectedValue.ToString
                                        AppWl_TRANS2.WL99PageLink = "../Pages/ProcessingPage.aspx"
                                        AppWl_TRANS2.WL99ModuleID = "R"
                                        AppWl_TRANS2.WL99ApprLevel = "0"
                                        InsertWorklist(cn, cmd, AppWl_TRANS2)

                                    End If




                                End If
                            Next
                            End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    ' cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try

            End Using
        End Using





        If saveFlag = True Then
            CloseModal(Me.Page, "QualityModal")
            ' ClosePage(Me.Page)
        End If

    End Sub


    Protected Sub btnChangeType_Click(sender As Object, e As EventArgs)

        Dim Q = ""

        Dim saveFlag As Boolean = False



        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction



        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)

        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)


                        For i As Integer = 0 To grdWL.Rows.Count - 1
                                Dim r = grdWL.Rows(i)
                                If CType(r.FindControl("chk"), CheckBox).Checked Then

                                    Dim ReqId = CType(r.FindControl("btnRefStep"), LinkButton).Text
                                    Q = ""
                                    Q = Q & " update ars_request_hdr set  TYPE_CAT ='" & ddlTypeCateg.SelectedValue.ToString & "'   where doc_no= '" & ReqId & "'   "
                                    cmd.CommandText = Q
                                    cmd.ExecuteNonQuery()

                                RunInOtherDb(Q)

                            End If
                            Next
                            End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using






        If saveFlag = True Then
            CloseModal(Me.Page, "ChangeCategModal")
            GetPageData(0, 100)
            ' ClosePage(Me.Page)
        End If

    End Sub

    Protected Sub CLOSEOPENWORKLIST(cmd As SqlCommand, DOCNO As String, Optional CloseRemarks As String = "")
        Dim Remarks
        If CloseRemarks = "" Then
            Remarks = "تحويل بواسطة الجودة"
        Else
            Remarks = CloseRemarks
        End If
        Dim Q As String = ""
        Q = ""
        Q = Q & " update app_worklist  set status='C',CLOSED_DATE=EnjazVB.GetServerDate(),CLOSED_REMARKS=N'" & Remarks & "'  WHERE STATUS IN ('P','O') AND REF_ID='" & DOCNO & "'   "

        cmd.CommandText = Q
        cmd.ExecuteNonQuery()
        RunInOtherDb(Q)
    End Sub



    Protected Sub ddlStep_SelectedIndexChanged(sender As Object, e As EventArgs)
        If Not (ddlStep.SelectedValue Is Nothing) Then
            GetPageData(0, 100)
        End If
    End Sub

    Protected Sub btnAddRemarks_Click(sender As Object, e As EventArgs)
        If txtRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل ملاحظة اكمال المستندات")
            Exit Sub
        End If

        'Dim cn As New SqlConnection
        '    Dim cmd As New SqlCommand
        '    Dim trans As SqlTransaction

        '    cn = OpenConnection()
        '    trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        '    cmd.Connection = cn
        '    cmd.Transaction = trans

        '    SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        AppWl.WL03ProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
                        AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                        AppWl.WL05RefID = requestId
                        ' AppWl.WL99RefWLID = ViewState("p1")
                        AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL121ClosedRemarks = txtRemarks.Text.ToString
                        AppWl.WL11ClosedDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL12ClosedBy = Session("user_id").ToString

                        AppWl.WL07Priority = "N"
                        AppWl.WL08CompCode = AppWl.WL08CompCode
                        AppWl.WL09SysUserID = AppWl.WL09SysUserID
                        AppWl.WL13Status = "C"

                        AppWl.WL14NextProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
                        AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                        AppWl.WL16RefStationID = ""
                        AppWl.WL17RefTask = ""
                        AppWl.WL18RefOther = "R"
                        AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper


                        ' AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                        AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        AppWl.WL98OnlyOwner = Session("emp_no").ToString

                        'AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        'AppWl.WL98OnlyOwner = ddlEmployee.SelectedValue.ToString
                        AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                        AppWl.WL99ModuleID = "R"
                        AppWl.WL99ApprLevel = "0"
                        'InsertWorklist(cn, cmd, AppWl)
                        InsertRemarks(cn, cmd, AppWl)


                        'InsertNewRemarks(cn, cmd, AppWl)
                        ''Dim con As New SqlConnection
                        ''Dim cmd2 As New SqlCommand
                        ''Dim tran As SqlTransaction

                        ''con = OpenConnectionName("Enjazcon2")
                        ''tran = con.BeginTransaction(IsolationLevel.ReadCommitted)
                        ''cmd2.Connection = con
                        ''cmd2.Transaction = tran
                        ''Try
                        ''    InsertRemarks(cn, cmd, AppWl, con, cmd2)
                        ''Catch ex As Exception
                        ''    ShowPopUpMsg(Me.Page, ex.ToString)
                        ''    tran.Rollback()
                        ''End Try

                        ''tran.Commit()
                        ''con.Close()





                        ''UpdateLastRemarks(cn, cmd, requestId, txtRemarks.Text)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using





        If saveFlag = True Then
            txtRemarks.Text = ""
            CloseModal(Me.Page, "myModal")
            '  RedirectURL("../pages/Worklist.aspx")
            ' ucApprovals.DocNo = requestId
        End If


    End Sub

    Protected Sub ddlCompPay_SelectedIndexChanged(sender As Object, e As EventArgs)
        If Not (ddlCompPay.SelectedValue Is Nothing) Then
            GetPageData(0, 100)
        End If
    End Sub

    Protected Sub ddlCustomService_SelectedIndexChanged(sender As Object, e As EventArgs)
        If Not (ddlCustomService.SelectedValue Is Nothing) Then
            GetPageData(0, 100)
        End If
    End Sub

    Protected Sub ddlSup_SelectedIndexChanged(sender As Object, e As EventArgs)
        If Not (ddlSup.SelectedValue Is Nothing) Then
            GetPageData(0, 100)
        End If
    End Sub

    Protected Sub ddlCancelType_SelectedIndexChanged(sender As Object, e As EventArgs)
        If Not (ddlCancelType.SelectedValue Is Nothing) Then
            GetPageData(0, 100)
        End If
    End Sub

    Protected Sub btnUpdateForUpload_Click(sender As Object, e As EventArgs)
        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)


                        Dim q = ""
                        q = ""
                        q = q & " update ars_request_hdr set FORUPLOAD='" & ddlForUpload.SelectedValue.ToString & "' where doc_no= '" & requestId & "'   "
                        cmd.CommandText = q
                        cmd.ExecuteNonQuery()
                        RunInOtherDb(q)
                    End Using
                    trans.Commit()
                    saveFlag = True
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then
            CloseModal(Me.Page, "myModal")
            '  RedirectURL("../pages/Worklist.aspx")
            ' ucApprovals.DocNo = requestId
        End If
    End Sub

    Protected Sub btnExport_Click(sender As Object, e As EventArgs)
        Dim dtCustomers As New DataTable
        IsCustPhone = True
        GetPageData(0, 2500)
        IsCustPhone = False
        dtCustomers = ViewState("CustPhones")
        Using wb As New XLWorkbook()
            wb.Worksheets.Add(dtCustomers, "جوالات العملاء")
            Response.Clear()
            Response.Buffer = True
            Response.Charset = ""
            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
            Response.AddHeader("content-disposition", "attachment;filename=CustPhones_" & DateTime.Now.ToString("ddMMyyyy") & ".xlsx")
            Using MyMemoryStream As New MemoryStream()
                wb.SaveAs(MyMemoryStream)
                MyMemoryStream.WriteTo(Response.OutputStream)
                Response.Flush()
                Response.End()
            End Using
        End Using

    End Sub
End Class

Contents of ucRequestForOffer.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucRequestForOffer.ascx.vb" Inherits="EnjazVB.ucRequestForOffer" %>


<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <%-- <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>--%>
    <ContentTemplate>
        <fieldset>
            <legend class="noLegend"></legend>
            <div class="panel panel-primary">
                <div id="divHeader" runat="server" style="background: linear-gradient(TO RIGHT ,#BF953F,#FCF6BA,#B38728,#FBF5B7,#AA771C); font-size: 2vw; font-weight: bold;" class="panel-heading text-center">
                    <h2 id="H2" class="panel-title" runat="server">
                        <asp:Localize ID="Req_Details" runat="server" Text="طلب عقاري"></asp:Localize></h2>
                    <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i>
                    </span>
                </div>
                <div class="panel-body">

                    <div class="container-fluid">
                        <div class="form-horizontal">
                            <div style="overflow:no-display">
                                <div style="overflow:auto">
                           <div class="form-group">


                                  <div class="col-sm-12">
                                <div class="col-sm-3">
                                </div>
                                <div class="col-sm-6">
                                   


                                    
                                     <div class="form-group">
                                        <div class="col-sm-12">
                                            
                                            <asp:Label ID="Label8" runat="server" Text="رقم العرض" Font-Bold="True"></asp:Label><span>
                                                                                   <span><asp:CheckBox  ID="ChYes" runat="server"  Checked="true" AutoPostBack="true" OnCheckedChanged="ChYes_CheckedChanged"    Text="يوجد"  /></span>
                                               <span><asp:CheckBox  ID="CheNo" runat="server" AutoPostBack="true" OnCheckedChanged="CheNo_CheckedChanged"  Text="لا يوجد"   /></span>
                                                <asp:TextBox ID="txtOfferId" placeholder="فضلا رقم العرض" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                                       <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label7" runat="server" Text="طريقة الشراء" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlBuying" AutoPostBack="true" OnSelectedIndexChanged="ddlBuying_SelectedIndexChanged"  runat="server" CssClass="form-control" Width="100%">
                                                <asp:ListItem Value="C" Text="كاش" Selected="True"></asp:ListItem>
                                             <asp:ListItem Value="I" Text="اقساط" ></asp:ListItem>
                                            </asp:DropDownList>
                                         </div> </div>


                                     <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="LabelRequestedBy" runat="server" Text="الاسم" Font-Bold="True"></asp:Label><span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtname" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtname" placeholder="فضلا ادخل الاسم" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="LabelRequestID" runat="server" Text="رقم الجوال" Font-Bold="True"></asp:Label><span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtPhone" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <span>
                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                                                    ControlToValidate="txtPhone" ErrorMessage="تحقق من رقم الجوال" ForeColor="Red"
                                                    ValidationExpression="[0-9]{10}"></asp:RegularExpressionValidator>
                                            </span>
                                            <asp:TextBox ID="txtPhone" TextMode="Number" MaxLength="10" placeholder="05 فضلا رقم الجوال" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                                    <div runat="server" visible="false" id="InstallDiv" class="form-group">

                                 <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label2" runat="server" Text="الخدمة المطلوبة" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlService" AutoPostBack="true" OnSelectedIndexChanged="ddlService_SelectedIndexChanged" runat="server" CssClass="form-control" Width="100%">
                                                <asp:ListItem Value="F" Text="تمويل" Selected="True"></asp:ListItem>
                                             <asp:ListItem Value="M" Text="فك رهن واعادة تمويل" ></asp:ListItem>
                                            </asp:DropDownList>
</div> </div>
                                    
                                       <div runat="server" id="divRealValue" visible="false" class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="lbl" runat="server" Text="قيمة العقار السوقية" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtRealValue" TextMode="Number" placeholder="فضلا ادخل القيمة السوقية" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                                    <div  runat="server" id="divMortegage" visible="false"  class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label6" runat="server" Text="مبلغ الرهن" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtMortegage"  TextMode="Number"  placeholder="فضلا ادخل قيمة الرهن" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>


                                   
                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label3" runat="server" Text="جهة العمل" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlWorkPlace" runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>

                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="LabelRequestedDate" runat="server" Text="الراتب" Font-Bold="True"></asp:Label>
                                         <asp:TextBox ID="txtsalary" TextMode="Number" placeholder="فضلا ادخل الراتب" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label4" runat="server" Text="بنك ايداع الراتب" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlBank" runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>

                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label5" runat="server" Text="العمر" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtAge" TextMode="Number" placeholder="فضلا ادخل العمر" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                               <div runat="server" visible="false"  id="divCustomEstateValue" class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="lblEstateValue" runat="server" Text="قيمة العقار ان وجد" Font-Bold="True"></asp:Label>
                                             <asp:TextBox ID="txtCusEstateValue" Text="0" TextMode="Number" placeholder="ادخل قيمة العقار ان وجد" CssClass="form-control" runat="server"></asp:TextBox>
                                      </div>
                                    </div>

                                        </div>
                     <%--               <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="lblLoans" runat="server" Text="عليك التزامات مالية ؟" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlLoans" runat="server" CssClass="form-control input-sm" Width="100%">
                                                <asp:ListItem Text="نعم" Value="Y" Selected="True"></asp:ListItem>
                                                <asp:ListItem Text="لا" Value="N"></asp:ListItem>
                                            </asp:DropDownList>

                                        </div>
                                    </div>--%>
                                    <br />

                                    <div class="form-group">
                                        <div class="col-sm-12">
                                        </div>
                                    </div>


                                    <div class="form-group">
                                        <div class="col-sm-4">
                                            <asp:LinkButton ID="btnSave" style="background:#C5B358;border-color:#BF953F;"  runat="server" CssClass="btn btn-primary btn-md" OnClick="btnSave_Click"
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; حفظ
                                                        "></asp:LinkButton>
                                          
                                           <%--   <asp:LinkButton ID="btnCopy"  onclick="CopyToClipboard();"  style="background:#C5B358;border-color:#BF953F;"  runat="server" CssClass="btn btn-primary btn-md" 
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; حفظ
                                                        "></asp:LinkButton>--%>

                                    
                                        </div>


                                    </div>

                                </div>
                                <div class="col-sm-3">
                                </div>
                                      </div>

                           
                               </div>
                                </div>
                                </div>

                            
 </div>
                    </div>
                </div>
            </div>
        </fieldset>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>

<script>
function ShowMessage()
{
      alert('تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة');
      window.location.href='~/pages/MainPage.aspx';
}
</script>


<script type = "text/javascript">
    function MutExChkList(chk) {
        var chkList = chk.parentNode.parentNode.parentNode;
        var chks = chkList.getElementsByTagName("input");
       for (var i = 0; i < chks.length; i++) {
            if (chks[i] != chk && chk.checked) {
                chks[i].checked = false;
                }
        }
        if (chk.id = "CheNo") {
            toggleTextboxReadOnly('<%= txtOfferId.ClientID %>', true);
                    }

        if (chk.id = "ChYes") {
            toggleTextboxReadOnly('<%= txtOfferId.ClientID %>', false);
        }
    }
</script>


 

Contents of ucRequestForOffer.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucRequestForOffer

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''divHeader control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divHeader As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''H2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H2 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Req_Details control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Req_Details As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''Label8 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label8 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ChYes control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ChYes As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''CheNo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents CheNo As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''txtOfferId control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtOfferId As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlBuying control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlBuying As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''LabelRequestedBy control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestedBy As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator1 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtname control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtname As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''LabelRequestID control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestID As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator2 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''RegularExpressionValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RegularExpressionValidator1 As Global.System.Web.UI.WebControls.RegularExpressionValidator

    '''<summary>
    '''txtPhone control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPhone As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''InstallDiv control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents InstallDiv As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlService control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlService As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''divRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divRealValue As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lbl control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lbl As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRealValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divMortegage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divMortegage As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label6 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtMortegage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtMortegage As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlWorkPlace control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlWorkPlace As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''LabelRequestedDate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestedDate As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtsalary control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtsalary As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlBank control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlBank As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label5 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtAge control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtAge As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divCustomEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCustomEstateValue As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lblEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblEstateValue As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCusEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCusEstateValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucRequestForOffer.ascx.vb:

Imports Oracle.ManagedDataAccess.Client
Imports WebClass.Sys.Classes
Imports WebClass.Sys.webclass.mainclass
Imports WebClass.Sys.Classes.clsGlobarVar
Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization

Public Class ucRequestForOffer
    Inherits System.Web.UI.UserControl
    Dim q As String = ""

    Public Property DocNo As String
        Get
            Return ViewState("DocNo")
        End Get
        Set(value As String)
            ViewState("DocNo") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If

        If Not IsPostBack Then

            If Not IsNothing(Session("emp_no")) Then
                ' lblLoans.Text = "عليه التزامات مالية ؟"
                LabelRequestedBy.Text = "اسم العميل"
                '  divHeader.Style.Remove("style")
                divHeader.Style.Remove("background")
                btnSave.Style.Remove("background")
                btnSave.Style.Remove("border-color")
            End If
            If Not (Request.QueryString("P1")) Is Nothing Then
                ViewState("P1") = Request.QueryString("P1").ToString
            End If


            q = "select type_category,type_Desc from type_mst where type_Code='BK' AND TYPE_ABBR='Y'"
            FillComboSelect(ddlBank, q)
            q = "select type_category,type_Desc from type_mst where type_Code='WE' ORDER BY  TYPE_ABBR "
            FillComboSelect(ddlWorkPlace, q)


        End If
    End Sub

    Protected Sub btTest_Click(sender As Object, e As EventArgs)
        ' ShowPopUpMsg(Me.Page, GetFieldValue("select ref_id from app_worklist"))
        ' Dim currentDate As String = "13/09/2020"
        ' Dim convertedDate As DateTime = DateTime.ParseExact(currentDate, "dd/MM/yyyy", CultureInfo.InvariantCulture)

        ' Convert.ToDateTime(currentDate)
        ShowPopUpMsg(Me.Page, CDate(GetServerDate("", "")).ToString("dd/MM/yyyy"))
    End Sub

    Protected Sub btnSave_Click(sender As Object, e As EventArgs)
        Dim CNT = 0
        If txtname.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الاسم")
            Exit Sub
        End If
        If txtname.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الاسم")
            Exit Sub
        End If
        If txtPhone.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الجوال")
            Exit Sub
        End If

        If ddlBuying.SelectedValue.ToString <> "C" Then
            If txtsalary.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل الراتب")
                Exit Sub
            End If
            If txtAge.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل العمر")
                Exit Sub
            End If
            If ddlBank.SelectedValue = "" Then
                ShowPopUpMsg(Me.Page, "فضلا تحقق من البنك")
                Exit Sub
            End If
            If ddlWorkPlace.SelectedValue = "" Then
                ShowPopUpMsg(Me.Page, "فضلا تحقق من جهة العمل")
                Exit Sub
            End If

            If ddlService.SelectedValue = "M" Then
                If txtRealValue.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل القيمة السوقية للعقار")
                    Exit Sub
                End If
                If txtMortegage.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الرهن")
                    Exit Sub
                End If
            End If
            If ddlService.SelectedValue = "F" Then
                If txtCusEstateValue.Text = "" Then
                    ShowPopUpMsg(Me.Page, "فضلا ادخل قيمة العقار ان وجد وان لم يوجد ادخل 0")
                    Exit Sub
                End If
            End If

            'If GetFieldValue("SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE LTRIM(RTRIM(CONTACT_NO)) = LTRIM(RTRIM(N'" & txtPhone.Text & "'))  ") <> "" Then
            '    If Not IsNothing(Session("emp_no")) Then
            '        ShowPopUpMsg(Me.Page, "العميل لديه طلب بالفعل")
            '    Else
            '        ShowPopUpMsg(Me.Page, "لديك طلب بالفعل الرجاء التواصل معنا")
            '    End If

            '    Exit Sub
            'End If

        End If

        If Not IsNothing(Session("emp_no")) Then
            If GetFieldValue("SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE STATUS='O' AND  LTRIM(RTRIM(CONTACT_NO)) = LTRIM(RTRIM(N'" & txtPhone.Text & "'))  ") <> "" Then
                ShowPopUpMsg(Me.Page, "العميل لديه طلب بالفعل")
                Exit Sub
            End If
        Else

            If GetFieldValue("SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE STATUS='O' AND  LTRIM(RTRIM(CONTACT_NO)) = LTRIM(RTRIM(N'" & txtPhone.Text & "')) AND FORMAT(DOC_DATE,'dd/MM/yyyy')=FORMAT(EnjazVB.GetServerDate(),'dd/MM/yyyy')  ") <> "" Then
                ShowPopUpMsg(Me.Page, "لديك طلب بالفعل الرجاء التواصل معنا")
                Exit Sub
            End If

            CNT = CInt(GetFieldValue("SELECT COUNT(DOC_NO)  FROM ARS_REQUEST_HDR WHERE   LTRIM(RTRIM(CONTACT_NO)) = LTRIM(RTRIM(N'" & txtPhone.Text & "')) AND DATEDIFF(DAY,DOC_DATE,EnjazVB.GetServerDate())>=4  "))
            If CNT > 1 Then
                ShowPopUpMsg(Me.Page, "لديك طلب بالفعل الرجاء التواصل معنا")
                Exit Sub
            End If
        End If




        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction

        'cn = OpenConnection()
        'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        'cmd.Connection = cn
        'cmd.Transaction = trans

        'SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Using cn As New SqlConnection(GetConnString)
            cn.Open()
            Using trans As SqlTransaction = cn.BeginTransaction()
                Try

                    Using cmd As New SqlCommand()
                        cmd.Connection = cn        ' Set the connection
                        cmd.Transaction = trans    ' Set the transaction
                        SetDateSession(cn, cmd)

                        If GetFieldValue(cn, cmd, "SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE LTRIM(RTRIM(CONTACT_NO))= LTRIM(RTRIM(N'" & txtPhone.Text & "'))  AND STATUS='O'  AND FORMAT(DOC_DATE,'dd/MM/yyyy')=FORMAT(EnjazVB.GetServerDate(),'dd/MM/yyyy') ") = "" Then

                            btnSave.Enabled = False
                            DocNo = GetSeries(cn, cmd, "R")
                            ViewState("ServerDate") = GetServerDate(cn, cmd)
                            q = ""
                            q = ""
                            q = q & " INSERT INTO ars_request_hdr  "
                            q = q & " ( "
                            q = q & "      tran_type, "
                            q = q & "      doc_no, "
                            q = q & "      doc_date, "
                            q = q & "      REQ_DATE ,"
                            q = q & "      yr ,"
                            q = q & "      emp_no, "
                            q = q & "      br_assign, "
                            q = q & "      dept_head, "
                            q = q & "      CUST_ID, "
                            q = q & "      req_action, "
                            q = q & "      req_by, "
                            q = q & "      trs_from, "
                            q = q & "      trs_to, "
                            q = q & "      status, "
                            q = q & "      subject, "
                            q = q & "      sys_userid, "
                            q = q & "      comp_code, "
                            q = q & "      refcomp_code, "
                            q = q & "      contact_no, "

                            q = q & "      other1, "  'bank
                            q = q & "      other2, " 'salary
                            q = q & "      other3, "  'workplace 
                            'q = q & "      other8, "
                            q = q & "      SERVICE, "
                            If ddlService.SelectedValue.ToString = "M" Then
                                q = q & "      M_REAL_VALUE, "
                                q = q & "      MORTEGAGE_VALUE, "
                            End If
                            q = q & "     CusEstateValue,"
                            q = q & "      ref_docno ,DUP,OFFER_ID,BUYING_TYPE"
                            q = q & " ) "
                            q = q & " VALUES ("
                            q = q & "      'R',"
                            q = q & "      @doc_no,"
                            q = q & "      FORMAT(convert(date,'" & CDate(ViewState("ServerDate")) & "'),'dd/MM/yyyy') , "
                            q = q & "      '" & CDate(ViewState("ServerDate")).ToString("dd/MM/yyyy") & "' , "
                            q = q & "      '" & CInt(CDate(ViewState("ServerDate")).ToString("yyyy")) & "' , "
                            If Not IsNothing(Session("emp_no")) Then
                                q = q & "      '" & Session("emp_no").ToString & "',"
                            Else
                                If Not IsNothing(ViewState("P1")) Then
                                    q = q & "      '" & ViewState("P1").ToString & "',"
                                Else
                                    q = q & "      '',"
                                End If


                            End If
                            If Not IsNothing(Session("emp_no")) Then
                                q = q & "      'EMP',"
                            Else
                                q = q & "      'OFF',"
                            End If

                            If Not IsNothing(Session("emp_no")) Then
                                q = q & "      '" & GetFieldValue("select sup from emp_mst where emp_no='" & Session("emp_no").ToString & "'") & "',"
                            Else
                                q = q & "      '',"
                            End If


                            q = q & "      '',"
                            q = q & "      '1',"
                            q = q & "      N'" & txtname.Text & "',"
                            q = q & "      N'" & txtAge.Text & "'," 'trs_from --age
                            q = q & "      ''," 'trs_to
                            q = q & "      'O',"
                            q = q & "      '',"
                            q = q & "      '',"
                            q = q & "      '',"
                            q = q & "      '',"
                            q = q & "       N'" & txtPhone.Text & "', "
                            q = q & "      '" & ddlBank.SelectedValue.ToString & "', "
                            q = q & "      N'" & txtsalary.Text & "', "
                            q = q & "      '" & ddlWorkPlace.Text.ToString & "', "
                            'q = q & "      '" & ddlLoans.SelectedValue.ToString & "', " 'Quotation or Cash
                            q = q & "      '" & ddlService.SelectedValue.ToString & "', "
                            If ddlService.SelectedValue.ToString = "M" Then
                                q = q & "       N'" & txtRealValue.Text & "', "
                                q = q & "      N'" & txtMortegage.Text & "', "
                            End If
                            q = q & "      N'" & txtCusEstateValue.Text & "', "
                            q = q & "      '' ,'" & IIf(CNT > 0, "Y", "N") & "','" & txtOfferId.Text & "', '" & ddlBuying.SelectedValue.ToString & "' "
                            q = q & "      ) "
                            cmd.CommandText = q
                            If q.ToString.ToUpper.Contains("DELETE") Or q.ToString.ToUpper.Contains("UPDATE") Or q.ToString.ToUpper.Contains("DROP") Or q.ToString.ToUpper.Contains("TRUNCATE") Then
                                Throw New Exception("try again !")
                            End If
                            cmd.Parameters.AddWithValue("@doc_no", DocNo)
                            cmd.ExecuteNonQuery()

                            Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                            AppWl.WL03ProcessCode = AppProcess.ProcCreate.ToString.ToUpper
                            AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                            AppWl.WL05RefID = DocNo
                            ' AppWl.WL99RefWLID = ViewState("p1")
                            AppWl.WL06RefDate = CDate(ViewState("ServerDate")).ToString("dd/MM/yyyy")
                            AppWl.WL07Priority = "N"
                            AppWl.WL08CompCode = AppWl.WL08CompCode
                            AppWl.WL09SysUserID = AppWl.WL09SysUserID
                            AppWl.WL13Status = "O"
                            If Not IsNothing(Session("emp_no")) Or Not IsNothing(ViewState("P1")) Then
                                AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper
                            Else
                                AppWl.WL14NextProcessCode = AppProcess.ProcAssign.ToString.ToUpper
                            End If

                            AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                            AppWl.WL16RefStationID = ""
                            AppWl.WL17RefTask = ""
                            AppWl.WL18RefOther = "R"
                            AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                            If Not IsNothing(Session("emp_no")) Or Not IsNothing(ViewState("P1")) Then
                                AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                                If Not IsNothing(Session("emp_no")) Then
                                    AppWl.WL98OnlyOwner = Session("emp_no").ToString
                                Else
                                    AppWl.WL98OnlyOwner = ViewState("P1").ToString
                                End If

                                AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                            Else
                                AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                                AppWl.WL99PageLink = "../Pages/CheckRequests.aspx"
                            End If

                            AppWl.WL99ModuleID = "R"
                            AppWl.WL99ApprLevel = "0"
                            InsertWorklist(cn, cmd, AppWl)




                            trans.Commit()
                            saveFlag = True
                        End If
                    End Using
                Catch ex As Exception
                    ShowPopUpMsg(Me.Page, ex.ToString)
                    trans.Rollback()

                Finally
                    'cmd.Dispose()
                    trans.Dispose()
                    cn.Close()
                    cn.Dispose()
                End Try
            End Using
        End Using
        If saveFlag = True Then

            If Not IsNothing(Session("emp_no")) Then
                ShowPopUpMsg(Me.Page, "تم رفع الطلب بنجاح ")
                clear()
                ' RedirectURL("~/pages/Worklist.aspx")
            Else
                ' ShowPopUpMsg(Me.Page, "تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة")
                'Response.Write("<script language='javascript'>window.alert('تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة');window.location='~/pages/MainPage.aspx';</script>")
                ' RedirectURL("~/pages/MainPage.aspx")
                '  Windows.location.href = "~/pages/MainPage.aspx"

                'ScriptManager.RegisterStartupScript(Me, Me.GetType(), "key", "ShowMessage()", True)
                clear()
                Dim message As String = "تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة"

                ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType(), "Alert", "<script type = 'text/javascript'>window.onload=new function(){setTimeout(""alert('" + message + "');window.location='/../pages/HomePage.aspx';"", 1000)};</script>", False)
                ' ScriptManager.RegisterClientScriptBlock(_page, _page.GetType(), "ModalScript", sb.ToString(), False)


                ' ShowPopUpMsg(Me.Page, "تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة")
                ' Threading.sleep()
                'Dim meta As New HtmlMeta()
                'meta.HttpEquiv = "Refresh"
                'meta.Content = "3;url=~/pages/MainPage.aspx"
                'Me.Page.Controls.Add(meta)
                'Label1.Text = "You will now be redirected in 5 seconds"


                'Page.ClientScript.RegisterStartupScript(Me.Page, Me.Page.GetType(), "Redirect", script, True)
                'Page.ClientScript.RegisterStartupScript(Me.[GetType](), "Redirect", script, True)

                ''''''ScriptManager.RegisterStartupScript(_Page.Page, _Page.GetType(), "showalert", sb.ToString(), True)
            End If

        End If

    End Sub

    Public Sub clear()

        txtOfferId.Text = ""
        txtname.Text = ""
        txtPhone.Text = ""
        txtsalary.Text = ""
        txtAge.Text = ""
        txtRealValue.Text = ""
        txtMortegage.Text = ""
        ddlService.SelectedIndex = -1
        ddlBank.SelectedIndex = -1
        ddlWorkPlace.SelectedIndex = -1
    End Sub

    Protected Sub btnCopy_Click(sender As Object, e As EventArgs)
        ' Clipboard.SetText("")
        ' My.Computer.Clipboard.SetText("This is a test string.")
        ' Clipboard.SetText("")
    End Sub

    Protected Sub ddlService_SelectedIndexChanged(sender As Object, e As EventArgs)
        If ddlService.SelectedValue = "F" Then
            divRealValue.Visible = False
            divMortegage.Visible = False
            If CheNo.Checked = True Then
                divCustomEstateValue.Visible = True
            End If
        Else
            divRealValue.Visible = True
            divMortegage.Visible = True
            txtCusEstateValue.Text = "0"
            divCustomEstateValue.Visible = False
        End If
    End Sub

    Protected Sub ddlBuying_SelectedIndexChanged(sender As Object, e As EventArgs)
        If ddlBuying.SelectedValue = "I" Then
            InstallDiv.Visible = True
        Else
            InstallDiv.Visible = False
        End If
    End Sub

    Protected Sub ChYes_CheckedChanged(sender As Object, e As EventArgs)
        If ChYes.Checked Then
            CheNo.Checked = False
            txtOfferId.ReadOnly = False
        Else
            CheNo.Checked = True
            txtOfferId.Text = ""
            txtOfferId.ReadOnly = True
        End If
    End Sub

    Protected Sub CheNo_CheckedChanged(sender As Object, e As EventArgs)
        If CheNo.Checked Then
            ChYes.Checked = False
            txtOfferId.Text = ""
            txtOfferId.ReadOnly = True

        Else
            ChYes.Checked = True
            txtOfferId.ReadOnly = False
        End If
    End Sub
End Class

Contents of ucStumbled.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucStumbled.ascx.vb" Inherits="EnjazVB.ucStumbled" %>
<%@ Register Src="~/Controls/ucCustomerInfo.ascx" TagPrefix="uc1" TagName="ucCustomerInfo" %>
<%@ Register Src="~/Controls/ucApprovals.ascx" TagPrefix="uc1" TagName="ucApprovals" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>                
                <div class="form-horizontal">
                  
                          <div class="form-group">
                        <div style="overflow: auto;">
                            <div style="direction:rtl;" class="table-responsive">
                                <asp:GridView ID="grdWL"   CssClass="table table-hover table-striped" runat="server" AllowPaging="false" AllowCustomPaging="false" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%" meta:resourcekey="grdWLResource1">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource1">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnRefresh" runat="server" CssClass="btn btn-primary btn-sm pull-right"  ToolTip="Refresh" meta:resourcekey="btnRefreshResource1" Text="
                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-refresh&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblSrNo" runat="server" Text='<%# Eval("srno") %>' meta:resourcekey="lblSrNoResource1"></asp:Label>
<%--                                                <asp:HiddenField ID="hwl_days" runat="server" Value='<%# Eval("wl_days") %>' />--%>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>  
                                        
                                        <asp:TemplateField HeaderText="رقم الطلب" SortExpression="doc_no" >
                                        <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton ID="btnStep" runat="server" OnCommand="btnStep_Command"
                                                     Text='<%# Bind("ref_id") %>'
                                                    ToolTip="Click to open the details" CommandName="Step" CommandArgument='<%# string.Concat(Eval("ref_id"), ",", Eval("ref_id"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <%-- Enabled='<%# IIf(isSupper Or isSupvisor, True, False) %>'--%>
                                             

 <asp:TemplateField HeaderText="العميل" SortExpression="customer" >
                                           <ItemTemplate>
                                                <asp:Label ID="lblcustomer" runat="server" Text='<%# Eval("customer") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                          

                                        <asp:TemplateField HeaderText="هوية العميل" SortExpression="cust_id" >
                                           <ItemTemplate>
                                                <asp:Label ID="lblcust_id" runat="server" Text='<%# Eval("cust_id") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>



                                        <asp:TemplateField HeaderText="موظف البنك" SortExpression="initempbank" >
                                          <ItemTemplate>
                                                <asp:Label ID="lbllinitempbank" runat="server" Text='<%# Eval("initempbank") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>
 <asp:TemplateField HeaderText="بنك التمويل" SortExpression="INV_bank"  >
                                         <ItemTemplate>
                                                <asp:Label ID="lblINV_bank" runat="server" Text='<%# Eval("INV_bank") %>' meta:resourcekey="lblPriorityResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                            <%--  <asp:TemplateField HeaderText="بنك الراتب" SortExpression="salary_bank"  >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblBank" runat="server" Text="بنك الراتب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="salary_bank" ></asp:LinkButton>
                                                <asp:TextBox ID="salary_bank" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblBank" runat="server" Text='<%# Eval("salary_bank") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>



                                        <asp:TemplateField HeaderText="تاريخ الطلب" SortExpression="doc_date" meta:resourcekey="TemplateFieldResource3">
                                           <ItemTemplate>
                                                <asp:Label ID="lblDate" runat="server" Text='<%# Eval("doc_date") %>' meta:resourcekey="lblDateResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        

                                         <asp:TemplateField HeaderText="حالة الطلب" SortExpression="status" >
                                        <ItemTemplate>
                                                <asp:Label ID="lblstatus" runat="server" Text='<%# Eval("status") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>



                                            <asp:TemplateField HeaderText="اخر تحديث"  >
                                          <%--  <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWLID" runat="server" Text="تسلسل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="wl_id" ></asp:LinkButton>
                                                <asp:TextBox ID="wl_id" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" meta:resourcekey="wl_idResource1"></asp:TextBox>
                                            </HeaderTemplate>--%>
                                            <ItemTemplate>
                                                <asp:Label ID="lblWlID" runat="server" Text='<%# Eval("last_update") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

<%--                                        <asp:BoundField DataField="next_process_id" HeaderText="NextProcessID" Visible="False"  />
                                        <asp:BoundField DataField="process_id" HeaderText="ProcessID" Visible="False"  />--%>

                                  <%--      <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource13">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnpending" runat="server" CssClass="btn btn-primary btn-sm pull-right" ToolTip="Pending List"  Text="
                                                        &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-right&quot;&gt;&lt;/i&gt;
                                                " ></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:LinkButton ID="btnPending" runat="server"
                                                    ToolTip="Add to Pending" CssClass="btn btn-primary btn-sm pull-right" CommandName="addpending" CommandArgument='<%# Eval("wl_id") %>'  OnClientClick="javascript:return confirm('Are you sure add to pending?');" meta:resourcekey="btnPendingResource2" Text="
                                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-left&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>
                                    </Columns>
                                    <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                
                    </div>
                <div id="myModal" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="t4" class="modal-title" runat="server">
                            <asp:Localize ID="Localize3" runat="server" meta:resourcekey="Localize3Resource1" Text="تفاصيل الطلب"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         <div class="form-group">
                             <div class="col-sm-12">
                        <uc1:ucCustomerInfo runat="server" id="ucCustomerInfo" />
                       </div>
                             </div>
                         
                         <div class="form-group">
                               <div class="col-sm-12">
                         <asp:Label ID="Label7" runat="server" Text="الموافقات" Font-Bold="True" ></asp:Label>
                        <div class="form-group">
                                  <div style="height:350px;overflow:auto">
                                 <uc1:ucApprovals runat="server" id="ucApprovals" />
                                      </div>
                                </div>
                                   </div>
                             </div>
                         <hr />
                        <br />
                        
                        
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>
                    </div>

                </div>
            </div>
        </div>

                </ContentTemplate>
            </asp:UpdatePanel>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>
  

Contents of ucStumbled.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucStumbled

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''grdWL control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdWL As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''t4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents t4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize3 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucCustomerInfo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucCustomerInfo As Global.EnjazVB.ucCustomerInfo

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ucApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucApprovals As Global.EnjazVB.ucApprovals

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucStumbled.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports WebClass.Sys.Classes
Public Class ucStumbled
    Inherits System.Web.UI.UserControl
    Dim sSql As String = ""


    Private Property PendingFlag As String
        Get
            Return Session("PendingFlag")
        End Get
        Set(value As String)
            Session("PendingFlag") = value
        End Set
    End Property


    Public Property isSupper As Boolean
        Get
            Return Session("isSupper")
        End Get
        Set(value As Boolean)
            Session("isSupper") = value
        End Set
    End Property

    Public Property isSupvisor As Boolean
        Get
            Return Session("isSupvisor")
        End Get
        Set(value As Boolean)
            Session("isSupvisor") = value
        End Set
    End Property

    Private Property RpWLFilterCondition As String
        Get
            Return Session("RpWLFilterCondition")
        End Get
        Set(value As String)
            Session("RpWLFilterCondition") = value
        End Set
    End Property

    Private Property pWLFilterValue As String
        Get
            Return Session("pWLFilterValue")
        End Get
        Set(value As String)
            Session("pWLFilterValue") = value
        End Set
    End Property

    Public Property requestId As String
        Get
            Return ViewState("requestId")
        End Get
        Set(value As String)
            ViewState("requestId") = value
        End Set
    End Property

    Public Property requestOwner As String
        Get
            Return ViewState("requestOwner")
        End Get
        Set(value As String)
            ViewState("requestOwner") = value
        End Set
    End Property

    Public Property isQulity As Boolean
        Get
            Return Session("isQulity")
        End Get
        Set(value As Boolean)
            Session("isQulity") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If
        Try


            If Not IsPostBack Then
                ' grdWL.VirtualItemCount = GetOpenWL(Session("EmpNo").ToString, False)
                ' grdWL.VirtualItemCount = GetOpenWL(Session("emp_no").ToString, False)
                PendingFlag = "N"
                isSupper = IIf(Session("supper_user").ToString = "True", True, False)
                isSupvisor = IIf(GetFieldValue("SELECT IS_SUP FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
                isQulity = IIf(GetFieldValue("SELECT QUALITY FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
                GetPageData(0, 10)
            End If
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)
        End Try
        SetGridStyle(grdWL)
    End Sub

    Protected Sub ddlStatus_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Private Sub GetPageData(pgIndex As Integer, pgSize As Integer)

        Try
            Dim dt As New DataTable
            'If pWLFilterCondition <> "" Then

            sSql = "             "
            sSql = sSql & "   SELECT  ROW_NUMBER() OVER (ORDER BY  CONVERT(DATE,DOC_DATE,103) DESC) AS SRNO,A.* FROM (  "
            sSql = sSql & "   SELECT H.DOC_NO AS REF_ID ,FORMAT(H.DOC_DATE,'dd/MM/yyyy')DOC_DATE, REQ_BY AS CUSTOMER ,H.INITEMPBANK,H.cust_id, BK.TYPE_DESC AS SALARY_BANK, W.TYPE_DESC AS SEC,H.CONTACT_NO ,S.TYPE_DESC AS STATUS ,H.STATUS  AS STATUS_CODE,H.REF_PROCID,ISNULL(H.REF_DOCNO,'O')REF_DOCNO ,H.REFCOMP_CODE,ISNULL(H.SERVICE,'F') AS SERVICE,"
            sSql = sSql & "   IK.TYPE_DESC  AS INV_BANK,H.OTHER5 AS INVESTMENT_AMT,H.OTHER6 AS READESTATEAMT,H.OTHER7 AS CORPORATE,E.EMP_NAME,H.EMP_NO,H.DEPT_HEAD,H.LAST_UPDATE  "
            sSql = sSql & "   FROM ARS_REQUEST_HDR H WITH (NOLOCK) LEFT JOIN  EMP_MST E WITH (NOLOCK)  ON H.EMP_NO=E.EMP_NO INNER JOIN (SELECT * FROM TYPE_MST WITH (NOLOCK) WHERE TYPE_CODE='RS') S ON H.STATUS=S.TYPE_CATEGORY  "
            sSql = sSql & "   LEFT JOIN (SELECT * FROM TYPE_MST WITH (NOLOCK) WHERE TYPE_CODE='BK') BK ON H.OTHER1=BK.TYPE_CATEGORY "
            sSql = sSql & "   LEFT JOIN (SELECT * FROM TYPE_MST WITH (NOLOCK) WHERE TYPE_CODE='BK') IK ON H.OTHER4=IK.TYPE_CATEGORY "
            sSql = sSql & "   LEFT JOIN (SELECT * FROM TYPE_MST WITH (NOLOCK) WHERE TYPE_CODE='WE')W ON H.OTHER3=W.TYPE_CATEGORY "
            'sSql = sSql & "   LEFT JOIN  APP_WORKLIST L WITH (NOLOCK)  ON L.WL_ID=(SELECT TOP 1 WL_ID FROM APP_WORKLIST WHERE CLOSED_DATE IS NOT NULL AND  REF_ID=H.DOC_NO  ORDER BY CLOSED_DATE DESC)"
            'sSql = sSql & "   OUTER APPLY (SELECT TOP 1 CLOSED_REMARKS, CLOSED_DATE  FROM APP_WORKLIST WITH (NOLOCK) WHERE CLOSED_DATE IS NOT NULL  and ref_id=H.DOC_NO   ORDER BY CLOSED_DATE DESC)  L  "
            sSql = sSql & "    WHERE     H.STATUS='S' AND  H.TRAN_TYPE='R'  "
            sSql = sSql & "    )a    "
            sSql = sSql & "    where 1=1 "
            If isSupper Or isQulity Then
            Else
                ' sSql = sSql & " and  (emp_no='" & Session("emp_no").ToString & "' OR  dept_head='" & Session("emp_no").ToString & "'  )  "
            End If




            dt = GetTable(sSql)
            Dim dt2 = GetTableCon(sSql, "Enjazcon")

            dt.Merge(dt2)
            Dim sortedResults = From row In dt.AsEnumerable()
                                Order By CDate(row.Field(Of String)("DOC_DATE")) Descending

            dt = dt.Clone() ' Clone the structure (columns) of the original table
            ' Import each sorted row into the new DataTable
            Dim rowNumber As Integer = 1
            For Each row In sortedResults
                row("SRNO") = rowNumber
                dt.ImportRow(row)
                rowNumber += 1
            Next
            dt.AcceptChanges()


            If dt.Rows.Count = 0 Then
                Dim nr As DataRow = dt.NewRow
                'dinesh(17-04-23) add empty values as error rais null values to slect color
                'nr("priority") = ""
                nr("srno") = 0
                dt.Rows.Add(nr)
                dt.AcceptChanges()
            End If
            grdWL.DataSource = dt
            grdWL.DataBind()
            SetGridStyle(grdWL)
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)

        End Try
        RpWLFilterCondition = ""
    End Sub

    Protected Sub grdWL_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles grdWL.PageIndexChanging
        grdWL.PageIndex = e.NewPageIndex
        GetPageData(e.NewPageIndex, 10)
        SetGridStyle(grdWL)
    End Sub


    Protected Sub txtFWL_TextChanged(sender As Object, e As EventArgs)
        Dim strText As String = "", strName As String = ""
        strText = CType(sender, TextBox).Text.ToString
        strName = CType(sender, TextBox).ID.ToString

        pWLFilterValue = strText
        RpWLFilterCondition = ""


        If strText <> "" Then
            If strName = "doc_date" Or strName = "ref_date" Then
                strText = CDate(strText).ToString("dd/MM/yyyy")
                RpWLFilterCondition = " format(" & strName & ") = format('" & strText & "','DD/MM/YYYY')"
            Else
                strText = "N'%" & strText.ToUpper & "%'"
                RpWLFilterCondition = " upper(" & strName & ") Like " & strText
            End If
        End If

        GetPageData(0, 10)
        SetGridStyle(grdWL)
    End Sub


    Private Sub grdWL_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles grdWL.RowDataBound
        If IsNothing(RpWLFilterCondition) Then
            RpWLFilterCondition = ""
        End If

        If e.Row.RowType = DataControlRowType.Header Then
            If RpWLFilterCondition.ToLower.ToString.Contains("(ref_id") Then
                CType(e.Row.FindControl("ref_id"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(customer") Then
                CType(e.Row.FindControl("customer"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(contact_no") Then
                CType(e.Row.FindControl("contact_no"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(sec") Then
                CType(e.Row.FindControl("sec"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(inv_bank") Then
                CType(e.Row.FindControl("inv_bank"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(salary_bank") Then
                CType(e.Row.FindControl("salary_bank"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(doc_date") Then
                'CType(e.Row.FindControl("wl_date"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", CDate(Session("pWLFilterValue")).ToString("yyyy-mm-dd"))
                CType(e.Row.FindControl("doc_date"), TextBox).Text = CDate(Session("pWLFilterValue")).ToString("yyyy-MM-dd")
            End If

            If RpWLFilterCondition.ToLower.ToString.Contains("(emp_name") Then
                CType(e.Row.FindControl("emp_name"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(status") Then
                CType(e.Row.FindControl("status"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If

        End If


        If e.Row.RowType = DataControlRowType.DataRow Then



        End If


        SetGridStyle(grdWL)
    End Sub



    Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O" 'rblWLStatus.SelectedValue.ToString


        Dim sWorklistID As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
        Dim sArgRefID As String = ""
        'sWorklistID = e.CommandArgument 'wl_id
        sWorklistID = e.CommandArgument.ToString.Split(",")(0).ToString
        sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString
        requestId = sArgRefID
        sRefID = ""
        sCurrentProcessCode = ""
        sNextProcessCode = ""
        sPageLink = ""

        If e.CommandName = "Step" Then
            ucCustomerInfo.DocNo = sArgRefID
            ucApprovals.DocNo = sArgRefID

            OpenModal(Me.Page, "myModal")
            '  OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)
        ElseIf e.CommandName = "Detail" Then

            OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)



        ElseIf e.CommandName = "addpending" Then

        End If
        SetGridStyle(grdWL)
    End Sub

    Protected Sub ddlStep_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub btnAddRemarks_Click(sender As Object, e As EventArgs)


        Dim cn As New SqlConnection
        Dim cmd As New SqlCommand
        Dim trans As SqlTransaction

        cn = OpenConnection()
        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        cmd.Connection = cn
        cmd.Transaction = trans

        SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Try

            Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
            AppWl.WL03ProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
            AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
            AppWl.WL05RefID = requestId
            ' AppWl.WL99RefWLID = ViewState("p1")
            AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
            ' AppWl.WL121ClosedRemarks = txtRemarks.Text.ToString
            AppWl.WL11ClosedDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
            AppWl.WL12ClosedBy = Session("user_id").ToString

            AppWl.WL07Priority = "N"
            AppWl.WL08CompCode = AppWl.WL08CompCode
            AppWl.WL09SysUserID = AppWl.WL09SysUserID
            AppWl.WL13Status = "C"

            AppWl.WL14NextProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
            AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
            AppWl.WL16RefStationID = ""
            AppWl.WL17RefTask = ""
            AppWl.WL18RefOther = "R"
            AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper


            ' AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
            AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
            AppWl.WL98OnlyOwner = Session("emp_no").ToString

            'AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
            'AppWl.WL98OnlyOwner = ddlEmployee.SelectedValue.ToString
            AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
            AppWl.WL99ModuleID = "R"
            AppWl.WL99ApprLevel = "0"
            InsertWorklist(cn, cmd, AppWl)


            trans.Commit()
            saveFlag = True
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
            trans.Rollback()

        Finally
            cmd.Dispose()
            trans.Dispose()
            cn.Close()
            cn.Dispose()
        End Try
        If saveFlag = True Then
            'txtRemarks.Text = ""
            CloseModal(Me.Page, "myModal")
            '  RedirectURL("../pages/Worklist.aspx")
            ' ucApprovals.DocNo = requestId
        End If
        GetPageData(0, 0)
    End Sub

    Protected Sub ddlCompPay_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub ddlCustomService_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub
End Class

Contents of ucTestForm.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucTestForm.ascx.vb" Inherits="EnjazVB.ucTestForm" %>
<asp:Button ID="btnTest" OnClick="btnTest_Click" runat="server" Text="Test" />

Contents of ucTestForm.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucTestForm

    '''<summary>
    '''btnTest control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnTest As Global.System.Web.UI.WebControls.Button
End Class

Contents of ucTestForm.ascx.vb:

Imports System
Imports Twilio
Imports Twilio.Rest.Api.V2010.Account
Imports System.Threading.Tasks
Imports System.Collections.Generic
Imports Twilio.Types
Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports WebClass.Sys.Classes

Public Class ucTestForm
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Sub SendMessage(phoneNumber As String, message As String)
        Dim accountSid As String = "AC827ec232726266c8172eccb950c7dbf7"
        Dim authToken As String = "143f864827c674fc4b0d6b36ea4325d4"

        ' Initialize the Twilio client
        TwilioClient.Init(accountSid, authToken)
        SendWhatMessage("+966560388926", "Test Whatsapp Message")
    End Sub

    Protected Async Sub btnTest_Click(sender As Object, e As EventArgs)
        'SendMessage("", "")
        'Dim toPhoneNumber As String = "+966560388926" ' Recipient's WhatsApp number
        'Dim fromPhoneNumber As String = "+966533316852" ' Your Twilio WhatsApp number
        'Dim messageBody As String = "Here's that picture of an owl you requested."
        'Dim mediaUrl As String = "https://demo.twilio.com/owl.png"

        '' Call the async function
        'SendWhatsAppMessageAsync(toPhoneNumber, fromPhoneNumber, messageBody, mediaUrl).Wait()

        UpdateProcess()
        'Try
        '    ' Example values for sending a message
        '    Dim toPhoneNumber As String = "+966560388926" ' Recipient's WhatsApp number
        '    Dim fromPhoneNumber As String = "+966533316852" ' Your Twilio WhatsApp number
        '    Dim messageBody As String = "Here's that picture of an owl you requested."
        '    Dim mediaUrl As String = "https://demo.twilio.com/owl.png"

        '    ' Call the async function and await its completion
        '    Await SendWhatsAppMessageAsync(toPhoneNumber, fromPhoneNumber, messageBody, mediaUrl)

        '    'Await AddVerifiedCallPhone()

        '    ' Indicate success (e.g., show a message to the user)
        '    Response.Write("<script>alert('Message sent successfully!');</script>")
        'Catch ex As Exception
        '    ' Handle exceptions, possibly inform the user
        '    Response.Write($"<script>alert('Error: {ex.Message}');</script>")
        'End Try
    End Sub



    Public Async Function SendWhatsAppMessageAsync2(toPhoneNumber As String, fromPhoneNumber As String, messageBody As String, mediaUrl As String) As Task
        ' Find your Account SID and Auth Token at twilio.com/console
        ' and set the environment variables. See http://twil.io/secure
        'Dim accountSid As String = Environment.GetEnvironmentVariable("AC827ec232726266c8172eccb950c7dbf7")
        'Dim authToken As String = Environment.GetEnvironmentVariable("143f864827c674fc4b0d6b36ea4325d4")

        Dim accountSid As String = "AC827ec232726266c8172eccb950c7dbf7"
        Dim authToken As String = "143f864827c674fc4b0d6b36ea4325d4"

        TwilioClient.Init(accountSid, authToken)

        Try
            ' Create and send a WhatsApp message
            Dim message = Await MessageResource.CreateAsync(
                    body:=messageBody,
                    mediaUrl:=New List(Of Uri) From {New Uri(mediaUrl)},
                    to:=New Twilio.Types.PhoneNumber($"whatsapp:{toPhoneNumber}"),
                    from:=New Twilio.Types.PhoneNumber($"whatsapp:{fromPhoneNumber}"))

            ' Output message body in some way, e.g., log or display
            Console.WriteLine($"Message sent: {message.Body}")
        Catch ex As Exception
            ' Handle any errors
            Console.WriteLine($"Error sending message: {ex.Message}")
        End Try
    End Function

    Public Async Function SendWhatsAppMessageAsync(toPhoneNumber As String, fromPhoneNumber As String, messageBody As String, mediaUrl As String) As Task
        ' Find your Account SID and Auth Token at twilio.com/console
        ' and set the environment variables. See http://twil.io/secure
        'Dim accountSid As String = Environment.GetEnvironmentVariable("AC827ec232726266c8172eccb950c7dbf7")
        'Dim authToken As String = Environment.GetEnvironmentVariable("143f864827c674fc4b0d6b36ea4325d4")

        Dim accountSid As String = "AC827ec232726266c8172eccb950c7dbf7"
        Dim authToken As String = "143f864827c674fc4b0d6b36ea4325d4"

        If String.IsNullOrEmpty(accountSid) OrElse String.IsNullOrEmpty(authToken) Then
            Throw New Exception("Twilio Account SID or Auth Token environment variables are not set.")
        End If

        TwilioClient.Init(accountSid, authToken)

        Try
            ' Create and send a WhatsApp message
            Dim message = Await MessageResource.CreateAsync(
                    body:=messageBody,
                    mediaUrl:=New List(Of Uri) From {New Uri(mediaUrl)},
                    to:=New Twilio.Types.PhoneNumber($"whatsapp:{toPhoneNumber}"),
                    from:=New Twilio.Types.PhoneNumber($"whatsapp:{fromPhoneNumber}"))

            ' Output message body to confirm sending
            Console.WriteLine($"Message sent: {message.Body}")
        Catch ex As Exception
            ' Handle any errors
            Console.WriteLine($"Error sending message: {ex.Message}")
        End Try
    End Function

    Public Async Function AddVerifiedCallPhone() As Task
        ' Find your Account SID and Auth Token at twilio.com/console
        ' and set the environment variables. See http://twil.io/secure
        'Dim accountSid As String = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID")
        'Dim authToken As String = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN")
        Dim accountSid As String = "AC827ec232726266c8172eccb950c7dbf7"
        Dim authToken As String = "143f864827c674fc4b0d6b36ea4325d4"
        TwilioClient.Init(accountSid, authToken)

        Dim validationRequest = Await ValidationRequestResource.CreateAsync(
            friendlyName:="My Other Phone Number",
            phoneNumber:=New Twilio.Types.PhoneNumber("+966560388926"))

        Console.WriteLine(validationRequest.AccountSid)
    End Function

    Sub SendWhatMessage(phoneNumber As String, message As String)
        ' Create the message
        Dim messageOptions As CreateMessageOptions = New CreateMessageOptions(New PhoneNumber("whatsapp:" & phoneNumber))
        messageOptions.From = New PhoneNumber("whatsapp:+966533316852")
        messageOptions.Body = message

        ' Send the message
        Dim messageResource As MessageResource = MessageResource.Create(messageOptions)
        '  Console.WriteLine("Message sent to " & phoneNumber)
    End Sub




    Private Sub UpdateProcess()
        Dim dtBranches As New DataTable
        Dim dtStations As New DataTable
        Dim dtPlaces As New DataTable
        Dim sSQL As String
        Dim bSave As Boolean = False
        '  sSQL = "SELECT DISTINCT  * FROM APP_REMARKS  WHERE WL_DATE >=convert(date,'30/09/2024',103)   ORDER BY WL_DATE DESC   " 'WHERE CONVERT(DATE,WL_DATE,103)<=CONVERT(DATE,'31/03/2024',103)
        sSQL = " SELECT DISTINCT  *  FROM APP_WORKOWNER WHERE CAST(WL_ID AS INT ) >=545219  AND WL_ID NOT IN (SELECT WL_ID FROM APP_WORKLIST) "
        dtBranches = GetTable(sSQL)
        ViewState("dtBranches") = dtBranches



        Dim tran As SqlTransaction = Nothing

        Using con As New SqlConnection
            Try


                Dim connection As String = System.Configuration.ConfigurationManager.ConnectionStrings("EnjazBlog").ConnectionString ' ConfigurationManager.ConnectionStrings("tasConn").ConnectionString
                con.ConnectionString = connection 'clsDB.GetConnStringFromConfig("tasConn")
                con.Open()
                tran = con.BeginTransaction()
                ' tran = con.BeginTransaction("Transaction1")
                Using cmd As New SqlCommand()
                    cmd.Transaction = tran
                    dtBranches = ViewState("dtBranches")
                    If dtBranches.Rows.Count > 0 Then
                        Dim CNT = 0
                        For Each r As DataRow In dtBranches.Rows
                            ''Dim selectedDate = CDate(r("WL_DATE")).ToString("yyyy-MM-dd HH:mm:ss")
                            ''sSQL = ""
                            ''sSQL = sSQL & "     INSERT APP_REMARKS (REF_ID, WL_ID, WL_DATE, CLOSED_BY, CLOSED_REMARKS, NEXT_PROCESS_DESC) "
                            ''sSQL = sSQL & "      VALUES('" & r("REF_ID").ToString & "','" & r("WL_ID").ToString & "','" & selectedDate & "','" & r("CLOSED_BY").ToString & "',N'" & r("CLOSED_REMARKS").ToString & "',   "

                            ''sSQL = sSQL & "   N'" & r("NEXT_PROCESS_DESC").ToString & "'  ) "
                            sSQL = "  INSERT APP_WORKOWNER (WL_ID,OWNER,MODULE_ID )"
                            sSQL = sSQL & "      VALUES('" & r("WL_ID").ToString & "','" & r("OWNER").ToString & "','" & r("MODULE_ID").ToString & "'  )"
                            cmd.Connection = con
                            cmd.CommandText = sSQL
                            cmd.ExecuteNonQuery()

                            CNT = CNT + 1
                        Next
                    End If



                End Using
                tran.Commit()
                bSave = True
                con.Close()
            Catch ex As Exception

                If tran IsNot Nothing Then
                    tran.Rollback()
                End If
                con.Close()
                bSave = False
                'MessageBox.Show(ex.Message)
                ShowPopUpMsg(Me.Page, ex.Message)
            End Try
        End Using
        If bSave = True Then
            ShowPopUpMsg(Me.Page, "Done.. NO Of Branches:")
        End If
    End Sub


End Class

Contents of ucUpdatePassword.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucUpdatePassword.ascx.vb" Inherits="EnjazVB.ucUpdatePassword" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>
<div class="col-sm-12">
    <div class="col-sm-2"></div>
    <div class="col-sm-8">
  <div  class="form-group">
                            <div  class="panel panel-primary">
                                <div  class="panel-heading">
                                   تغيير كلمة المرور
                                </div>
                                <div class="panel-body">
                                    <div class="col-sm-2">
                                        </div>
                                    <div class="col-sm-8">


                                  <div class="form-group">

                                      <div class="form-group">
    <div class="col-sm-3">
         
        </div>
    <div class="col-sm-9">
        <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator2"
Display = "Dynamic" ForeColor="Red"
ControlToValidate = "txtNewPassword"
ValidationExpression = "(?=^.{6,}$)(?=.*\d)(?=.*[a-zA-Z])"
ErrorMessage="يجب ان تتكون من 8 خانات وحرفين كبيرين وصغيرين ورقمين">
</asp:RegularExpressionValidator>
    </div>
   <%-- <div class="col-sm-3"><asp:Label ID="Label2" runat="server"></asp:Label></div>--%>
    </div>



<div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="lblUserNname" runat="server" Text="كلمة المرور الحالية" Font-Bold="True" ></asp:Label><span> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="login" ControlToValidate="txtOldPassword"  ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
        </div>
    <div class="col-sm-9">
             <asp:TextBox ID="txtOldPassword" TextMode="Password" onkeypress="return isEnglishOnly(event)"  CssClass="form-control" runat="server" ></asp:TextBox>
    </div>
   <%-- <div class="col-sm-3"><asp:Label ID="Label2" runat="server"></asp:Label></div>--%>
    </div>
                                <%--    <br/>--%>
                                        <div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="Label1" runat="server" Text="كلمة المرور الجديدة" Font-Bold="True" ></asp:Label><span> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" Display = "Dynamic" ControlToValidate="txtNewPassword" ValidationGroup="login"  ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
        </div>
    <div class="col-sm-9">
             <asp:TextBox ID="txtNewPassword" onkeypress="return isEnglishOnly(event)"  CssClass="form-control" TextMode="Password" runat="server" ></asp:TextBox>
    </div>
          <%-- <div class="col-sm-3"> </div>--%>
    </div>

                                                                             <div class="form-group">
    <div class="col-sm-3">
         <asp:Label ID="Label2" runat="server" Text="مطابقة كلمة المرور الجديدة" Font-Bold="True" ></asp:Label><span> <asp:RequiredFieldValidator ID="RequiredFieldValidator4" ControlToValidate="txtNewpassTally" ValidationGroup="login"  ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span><span> <asp:CompareValidator ID="CompareValidator2" ControlToValidate="txtNewpassTally" ControlToCompare="txtNewPassword" ForeColor="Red" ValidationGroup="login" runat="server" ErrorMessage="كلمة المرور غير مطابقة"></asp:CompareValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator5" ValidationGroup="login" ControlToValidate="txtNewpassTally"  ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
        </div>
    <div class="col-sm-9">
             <asp:TextBox ID="txtNewpassTally" onkeypress="return isEnglishOnly(event)"  CssClass="form-control" TextMode="Password" runat="server" ></asp:TextBox>
    </div>
          <%-- <div class="col-sm-3"> </div>--%>
    </div>






                                       <br />
                                        <div class="form-group">
                                              <br />
                                            </div>
                                           <div class="form-group">
                                           <%--    <div class="col-sm-3">
                                                   </div>--%>
                                               <div style="direction:ltr" class="col-sm-12">
                                                     <asp:LinkButton  ID="btnUpdate" ValidationGroup="login" runat="server"   CssClass="btn btn-primary btn-md" OnClick="btnUpdate_Click"  
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-login&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; حفظ
                                                        " ></asp:LinkButton>
                                                   </div>
                                               </div>
  </div>




                                  </div>
                                     <div class="col-sm-2">
                                        </div>
                                    </div>
                                </div>
                            </div>
       
        
    



    </div>
    <div class="col-sm-2"></div>
   

    </div>
</ContentTemplate>
    </asp:UpdatePanel>

<%--</div>--%>

<script>
    function isEnglishOnly(evt)
      {
        var charCode = (evt.which) ? evt.which : event.keyCode
         if(charCode == 32)
        return true;
    if(48 <= charCode && charCode <= 57)
        return true;
    if(65 <= charCode && charCode <= 90)
        return true;
    if(97 <= charCode && charCode <= 122)
        return true;

        if (32 <= charCode && charCode <= 47)
            return true;
        if (58 <= charCode && charCode <= 64)
            return true;
        if (91 <= charCode && charCode <= 96)
            return true;
        if (123 <= charCode && charCode <= 126)
            return true;

    return false;
         //if ( (charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) ||(charCode > 31 && (charCode < 48 || charCode > 57)) )
         //   return true;

         //return false;
      }
</script>

Contents of ucUpdatePassword.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucUpdatePassword

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''RegularExpressionValidator2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RegularExpressionValidator2 As Global.System.Web.UI.WebControls.RegularExpressionValidator

    '''<summary>
    '''lblUserNname control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblUserNname As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator1 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtOldPassword control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtOldPassword As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator2 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtNewPassword control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtNewPassword As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator4 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''CompareValidator2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents CompareValidator2 As Global.System.Web.UI.WebControls.CompareValidator

    '''<summary>
    '''RequiredFieldValidator5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator5 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtNewpassTally control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtNewpassTally As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''btnUpdate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnUpdate As Global.System.Web.UI.WebControls.LinkButton
End Class

Contents of ucUpdatePassword.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization

Public Class ucUpdatePassword
    Inherits System.Web.UI.UserControl
    Dim q As String = ""

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnUpdate_Click(sender As Object, e As EventArgs)
        Dim cn As New SqlConnection
        Dim cmd As New SqlCommand
        Dim trans As SqlTransaction

        Dim ChkNew As String = ChkPassCompx(txtNewPassword.Text)
        If ChkNew <> "" Then
            ShowPopUpMsg(Me.Page, ChkNew)
            Exit Sub
        End If

        cn = OpenConnection()
        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        cmd.Connection = cn
        cmd.Transaction = trans

        SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Try
            If GetFieldValue(cn, cmd, "select user_password from  app_users where emp_no='" & Session("emp_no").ToString & "' and  user_password='" & txtOldPassword.Text & "'  COLLATE SQL_Latin1_General_CP1_CS_AS   ") <> "" Then

                q = ""
                q = q & " update app_users set user_password='" & txtNewPassword.Text.ToString & "' where emp_no='" & Session("emp_no").ToString & "' and user_id=  '" & Session("user_id").ToString & "'  "
                cmd.CommandText = q
                cmd.ExecuteNonQuery()
                trans.Commit()
                Session("password") = txtNewPassword.Text.ToString
                saveFlag = True
            Else
                ShowPopUpMsg(Me.Page, "كلمة المرور القديمة غير صحيحة")
                Exit Sub
            End If
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
            trans.Rollback()

        Finally
            cmd.Dispose()
            trans.Dispose()
            cn.Close()
            cn.Dispose()
        End Try
        If saveFlag = True Then
            Dim L = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes("XxX"))
            ' RedirectURL("../pages/Login.aspx?L=" & L)
            RedirectURL("~/pages/Login.aspx?L=" & L)
        End If


    End Sub
End Class

Contents of ucUpdateStatus.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucUpdateStatus.ascx.vb" Inherits="EnjazVB.ucUpdateStatus" %>
  <%@ Register Src="~/Controls/ucCustomerInfo.ascx" TagPrefix="uc1" TagName="ucCustomerInfo" %>
<%@ Register Src="~/Controls/ucApprovals.ascx" TagPrefix="uc1" TagName="ucApprovals" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>                
                <div class="form-horizontal">
                  
                          <div class="form-group">
                        <div style="overflow: auto;">
                            <div style="direction:rtl;" class="table-responsive">
                                <asp:GridView ID="grdWL"   CssClass="table table-hover table-striped" runat="server" AllowPaging="false" AllowCustomPaging="false" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%" meta:resourcekey="grdWLResource1">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource1">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnRefresh" runat="server" CssClass="btn btn-primary btn-sm pull-right"  ToolTip="Refresh" meta:resourcekey="btnRefreshResource1" Text="
                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-refresh&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblSrNo" runat="server" Text='<%# Eval("srno") %>' meta:resourcekey="lblSrNoResource1"></asp:Label>
<%--                                                <asp:HiddenField ID="hwl_days" runat="server" Value='<%# Eval("wl_days") %>' />--%>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField> 
                                        
                                        
                                         <asp:TemplateField >
                                          <HeaderTemplate>
                                              <asp:LinkButton ID="btQuality"  Enabled='<%# IIf(isSupper Or isSupvisor Or (isQulity And isSupvisor), True, False) %>'    runat="server" OnCommand="btnQuality_Command" Text="تحويل" CssClass="control-label" Style="color: white;" ></asp:LinkButton>
                                           </HeaderTemplate>

                                             <%-- <HeaderTemplate>
                                                            <asp:LinkButton ID="lblSEND" runat="server" Text="اسناد الطلب"  CssClass="control-label" Style="color: white;" OnCommand="btnSend_Command"  ></asp:LinkButton>
                                                 </HeaderTemplate>--%>

                                                <ItemTemplate>
                                                            <asp:CheckBox ID="chk" Enabled='<%# IIf((isSupper Or isSupvisor Or (isQulity And isSupvisor)) And (Eval("Q_CANCEL").ToString <> "Y" Or isSupper) And Eval("STATUS_CODE").ToString <> "C" And Eval("UPLOADED").ToString = "", True, False) %>' runat="server"   />
                                                        </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>
                                        
                                        <asp:TemplateField HeaderText="رقم الطلب" SortExpression="doc_no" >
                                        <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton ID="btnStep" runat="server" OnCommand="btnStep_Command"
                                                     Text='<%# Bind("ref_id") %>'
                                                    ToolTip="Click to open the details" CommandName="Step" CommandArgument='<%# string.Concat(Eval("ref_id"), ",", Eval("ref_id"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <%-- Enabled='<%# IIf(isSupper Or isSupvisor, True, False) %>'--%>
                                             

 <asp:TemplateField HeaderText="العميل" SortExpression="customer" >
                                           <ItemTemplate>
                                                <asp:Label ID="lblcustomer" runat="server" Text='<%# Eval("customer") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                          

                                        <asp:TemplateField HeaderText="هوية العميل" SortExpression="cust_id" >
                                           <ItemTemplate>
                                                <asp:Label ID="lblcust_id" runat="server" Text='<%# Eval("cust_id") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>



                                        <asp:TemplateField HeaderText="موظف البنك" SortExpression="initempbank" >
                                          <ItemTemplate>
                                                <asp:Label ID="lbllinitempbank" runat="server" Text='<%# Eval("initempbank") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>
 <asp:TemplateField HeaderText="بنك التمويل" SortExpression="INV_bank"  >
                                         <ItemTemplate>
                                                <asp:Label ID="lblINV_bank" runat="server" Text='<%# Eval("INV_bank") %>' meta:resourcekey="lblPriorityResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                            <%--  <asp:TemplateField HeaderText="بنك الراتب" SortExpression="salary_bank"  >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblBank" runat="server" Text="بنك الراتب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="salary_bank" ></asp:LinkButton>
                                                <asp:TextBox ID="salary_bank" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblBank" runat="server" Text='<%# Eval("salary_bank") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>



                                        <asp:TemplateField HeaderText="تاريخ الطلب" SortExpression="doc_date" meta:resourcekey="TemplateFieldResource3">
                                           <ItemTemplate>
                                                <asp:Label ID="lblDate" runat="server" Text='<%# Eval("doc_date") %>' meta:resourcekey="lblDateResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        

                                         <asp:TemplateField HeaderText="حالة الطلب" SortExpression="status" >
                                        <ItemTemplate>
                                                <asp:Label ID="lblstatus" runat="server" Text='<%# Eval("status") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                           <asp:TemplateField HeaderText="الموظف المتابع" SortExpression="initempbank" >
                                          <ItemTemplate>
                                                <asp:Label ID="lblemp_name" runat="server" Text='<%# Eval("emp_name") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>


                                            <asp:TemplateField HeaderText="اخر تحديث"  >
                                          <%--  <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWLID" runat="server" Text="تسلسل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="wl_id" ></asp:LinkButton>
                                                <asp:TextBox ID="wl_id" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" meta:resourcekey="wl_idResource1"></asp:TextBox>
                                            </HeaderTemplate>--%>
                                            <ItemTemplate>
                                                <asp:Label ID="lblWlID" runat="server" Text='<%# Eval("last_update") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

<%--                                        <asp:BoundField DataField="next_process_id" HeaderText="NextProcessID" Visible="False"  />
                                        <asp:BoundField DataField="process_id" HeaderText="ProcessID" Visible="False"  />--%>

                                  <%--      <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource13">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnpending" runat="server" CssClass="btn btn-primary btn-sm pull-right" ToolTip="Pending List"  Text="
                                                        &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-right&quot;&gt;&lt;/i&gt;
                                                " ></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:LinkButton ID="btnPending" runat="server"
                                                    ToolTip="Add to Pending" CssClass="btn btn-primary btn-sm pull-right" CommandName="addpending" CommandArgument='<%# Eval("wl_id") %>'  OnClientClick="javascript:return confirm('Are you sure add to pending?');" meta:resourcekey="btnPendingResource2" Text="
                                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-left&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>
                                    </Columns>
                                    <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                
                    </div>
                <div id="myModal" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="t4" class="modal-title" runat="server">
                            <asp:Localize ID="Localize3" runat="server" meta:resourcekey="Localize3Resource1" Text="تفاصيل الطلب"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         <div class="form-group">
                             <div class="col-sm-12">
                        <uc1:ucCustomerInfo runat="server" id="ucCustomerInfo" />
                       </div>
                             </div>
                         
                         <div class="form-group">
                               <div class="col-sm-12">
                         <asp:Label ID="Label7" runat="server" Text="الموافقات" Font-Bold="True" ></asp:Label>
                        <div class="form-group">
                                  <div style="height:350px;overflow:auto">
                                 <uc1:ucApprovals runat="server" id="ucApprovals" />
                                      </div>
                                </div>
                                   </div>
                             </div>
                         <hr />
                        <br />
                        
                         <div runat="server" visible="false" id="NotesDiv" class="form-group">
                                <div class="col-sm-10">
                                                   <asp:Label ID="Label21" runat="server" Text="تحديث الحالة" Font-Bold="True" ></asp:Label>
                                                <asp:TextBox ID="txtRemarks"    CssClass="form-control" runat="server" ></asp:TextBox>
                                               </div>
                               <div class="col-sm-2">
                                              <asp:Label ID="Label22" runat="server" Text="." Font-Bold="True" ></asp:Label>
                                                <asp:LinkButton ID="btnAddRemarks" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnAddRemarks_Click" 
                                       OnClientClick="if (confirm('هل تريد تحديث الحالة ؟')) 
                                                             {if (Page_IsValid) this.disabled = true;} else {return false;}"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;تحديث  حالة  الطلب
                                                        " ></asp:LinkButton>
                                              </div>
                             </div>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>
                    </div>

                </div>
            </div>
        </div>

                </ContentTemplate>
            </asp:UpdatePanel>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>
  
             <div id="QualityModal" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="H1" class="modal-title" runat="server">
                            <asp:Localize ID="Localize1" runat="server" meta:resourcekey="Localize3Resource1" Text="الجودة"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         
                         
                         <div class="form-group">
                               <div class="col-sm-8">
                         <asp:Label ID="Label1" runat="server" Text="الى الموظف" Font-Bold="True" ></asp:Label>
                          <asp:DropDownList ID="ddlEmp"   runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                              </div>
                              <div class="col-sm-4">
                                  <br />
                                               <asp:LinkButton ID="btnSave" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnSave_Click"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; تحويل
                                                        " ></asp:LinkButton> 
                              </div>
                             </div>
                         <hr />
                        <br />
                        
                         
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>
                    </div>

                </div>
            </div>
        </div>

Contents of ucUpdateStatus.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucUpdateStatus

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''grdWL control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdWL As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''t4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents t4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize3 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucCustomerInfo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucCustomerInfo As Global.EnjazVB.ucCustomerInfo

    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ucApprovals control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucApprovals As Global.EnjazVB.ucApprovals

    '''<summary>
    '''NotesDiv control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents NotesDiv As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label21 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label21 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRemarks As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label22 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label22 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnAddRemarks control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnAddRemarks As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress

    '''<summary>
    '''H1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H1 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize1 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlEmp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlEmp As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton
End Class

Contents of ucUpdateStatus.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports WebClass.Sys.Classes
Public Class ucUpdateStatus
    Inherits System.Web.UI.UserControl

    Dim sSql As String = ""


    Private Property PendingFlag As String
        Get
            Return Session("PendingFlag")
        End Get
        Set(value As String)
            Session("PendingFlag") = value
        End Set
    End Property


    Public Property isSupper As Boolean
        Get
            Return Session("isSupper")
        End Get
        Set(value As Boolean)
            Session("isSupper") = value
        End Set
    End Property

    Public Property isSupvisor As Boolean
        Get
            Return Session("isSupvisor")
        End Get
        Set(value As Boolean)
            Session("isSupvisor") = value
        End Set
    End Property

    Public Property isQulity As Boolean
        Get
            Return Session("isQulity")
        End Get
        Set(value As Boolean)
            Session("isQulity") = value
        End Set
    End Property

    Private Property RpWLFilterCondition As String
        Get
            Return Session("RpWLFilterCondition")
        End Get
        Set(value As String)
            Session("RpWLFilterCondition") = value
        End Set
    End Property

    Private Property pWLFilterValue As String
        Get
            Return Session("pWLFilterValue")
        End Get
        Set(value As String)
            Session("pWLFilterValue") = value
        End Set
    End Property

    Public Property requestId As String
        Get
            Return ViewState("requestId")
        End Get
        Set(value As String)
            ViewState("requestId") = value
        End Set
    End Property

    Public Property requestOwner As String
        Get
            Return ViewState("requestOwner")
        End Get
        Set(value As String)
            ViewState("requestOwner") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If
        Try


            If Not IsPostBack Then
                ' grdWL.VirtualItemCount = GetOpenWL(Session("EmpNo").ToString, False)
                ' grdWL.VirtualItemCount = GetOpenWL(Session("emp_no").ToString, False)
                PendingFlag = "N"
                isSupper = IIf(Session("supper_user").ToString = "True", True, False)
                isSupvisor = IIf(GetFieldValue("SELECT IS_SUP FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
                isQulity = IIf(GetFieldValue("SELECT QUALITY FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
                Dim Q = ""
                Q = "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A'  "
                If isSupvisor And Not isQulity Then
                    Q = "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' AND (EMP_NO='" & Session("emp_no").ToString & "' OR SUP='" & Session("emp_no").ToString & "')  "
                End If
                FillComboSelect(ddlEmp, Q)

                GetPageData(0, 10)
            End If
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)
        End Try
        SetGridStyle(grdWL)
    End Sub

    Protected Sub btnQuality_Command(sender As Object, e As CommandEventArgs)
        Dim count = 0
        For i As Integer = 0 To grdWL.Rows.Count - 1
            Dim r = grdWL.Rows(i)
            If CType(r.FindControl("chk"), CheckBox).Checked Then
                count = count + 1
                Exit For
            End If
        Next
        If count > 0 Then
            OpenModal(Me.Page, "QualityModal")
        Else
            ShowPopUpMsg(Me.Page, "فضلا اختر طلب واحد علي الاقل")
        End If
    End Sub

    Protected Sub btnSave_Click(sender As Object, e As EventArgs)

        Dim Q = ""

        Dim saveFlag As Boolean = False



        Dim cn As New SqlConnection
        Dim cmd As New SqlCommand
        Dim trans As SqlTransaction



        cn = OpenConnection()
        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        cmd.Connection = cn
        cmd.Transaction = trans

        SetDateSession(cn, cmd)

        Try
            For i As Integer = 0 To grdWL.Rows.Count - 1
                Dim r = grdWL.Rows(i)
                If CType(r.FindControl("chk"), CheckBox).Checked Then

                    Dim ReqId = CType(r.FindControl("btnStep"), LinkButton).Text
                    Dim ReqOwner = GetFieldValue(cn, cmd, "select emp_no from ars_request_hdr where doc_no='" & ReqId & "'")
                    Dim ReqStatus = GetFieldValue(cn, cmd, "select status from ars_request_hdr where doc_no='" & ReqId & "'")

                    If ddlEmp.SelectedValue.ToString <> ReqOwner Then

                        ''If ReqStatus = "N" Or ReqStatus = "D" Then
                        ''    Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        ''    AppWl.WL03ProcessCode = AppProcess.ProcQuality.ToString.ToUpper
                        ''    AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                        ''    AppWl.WL05RefID = ReqId
                        ''    ' AppWl.WL99RefWLID = ViewState("p1")
                        ''    AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        ''    AppWl.WL07Priority = "N"
                        ''    AppWl.WL08CompCode = AppWl.WL08CompCode
                        ''    AppWl.WL09SysUserID = AppWl.WL09SysUserID
                        ''    AppWl.WL13Status = "O"
                        ''    ' If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                        ''    AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper()
                        ''    AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & "(طلب محول)"
                        ''    AppWl.WL16RefStationID = ""
                        ''    AppWl.WL17RefTask = ""
                        ''    AppWl.WL18RefOther = "R"
                        ''    AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                        ''    AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        ''    AppWl.WL98OnlyOwner = ddlEmp.SelectedValue.ToString
                        ''    'If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                        ''    AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"



                        ''    AppWl.WL99ModuleID = "R"
                        ''    AppWl.WL99ApprLevel = "0"
                        ''    InsertWorklist(cn, cmd, AppWl)
                        ''    ' CloseWorklist(cn, cmd, worklistId, Session("UserID"), txtProcRemarks.Text)
                        ''    ' CloseWorklist(cn, cmd, WL_ID, Session("user_id").ToString, "C", "")


                        ''ElseIf ReqStatus = "O" Then
                        ''    Dim OpenWL = GetFieldValue(cn, cmd, "SELECT WL_ID FROM APP_WORKLIST WHERE REF_ID='" & ReqId & "' AND NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper() & "' AND STATUS='O'  ")
                        ''    If OpenWL <> "" Then

                        ''        CloseWorklist(cn, cmd, OpenWL, Session("user_id").ToString, "C", "تم تحويل الطلب عن طريق الجودة")
                        ''        Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        ''        AppWl.WL03ProcessCode = AppProcess.ProcQuality.ToString.ToUpper
                        ''        AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                        ''        AppWl.WL05RefID = ReqId
                        ''        ' AppWl.WL99RefWLID = ViewState("p1")
                        ''        AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        ''        AppWl.WL07Priority = "N"
                        ''        AppWl.WL08CompCode = AppWl.WL08CompCode
                        ''        AppWl.WL09SysUserID = AppWl.WL09SysUserID
                        ''        AppWl.WL13Status = "O"
                        ''        ' If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                        ''        AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper()
                        ''        AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & "(طلب محول)"
                        ''        AppWl.WL16RefStationID = ""
                        ''        AppWl.WL17RefTask = ""
                        ''        AppWl.WL18RefOther = "R"
                        ''        AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                        ''        AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        ''        AppWl.WL98OnlyOwner = ddlEmp.SelectedValue.ToString
                        ''        'If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                        ''        AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"



                        ''        AppWl.WL99ModuleID = "R"
                        ''        AppWl.WL99ApprLevel = "0"
                        ''        InsertWorklist(cn, cmd, AppWl)




                        ''    End If


                        ''End If


                        CLOSEOPENWORKLIST(cmd, ReqId)


                        Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        AppWl.WL03ProcessCode = AppProcess.ProcQuality.ToString.ToUpper
                        AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                        AppWl.WL05RefID = ReqId
                        ' AppWl.WL99RefWLID = ViewState("p1")
                        AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl.WL07Priority = "N"
                        AppWl.WL08CompCode = AppWl.WL08CompCode
                        AppWl.WL09SysUserID = AppWl.WL09SysUserID
                        AppWl.WL13Status = "O"
                        ' If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                        AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper()
                        AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode) & "(طلب محول)"
                        AppWl.WL16RefStationID = ""
                        AppWl.WL17RefTask = ""
                        AppWl.WL18RefOther = "R"
                        AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                        AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        AppWl.WL98OnlyOwner = ddlEmp.SelectedValue.ToString
                        'If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                        AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"



                        AppWl.WL99ModuleID = "R"
                        AppWl.WL99ApprLevel = "0"
                        InsertWorklist(cn, cmd, AppWl)

                        Q = ""
                        Q = Q & " update ars_request_hdr set STATUS='O', emp_no ='" & ddlEmp.SelectedValue.ToString & "',DEPT_HEAD='" & GetFieldValue(cn, cmd, "select sup from emp_mst where emp_no='" & ddlEmp.SelectedValue.ToString & "'") & "',TRANS_DATE= FORMAT(convert(date,'" & CDate(GetServerDate(cn, cmd)) & "'),'dd/MM/yyyy')  where doc_no= '" & ReqId & "'   "
                        cmd.CommandText = Q
                        cmd.ExecuteNonQuery()

                        Dim AppWl_TRANS As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        AppWl_TRANS.WL03ProcessCode = AppProcess.ProcCreate.ToString.ToUpper
                        AppWl_TRANS.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl_TRANS.WL03ProcessCode)
                        AppWl_TRANS.WL05RefID = ReqId
                        ' AppWl.WL99RefWLID = ViewState("p1")
                        AppWl_TRANS.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl_TRANS.WL07Priority = "N"
                        AppWl_TRANS.WL08CompCode = AppWl_TRANS.WL08CompCode
                        AppWl_TRANS.WL09SysUserID = AppWl_TRANS.WL09SysUserID
                        AppWl_TRANS.WL13Status = "P"
                        AppWl_TRANS.WL19SubProc2 = ReqOwner
                        AppWl_TRANS.WL14NextProcessCode = AppProcess.ProcTrans.ToString.ToUpper
                        AppWl_TRANS.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl_TRANS.WL14NextProcessCode)
                        AppWl_TRANS.WL16RefStationID = ""
                        AppWl_TRANS.WL17RefTask = ""
                        AppWl_TRANS.WL18RefOther = "R"
                        AppWl_TRANS.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper
                        AppWl_TRANS.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        AppWl_TRANS.WL98OnlyOwner = ReqOwner
                        AppWl_TRANS.WL99PageLink = "../Pages/ProcessingPage.aspx"
                        AppWl_TRANS.WL99ModuleID = "R"
                        AppWl_TRANS.WL99ApprLevel = "0"
                        InsertWorklist(cn, cmd, AppWl_TRANS)

                        Dim AppWl_TRANS2 As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                        AppWl_TRANS2.WL03ProcessCode = AppProcess.ProcCreate.ToString.ToUpper
                        AppWl_TRANS2.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl_TRANS2.WL03ProcessCode)
                        AppWl_TRANS2.WL05RefID = ReqId
                        ' AppWl.WL99RefWLID = ViewState("p1")
                        AppWl_TRANS2.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                        AppWl_TRANS2.WL07Priority = "N"
                        AppWl_TRANS2.WL08CompCode = AppWl_TRANS2.WL08CompCode
                        AppWl_TRANS2.WL09SysUserID = AppWl_TRANS2.WL09SysUserID
                        AppWl_TRANS2.WL13Status = "P"
                        AppWl_TRANS2.WL19SubProc2 = ReqOwner
                        AppWl_TRANS2.WL14NextProcessCode = AppProcess.ProcTrans.ToString.ToUpper
                        AppWl_TRANS2.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl_TRANS2.WL14NextProcessCode)
                        AppWl_TRANS2.WL16RefStationID = ""
                        AppWl_TRANS2.WL17RefTask = ""
                        AppWl_TRANS2.WL18RefOther = "R"
                        AppWl_TRANS2.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper
                        AppWl_TRANS2.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                        AppWl_TRANS2.WL98OnlyOwner = ddlEmp.SelectedValue.ToString
                        AppWl_TRANS2.WL99PageLink = "../Pages/ProcessingPage.aspx"
                        AppWl_TRANS2.WL99ModuleID = "R"
                        AppWl_TRANS2.WL99ApprLevel = "0"
                        InsertWorklist(cn, cmd, AppWl_TRANS2)

                    End If




                End If
            Next
            trans.Commit()
            saveFlag = True
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
            trans.Rollback()

        Finally
            cmd.Dispose()
            trans.Dispose()
            cn.Close()
            cn.Dispose()
        End Try







        If saveFlag = True Then
            CloseModal(Me.Page, "QualityModal")
            ' ClosePage(Me.Page)
        End If

    End Sub

    Protected Sub CLOSEOPENWORKLIST(cmd As SqlCommand, DOCNO As String)
        Dim Q As String = ""
        Q = ""
        Q = Q & " update app_worklist  set status='C',CLOSED_DATE=EnjazVB.GetServerDate(),CLOSED_REMARKS=N'تحويل بواسطة الجودة'  WHERE STATUS IN ('P','O') AND REF_ID='" & DOCNO & "'   "

        cmd.CommandText = Q
        cmd.ExecuteNonQuery()

    End Sub

    Protected Sub ddlStatus_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Private Sub GetPageData(pgIndex As Integer, pgSize As Integer)

        Try
            Dim dt As New DataTable
            'If pWLFilterCondition <> "" Then

            sSql = "             "
            sSql = sSql & "   SELECT  ROW_NUMBER() OVER (ORDER BY  Convert(date,doc_date,103) DESC,EMP_NAME ) as srno,a.* FROM (  "
            sSql = sSql & "   select h.doc_no AS REF_ID ,format(h.doc_date,'dd/MM/yyyy')doc_date, REQ_BY AS customer ,h.initempbank,h.cust_id, BK.TYPE_DESC AS salary_bank, W.TYPE_dESC AS SEC,H.CONTACT_NO ,s.type_desc as status ,H.STATUS  AS STATUS_CODE,H.ref_procid,ISNULL(H.REF_DOCNO,'O')REF_DOCNO ,H.refcomp_code,ISNULL(H.SERVICE,'F') AS SERVICE,"
            sSql = sSql & "   IK.TYPE_DESC  as INV_bank,h.other5 as investment_amt,h.other6 as readEstateAmt,h.other7 as corporate,e.emp_name,H.EMP_NO,H.dept_head,H.last_update,h.Q_CANCEL, U.REF_ID AS UPLOADED "
            sSql = sSql & "   from ARS_REQUEST_HDR h WITH (NOLOCK) left join  emp_mst e WITH (NOLOCK)  on h.emp_no=e.emp_no inner join (select * from type_mst WITH (NOLOCK) where type_code='RS') S on h.status=s.type_category  "
            sSql = sSql & "   left join (select * from type_mst WITH (NOLOCK) where type_Code='BK') BK ON H.OTHER1=BK.TYPE_cATEGORY "
            sSql = sSql & "   left join (select * from type_mst WITH (NOLOCK) where type_Code='BK') IK ON H.OTHER4=IK.TYPE_cATEGORY "
            sSql = sSql & "   left join (select * from type_mst WITH (NOLOCK) where type_Code='WE')W ON H.OTHER3=W.TYPE_CATEGORY "
            sSql = sSql & "   left join (SELECT  REF_ID FROM APP_WORKLIST  WITH (NOLOCK) WHERE NEXT_PROCESS_ID NOT IN ('" & AppProcess.ProcUploadDoc.ToString.ToUpper & "','" & AppProcess.ProcCreate.ToString.ToUpper & "','" & AppProcess.ProcCheck.ToString.ToUpper & "','" & AppProcess.ProcCancelConfirm.ToString.ToUpper & "','" & AppProcess.ProcAssign.ToString.ToUpper & "') AND STATUS='O') U ON H.DOC_NO=U.REF_ID  "
            'sSql = sSql & "   LEFT JOIN  APP_WORKLIST L WITH (NOLOCK)  ON L.WL_ID=(SELECT TOP 1 WL_ID FROM APP_WORKLIST WHERE CLOSED_DATE IS NOT NULL AND  REF_ID=H.DOC_NO  ORDER BY CLOSED_DATE DESC)"
            'sSql = sSql & "   OUTER APPLY (SELECT TOP 1 CLOSED_REMARKS, CLOSED_DATE  FROM APP_WORKLIST WITH (NOLOCK) WHERE CLOSED_DATE IS NOT NULL  and ref_id=H.DOC_NO   ORDER BY CLOSED_DATE DESC)  L  "
            sSql = sSql & "    WHERE H.TYPE_CAT IS NULL AND  H.TRAN_TYPE='R' AND    DATEDIFF(DAY, ISNULL(LASTUPDATEDATE, DOC_DATE), ENJAZVB.GETSERVERDATE())>= " & IIf(isQulity, "14", "8") & "  AND  H.STATUS  NOT IN ('C','D','N')  AND (H.DOC_NO IN (SELECT REF_ID FROM APP_WORKLIST WHERE NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "'   AND STATUS='O') ][)  "
            sSql = sSql & "    )a    "
            sSql = sSql & "    where 1=1   "
            If isSupper Then
            Else
                sSql = sSql & "    and  (emp_no='" & Session("emp_no").ToString & "'  OR dept_head='" & Session("emp_no").ToString & "' )  "
            End If

            'sSql = sSql & "     ORDER BY EMP_NAME "



            '    sSql = "SELECT WL.*  FROM ("
            '    sSql = sSql & " SELECT ROW_NUMBER() OVER (ORDER BY  WL_DAYS DESC, CAST(WL_ID AS NUMERIC(38, 10)) DESC) SRNO, A.* FROM VOPENWORKLIST A WHERE 1=1 "
            '    sSql = sSql & " AND OWNER='" & Session("emp_no").ToString & "' AND PENDING_FLAG='" & PendingFlag & "'"
            '    sSql = sSql & " AND " & pWLFilterCondition
            '    sSql = sSql & " ) WL"
            '    sSql = sSql & "  WHERE SRNO BETWEEN ((" & pgIndex & "*10)+1) AND ((" & pgIndex & "+1)*" & pgSize & ")"
            '    sSql = sSql & " ORDER BY SRNO"
            'Else
            '    sSql = " SELECT WL.* FROM ("
            '    sSql = sSql & " SELECT ROW_NUMBER() OVER (ORDER BY  WL_DAYS DESC, CAST(WL_ID AS NUMERIC(38, 10)) DESC) SRNO, A.* FROM VOPENWORKLIST A WHERE 1=1"
            '    sSql = sSql & " AND OWNER='" & Session("emp_no").ToString & "' AND PENDING_FLAG='" & PendingFlag & "'"
            '    sSql = sSql & ") WL"
            '    sSql = sSql & " WHERE  "
            '    sSql = sSql & "  SRNO BETWEEN ((" & pgIndex & "*10)+1) AND ((" & pgIndex & "+1)*" & pgSize & ")"
            '    sSql = sSql & " ORDER BY SRNO"
            'End If

            dt = GetTable(sSql.Replace("][", ""))
            Dim Q As String = ""
            Q = "  SELECT DISTINCT '' + STUFF(( SELECT    TOP 1200  ', '''+ REF_ID +''+'''' FROM   app_Worklist X  WITH (NOLOCK)  "
            Q = Q & "     WHERE NEXT_PROCESS_ID='PROCUPLOADDOC'   AND STATUS='O' "
            Q = Q & "      AND REF_ID NOT IN (SELECT DISTINCT DOC_NO FROM ARS_REQUEST_HDR   WITH (NOLOCK)  ) "
            Q = Q & "      FOR XML  PATH(''), TYPE).value('.', 'VARCHAR(MAX)'), 1, 2, '') AS REFS   "
            Dim REFS = GetFieldValue(Q)

            Dim dt2 = GetTableCon(sSql.Replace("][", " OR DOC_NO IN (" & REFS & " )"), "Enjazcon")
            dt.Merge(dt2)
            Dim sortedResults = From row In dt.AsEnumerable()
                                Order By CDate(row.Field(Of String)("doc_date")) Descending

            dt = dt.Clone() ' Clone the structure (columns) of the original table
            ' Import each sorted row into the new DataTable
            Dim rowNumber As Integer = 1
            For Each row In sortedResults
                row("SRNO") = rowNumber
                dt.ImportRow(row)
                rowNumber += 1
            Next
            dt.AcceptChanges()

            If dt.Rows.Count = 0 Then
                Dim nr As DataRow = dt.NewRow
                'dinesh(17-04-23) add empty values as error rais null values to slect color
                'nr("priority") = ""
                nr("srno") = 0
                dt.Rows.Add(nr)
                dt.AcceptChanges()
            End If
            grdWL.DataSource = dt
            grdWL.DataBind()
            SetGridStyle(grdWL)
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)

        End Try
        RpWLFilterCondition = ""
    End Sub

    Protected Sub grdWL_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles grdWL.PageIndexChanging
        grdWL.PageIndex = e.NewPageIndex
        GetPageData(e.NewPageIndex, 10)
        SetGridStyle(grdWL)
    End Sub


    Protected Sub txtFWL_TextChanged(sender As Object, e As EventArgs)
        Dim strText As String = "", strName As String = ""
        strText = CType(sender, TextBox).Text.ToString
        strName = CType(sender, TextBox).ID.ToString

        pWLFilterValue = strText
        RpWLFilterCondition = ""


        If strText <> "" Then
            If strName = "doc_date" Or strName = "ref_date" Then
                strText = CDate(strText).ToString("dd/MM/yyyy")
                RpWLFilterCondition = " format(" & strName & ") = format('" & strText & "','DD/MM/YYYY')"
            Else
                strText = "N'%" & strText.ToUpper & "%'"
                RpWLFilterCondition = " upper(" & strName & ") Like " & strText
            End If
        End If

        GetPageData(0, 10)
        SetGridStyle(grdWL)
    End Sub


    Private Sub grdWL_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles grdWL.RowDataBound
        If IsNothing(RpWLFilterCondition) Then
            RpWLFilterCondition = ""
        End If

        If e.Row.RowType = DataControlRowType.Header Then
            If RpWLFilterCondition.ToLower.ToString.Contains("(ref_id") Then
                CType(e.Row.FindControl("ref_id"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(customer") Then
                CType(e.Row.FindControl("customer"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(contact_no") Then
                CType(e.Row.FindControl("contact_no"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(sec") Then
                CType(e.Row.FindControl("sec"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(inv_bank") Then
                CType(e.Row.FindControl("inv_bank"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(salary_bank") Then
                CType(e.Row.FindControl("salary_bank"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(doc_date") Then
                'CType(e.Row.FindControl("wl_date"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", CDate(Session("pWLFilterValue")).ToString("yyyy-mm-dd"))
                CType(e.Row.FindControl("doc_date"), TextBox).Text = CDate(Session("pWLFilterValue")).ToString("yyyy-MM-dd")
            End If

            If RpWLFilterCondition.ToLower.ToString.Contains("(emp_name") Then
                CType(e.Row.FindControl("emp_name"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If RpWLFilterCondition.ToLower.ToString.Contains("(status") Then
                CType(e.Row.FindControl("status"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If

        End If


        If e.Row.RowType = DataControlRowType.DataRow Then



        End If


        SetGridStyle(grdWL)
    End Sub



    Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O" 'rblWLStatus.SelectedValue.ToString


        Dim sWorklistID As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
        Dim sArgRefID As String = ""
        'sWorklistID = e.CommandArgument 'wl_id
        sWorklistID = e.CommandArgument.ToString.Split(",")(0).ToString
        sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString
        requestId = sArgRefID
        sRefID = ""
        sCurrentProcessCode = ""
        sNextProcessCode = ""
        sPageLink = ""


        'q = "SELECT MODULE_ID,PROCESS_ID,REF_ID,NEXT_PROCESS_ID,PAGELINK FROM APP_WORKLIST WHERE WL_ID='" & sWorklistID & "' AND STATUS='" & wlStatus & "' "


        'Dim dtr = GetTable(q)
        'For Each rdr As DataRow In dtr.Rows
        '    sRefID = rdr("ref_id").ToString
        '    sCurrentProcessCode = rdr("process_id").ToString
        '    sNextProcessCode = rdr("next_process_id").ToString
        '    sPageLink = rdr("pagelink").ToString
        '    sModuleID = rdr("module_id").ToString
        '    Exit For
        'Next

        ' RedirectURL("../pages/ReqDetails.aspx?p1=" & sArgRefID)
        If e.CommandName = "Step" Then
            ucCustomerInfo.DocNo = sArgRefID
            ucApprovals.DocNo = sArgRefID
            ''requestOwner = GetFieldValue("select emp_no from ars_request_hdr where doc_no='" & sArgRefID & "'")
            ''Dim ReqStatus = GetFieldValue("select status from ars_request_hdr where doc_no='" & sArgRefID & "'")
            ''Dim UploadDocStep = GetFieldValue("select WL_ID from APP_WORKLIST where REF_ID='" & sArgRefID & "' AND NEXT_PROCESS_ID='" & AppProcess.ProcUploadDoc.ToString.ToUpper & "' AND STATUS='O'")
            ''If requestOwner = Session("emp_no").ToString And ReqStatus <> "D" And ReqStatus <> "C" And (ReqStatus = "N" Or UploadDocStep <> "") Then
            ''    NotesDiv.Visible = True
            ''Else
            ''    NotesDiv.Visible = False
            ''End If
            NotesDiv.Visible = True
            OpenModal(Me.Page, "myModal")
            '  OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)
        ElseIf e.CommandName = "Detail" Then

            OpenWorklistPage(Me.Page, sArgRefID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, "../pages/ReqDetails.aspx?p1=" & sArgRefID)


            'If sPageLink <> "" Then
            '    ' sPageLink = "../../../" & sModuleID & "/" & Session("Language") & "/" & Replace(sPageLink, "../", "") 'format for the new system
            '    sPageLink = "../../../" & Replace(sPageLink, "../", "") 'format for the new system

            '    If Not sPageLink.ToUpper.Contains(".ASPX") Then
            '        ' clsGenClass.OpenTab(Me.Page, sPageLink & "&ViewMode=" & rblWLStatus.SelectedValue.ToString)
            '        'tkID = clsGenClass.InsertToken("N")
            '        'clsGenClass.OpenTab(Me.Page, sModuleLink & "default.aspx?token=" & tkID.ToString & "&div=" & Session("CompCode") & "&lnk=" & Server.UrlEncode(Replace(sPageLink, "..", Session("Language").ToString) & "&ViewMode=" & rblWLStatus.SelectedValue.ToString))
            '        OpenWorklistPage(Me.Page, sWorklistID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, sPageLink)
            '    Else
            '        OpenTab(Me.Page, sPageLink & "&ViewMode=" & wlStatus, sWorklistID)
            '    End If
            'End If
        ElseIf e.CommandName = "addpending" Then
            ' AddtoPending(e.CommandArgument)
            'AddtoPending(e.CommandArgument.ToString.Split(",")(0).ToString)
            'GetPageData(0, 10)
        End If
        SetGridStyle(grdWL)
    End Sub

    Protected Sub ddlStep_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub btnAddRemarks_Click(sender As Object, e As EventArgs)
        If txtRemarks.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل ملاحظة اكمال المستندات")
            Exit Sub
        End If

        Dim cn As New SqlConnection
        Dim cmd As New SqlCommand
        Dim trans As SqlTransaction

        cn = OpenConnection()
        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        cmd.Connection = cn
        cmd.Transaction = trans

        SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Try

            Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
            AppWl.WL03ProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
            AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
            AppWl.WL05RefID = requestId
            ' AppWl.WL99RefWLID = ViewState("p1")
            AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
            AppWl.WL121ClosedRemarks = txtRemarks.Text.ToString
            AppWl.WL11ClosedDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
            AppWl.WL12ClosedBy = Session("user_id").ToString

            AppWl.WL07Priority = "N"
            AppWl.WL08CompCode = AppWl.WL08CompCode
            AppWl.WL09SysUserID = AppWl.WL09SysUserID
            AppWl.WL13Status = "C"

            AppWl.WL14NextProcessCode = AppProcess.ProcRemarks.ToString.ToUpper
            AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
            AppWl.WL16RefStationID = ""
            AppWl.WL17RefTask = ""
            AppWl.WL18RefOther = "R"
            AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper


            ' AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
            AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
            AppWl.WL98OnlyOwner = Session("emp_no").ToString

            'AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
            'AppWl.WL98OnlyOwner = ddlEmployee.SelectedValue.ToString
            AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
            AppWl.WL99ModuleID = "R"
            AppWl.WL99ApprLevel = "0"
            InsertRemarks(cn, cmd, AppWl)
            'InsertNewRemarks(cn, cmd, AppWl)
            'InsertWorklist(cn, cmd, AppWl)

            trans.Commit()
            saveFlag = True
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
            trans.Rollback()

        Finally
            cmd.Dispose()
            trans.Dispose()
            cn.Close()
            cn.Dispose()
        End Try
        If saveFlag = True Then
            txtRemarks.Text = ""
            CloseModal(Me.Page, "myModal")
            '  RedirectURL("../pages/Worklist.aspx")
            ' ucApprovals.DocNo = requestId
        End If
        GetPageData(0, 0)
    End Sub

    Protected Sub ddlCompPay_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub ddlCustomService_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub
End Class

Contents of ucUploadFiles.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucUploadFiles.ascx.vb" Inherits="EnjazVB.ucUploadFiles" %>
<asp:UpdatePanel ID="UpdatePanelUp" UpdateMode="Conditional" runat="server">
    <ContentTemplate>
        <div class="form-horizontal">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h4 id="hTitle" class="panel-title" runat="server"></h4>
                </div>
                <div class="panel-body">
                    <div class="form-group">
                        <div class="col-md-12">
                            <asp:TextBox ID="txtDesc" runat="server" placeholder="Enter upload description ..." CssClass="form-control" meta:resourcekey="txtDescResource1"></asp:TextBox>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-12">
                            <div class="input-group">
                                <asp:FileUpload ID="up" runat="server"  AllowMultiple="True" CssClass="btn btn-default btn-md" Width="100%" meta:resourcekey="upResource1" />
                                <span class="input-group-btn">
                                    <asp:LinkButton ID="btnUpload" OnClick="btnUpload_Click" Text=" 
                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-upload&quot;&gt;&lt;/i&gt; Upload
                                    " runat="server"
                                        CausesValidation="False" CssClass="btn btn-primary btn-md" meta:resourcekey="btnUploadResource1"></asp:LinkButton>                                    
                                </span>
                            </div>
                            <!-- /input-group -->
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </ContentTemplate>
    <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload"  />
     <%--   <asp:AsyncPostBackTrigger ControlID ="btnUpload" EventName="Click" />--%>
    </Triggers>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress2" AssociatedUpdatePanelID="UpdatePanelUp" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>

Contents of ucUploadFiles.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucUploadFiles
    
    '''<summary>
    '''UpdatePanelUp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanelUp As Global.System.Web.UI.UpdatePanel
    
    '''<summary>
    '''hTitle control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents hTitle As Global.System.Web.UI.HtmlControls.HtmlGenericControl
    
    '''<summary>
    '''txtDesc control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDesc As Global.System.Web.UI.WebControls.TextBox
    
    '''<summary>
    '''up control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents up As Global.System.Web.UI.WebControls.FileUpload
    
    '''<summary>
    '''btnUpload control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnUpload As Global.System.Web.UI.WebControls.LinkButton
    
    '''<summary>
    '''UpdateProgress2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress2 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucUploadFiles.ascx.vb:

Imports Oracle.ManagedDataAccess.Client
Imports WebClass.Sys.Classes
Imports WebClass.Sys.webclass.mainclass
Imports WebClass.Sys.Classes.clsGlobarVar
Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar

Public Class ucUploadFiles
    Inherits System.Web.UI.UserControl

    Public Property Title As String
        Get
            Return hTitle.InnerText
        End Get
        Set(value As String)
            hTitle.InnerText = value
        End Set
    End Property

    Public Property DocNo As String
        Get
            Return ViewState("DocNo")
        End Get
        Set(value As String)
            ViewState("DocNo") = value
        End Set
    End Property

    Public Property DocType As String
        Get
            Return ViewState("DocType")
        End Get
        Set(value As String)
            ViewState("DocType") = value
        End Set
    End Property

    Public Property TotalUploaded As String
        Get
            Return ViewState("TotalUploaded")
        End Get
        Set(value As String)
            ViewState("TotalUploaded") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Me.Visible Then
            If Not IsPostBack Then
                If Request.QueryString("docno") IsNot Nothing Then
                    DocNo = Request.QueryString("docno")
                End If

                If Request.QueryString("doctype") IsNot Nothing Then
                    DocType = Request.QueryString("doctype")
                End If

                If Request.QueryString("docdesc") IsNot Nothing Then
                    txtDesc.Text = Request.QueryString("docdesc")
                End If
            End If
        End If
    End Sub

    Protected Sub btnUpload_Click(sender As Object, e As EventArgs)


        Dim g As String = ""
        Dim UpOK As Boolean = False
        Dim NewFile As String = ""
        Dim imgPath As String = ""

        Dim imgSize As Integer = 0

        Dim i As Integer = 0

        Dim cn As New SqlConnection
        Dim cmd As New SqlCommand
        Dim trans As SqlTransaction

        cn = OpenConnection()
        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        cmd.Connection = cn
        cmd.Transaction = trans
        Try
            SetDateSession(cn, cmd)

            If DocType = "DCOTHERS" Then
            Else
                If GetFieldValue(cn, cmd, "select doc_no from app_upload_mst where doc_no='" & DocNo & "' and doc_type='" & DocType & "'") <> "" Then
                    Throw New Exception("هذا الملف مرفق مسبقا!")
                End If
            End If

            If up.HasFiles Then

                For Each postedFile As HttpPostedFile In up.PostedFiles

                    imgSize = up.PostedFile.ContentLength
                    g = Guid.NewGuid().ToString
                    NewFile = g & Mid(up.FileName, up.FileName.LastIndexOf(".") + 1, 4)

                    If postedFile.ContentLength > 4000000 Then
                        Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "Alert", "alert('File is too big.')", True)
                    Else
                        postedFile.SaveAs(Server.MapPath("~/ImageStorage/" & NewFile))
                    End If

                    Dim q As String = ""


                    q = " insert into app_upload_mst (doc_type, "
                    q = q & "                         doc_no, "
                    q = q & "                         sr_no, "
                    q = q & "                         doc_desc, "
                    q = q & "                         filename, sys_date, sys_userid) "
                    q = q & "   values   ('" & DocType & "', "
                    q = q & "             '" & DocNo & "', "
                    q = q & "             (select isnull(max(sr_no),0) + 1 from APP_UPLOAD_MST where doc_no='" & DocNo & "'), "
                    q = q & "             N'" & txtDesc.Text & "', "
                    q = q & "             '" & NewFile & "', EnjazVB.GetServerDate(),'" & Session("user_id") & "') "

                    cmd.CommandText = q
                    cmd.ExecuteNonQuery()
                    i = i + 1

                Next
            Else
                ShowPopUpMsg(Me.Page, "Please try again")
            End If

            trans.Commit()

        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
            trans.Rollback()

        Finally
            cmd.Dispose()
            trans.Dispose()
            cn.Close()
            cn.Dispose()
        End Try


        TotalUploaded = i
        txtDesc.Text = ""
        ClosePage(Me.Page)


        'Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "Alert", "alert('Upload saved!')", True)
    End Sub
End Class

Contents of ucUserCreateRequest.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucUserCreateRequest.ascx.vb" Inherits="EnjazVB.ucUserCreateRequest" %>
<%@ Register Src="~/Controls/ucPrivacyPolicy.ascx" TagPrefix="uc1" TagName="ucPrivacyPolicy" %>
<head id="Head1" >
    <script src="/cdn/Scripts/jquery-2.1.4.min.js"></script>
    <script src="/cdn/Scripts/jquery-ui-1.11.4.min.js"></script>
    <script src="/cdn/Select2/js/select2.min.js"></script>
    </head>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <%-- <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>--%>
    <ContentTemplate>

       
         <div  class="col-sm-12">
                               
                             
                                       <div id="divULink" visible="false" runat="server" class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="Label1" runat="server" Text="الرابط الخاص بك " Font-Bold="True"></asp:Label><span>
                                            <asp:TextBox ID="txtULink"  ReadOnly="true" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    </div>

                                 <div  class="form-group" >
                                      <div class="col-sm-12">
                                         <div class="row justify-content-center">
                                     <div class="col-sm-1">
                                         </div>
                              <div class="col-sm-4">
                                                <asp:Label ID="Label2" runat="server" Text="الخدمة المطلوبة" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlService" AutoPostBack="true" OnSelectedIndexChanged="ddlService_SelectedIndexChanged" runat="server" CssClass="form-control" Width="100%">
                                                <asp:ListItem Value="F" Text="تمويل" Selected="True"></asp:ListItem>
                                             <asp:ListItem Value="M" Text="فك رهن واعادة تمويل" ></asp:ListItem>
                                            </asp:DropDownList>
                                       </div>

                                      <div class="col-sm-2">
                                         </div>

                                      <div class="col-sm-4">
                                <asp:Label ID="LabelRequestedBy" runat="server" Text="الاسم" Font-Bold="True"></asp:Label><span>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtname" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtname" placeholder="فضلا ادخل الاسم" CssClass="form-control" runat="server"></asp:TextBox>
                                         </div>
                                      <div class="col-sm-1">
                                         </div>
</div>
</div>
                                    </div>
                                    
                                       <div runat="server" id="divRealValue" visible="false" class="row justify-content-center">
                                       <div class="col-sm-1">
                                           </div>
                                           <div class="col-sm-4">
                                            <asp:Label ID="lbl" runat="server" Text="قيمة العقار السوقية" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtRealValue" TextMode="Number" placeholder="فضلا ادخل القيمة السوقية" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                           <div class="col-sm-2">
                                           </div>
                                           <div  runat="server" id="divMortegage" class="col-sm-4">
                                                                         <asp:Label ID="Label6" runat="server" Text="مبلغ الرهن" Font-Bold="True"></asp:Label>
                                            <asp:TextBox ID="txtMortegage"  TextMode="Number"  placeholder="فضلا ادخل قيمة الرهن" CssClass="form-control" runat="server"></asp:TextBox>
                                           </div>
                                           <div class="col-sm-1">
                                           </div>
                                    </div>

                               


                                    
                                    <div class="row justify-content-center">
                                          <div class="col-sm-1">
                                              </div>
                                        <div class="col-sm-4">
                                            <asp:Label ID="LabelRequestID" runat="server" Text="رقم الجوال" Font-Bold="True"></asp:Label><span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtPhone" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <span>
                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                                                    ControlToValidate="txtPhone" ErrorMessage="تحقق من رقم الجوال" ForeColor="Red"
                                                    ValidationExpression="[0-9]{10}"></asp:RegularExpressionValidator>
                                            </span>
                                            <asp:TextBox ID="txtPhone" TextMode="Number" MaxLength="10" placeholder="05 فضلا رقم الجوال" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                    
                                     <div class="col-sm-2">
                                              </div>
                                         <div class="col-sm-4">
                                                                     <asp:Label ID="Label3" runat="server" Text="جهة العمل" Font-Bold="True"></asp:Label><span><asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="ddlWorkPlace"
                                                ErrorMessage="*" ForeColor="Red" InitialValue=""></asp:RequiredFieldValidator></span>
                                            <asp:DropDownList ID="ddlWorkPlace" runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>
 
                                         </div>
                                         <div class="col-sm-1">
                                              </div>
                                    </div>

                                    

                                    <div class="row justify-content-center">
                                           <div class="col-sm-1">
                                               </div>
                                        <div class="col-sm-4">
                                            <asp:Label ID="LabelRequestedDate" runat="server" Text="الراتب" Font-Bold="True"></asp:Label>
                                            <span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="txtsalary" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtsalary" TextMode="Number" placeholder="فضلا ادخل الراتب" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                         <div class="col-sm-2">
                                               </div>

                                         <div class="col-sm-4">
                                                <asp:Label ID="Label4" runat="server" Text="بنك ايداع الراتب" Font-Bold="True"></asp:Label><span><asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="ddlBank"
                                                ErrorMessage="*" ForeColor="Red" InitialValue=""></asp:RequiredFieldValidator></span>
                                            <asp:DropDownList ID="ddlBank" runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>
 </div>
                                         <div class="col-sm-1">
                                               </div>
                                    </div>

                                   

                                    <div class="row justify-content-center">
                                        <div class="col-sm-1">
                                            </div>
                                        <div class="col-sm-4">
                                            <asp:Label ID="Label5" runat="server" Text="العمر" Font-Bold="True"></asp:Label><span>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" ControlToValidate="txtAge" ForeColor="Red" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator></span>
                                            <asp:TextBox ID="txtAge" TextMode="Number" placeholder="فضلا ادخل العمر" CssClass="form-control" runat="server"></asp:TextBox>
                                        </div>
                                         <div class="col-sm-2">
                                            </div>
                                         <div runat="server"  id="divCustomEstateValue" class="col-sm-4">
                                                      <asp:Label ID="lblEstateValue" runat="server" Text="قيمة العقار ان وجد" Font-Bold="True"></asp:Label>
                                             <asp:TextBox ID="txtCusEstateValue" Text="0" TextMode="Number" placeholder="ادخل قيمة العقار ان وجد" CssClass="form-control" runat="server"></asp:TextBox>
                                     
                                            </div>
                                         <div class="col-sm-1">
                                            </div>
                                    </div>

               <div class="row justify-content-center">
                                        <div class="col-sm-1">
                                            </div>
                                        <div class="col-sm-4">
                                            <asp:CheckBox runat="server" ID="AgreeChb" Text="الموافقة علي سياسة الخصوصية" />
                                          <asp:LinkButton ValidationGroup="PrivacyGroup" OnClick="btnPolicyDetails_Click" runat="server" Text="Privacy Policy سياسة الخصوصية " ID="btnPolicyDetails"></asp:LinkButton>
                                            </div>
                   </div>
                               
                                      <%--               <div class="form-group">
                                        <div class="col-sm-12">
                                            <asp:Label ID="lblLoans" runat="server" Text="عليك التزامات مالية ؟" Font-Bold="True"></asp:Label>
                                            <asp:DropDownList ID="ddlLoans" runat="server" CssClass="form-control input-sm" Width="100%">
                                                <asp:ListItem Text="نعم" Value="Y" Selected="True"></asp:ListItem>
                                                <asp:ListItem Text="لا" Value="N"></asp:ListItem>
                                            </asp:DropDownList>

                                        </div>
                                    </div>--%>
                                    <br />

                                    <div class="form-group">
                                        <div class="col-sm-12">
                                        </div>
                                    </div>


                                    <div class="row justify-content-center">
                                        <div class="col-sm-2">
                                            </div>
                                        <div class="col-sm-4">
                                            <asp:LinkButton ID="btnSave"  runat="server" CssClass="btn" OnClick="btnSave_Click"
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;bi bi bi-save&quot;&gt;&lt;/i&gt;&nbsp;&nbsp; حفظ
                                                        "></asp:LinkButton>
                                          
                                           <%--   <asp:LinkButton ID="btnCopy"  onclick="CopyToClipboard();"  style="background:#C5B358;border-color:#BF953F;"  runat="server" CssClass="btn btn-primary btn-md" 
                                                Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; حفظ
                                                        "></asp:LinkButton>--%>

                                    
                                        </div>


                                    </div>

                                
                               
                                      </div>

        
  
  </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>

<div id="myModal" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <asp:Button ValidationGroup="closepop" ID="btcloseUp" OnClick="btcloseUp_Click" runat="server" Text="إغلاق" ></asp:Button>
                        <h4 id="t4" class="modal-title" runat="server">
                            <asp:Localize ID="Localize3" runat="server" meta:resourcekey="Localize3Resource1" Text="سياسية الخصوصية"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                         <div class="form-group">
                             <div class="col-sm-12">
                        <uc1:ucPrivacyPolicy runat="server" id="ucPrivacyPolicy" />
                       </div>
                             </div>
                       
                    </div>
                    <div class="modal-footer">
                                  <asp:Button ValidationGroup="closepop" ID="btnClosepop" OnClick="btcloseUp_Click" runat="server" Text="إغلاق" ></asp:Button>
                    </div>

                </div>
            </div>
        </div>


<script>
function ShowMessage()
{
      alert('تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة');
    window.location.href ='~/pages/HomePage.aspx';
}
</script>

Contents of ucUserCreateRequest.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucUserCreateRequest

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''divULink control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divULink As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtULink control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtULink As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlService control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlService As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''LabelRequestedBy control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestedBy As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator1 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtname control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtname As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divRealValue As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lbl control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lbl As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtRealValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtRealValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divMortegage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divMortegage As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Label6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label6 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtMortegage control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtMortegage As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''LabelRequestID control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestID As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator2 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''RegularExpressionValidator1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RegularExpressionValidator1 As Global.System.Web.UI.WebControls.RegularExpressionValidator

    '''<summary>
    '''txtPhone control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtPhone As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator6 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator6 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''ddlWorkPlace control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlWorkPlace As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''LabelRequestedDate control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelRequestedDate As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator3 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtsalary control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtsalary As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator5 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''ddlBank control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlBank As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label5 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label5 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''RequiredFieldValidator4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents RequiredFieldValidator4 As Global.System.Web.UI.WebControls.RequiredFieldValidator

    '''<summary>
    '''txtAge control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtAge As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''divCustomEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents divCustomEstateValue As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''lblEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblEstateValue As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtCusEstateValue control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtCusEstateValue As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''AgreeChb control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents AgreeChb As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''btnPolicyDetails control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnPolicyDetails As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress

    '''<summary>
    '''btcloseUp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btcloseUp As Global.System.Web.UI.WebControls.Button

    '''<summary>
    '''t4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents t4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize3 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''ucPrivacyPolicy control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucPrivacyPolicy As Global.EnjazVB.ucPrivacyPolicy

    '''<summary>
    '''btnClosepop control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnClosepop As Global.System.Web.UI.WebControls.Button
End Class

Contents of ucUserCreateRequest.ascx.vb:

Imports Oracle.ManagedDataAccess.Client
Imports WebClass.Sys.Classes
Imports WebClass.Sys.webclass.mainclass
Imports WebClass.Sys.Classes.clsGlobarVar
Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Public Class ucUserCreateRequest
    Inherits System.Web.UI.UserControl
    Dim q As String = ""

    Public Property DocNo As String
        Get
            Return ViewState("DocNo")
        End Get
        Set(value As String)
            ViewState("DocNo") = value
        End Set
    End Property

    Public Property Source As String
        Get
            Return ViewState("Source")
        End Get
        Set(value As String)
            ViewState("Source") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If

        If Not IsPostBack Then

            If Not IsNothing(Session("emp_no")) Then
                ' lblLoans.Text = "عليه التزامات مالية ؟"
                LabelRequestedBy.Text = "اسم العميل"
                '  divHeader.Style.Remove("style")
                ' divHeader.Style.Remove("background")
                'btnSave.Style.Remove("background")
                'btnSave.Style.Remove("border-color")
                divULink.Visible = True
                txtULink.Text = "http://enjazaqar.com/pages/CreateRequest.aspx?P1=" & Session("emp_no").ToString & "&P2=x1@2"
            End If
            If Not (Request.QueryString("P1")) Is Nothing Then
                ViewState("P1") = Request.QueryString("P1").ToString
            End If

            If Not (Request.QueryString("P3")) Is Nothing Then
                Source = Request.QueryString("P3").ToString
            Else
                Source = ""
            End If

            q = "select type_category,type_Desc from type_mst where type_Code='BK' AND TYPE_ABBR='Y'"
            FillComboSelect(ddlBank, q)
            q = "select type_category,type_Desc from type_mst where type_Code='WE' ORDER BY  TYPE_ABBR "
            FillComboSelect(ddlWorkPlace, q)


        End If
    End Sub

    Protected Sub btTest_Click(sender As Object, e As EventArgs)
        ' ShowPopUpMsg(Me.Page, GetFieldValue("select ref_id from app_worklist"))
        ' Dim currentDate As String = "13/09/2020"
        ' Dim convertedDate As DateTime = DateTime.ParseExact(currentDate, "dd/MM/yyyy", CultureInfo.InvariantCulture)

        ' Convert.ToDateTime(currentDate)
        ShowPopUpMsg(Me.Page, CDate(GetServerDate("", "")).ToString("dd/MM/yyyy"))
    End Sub

    Protected Sub btnSave_Click(sender As Object, e As EventArgs)
        Dim CNT = 0
        If txtname.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الاسم")
            Exit Sub
        End If
        If txtname.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الاسم")
            Exit Sub
        End If
        If txtPhone.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الجوال")
            Exit Sub
        End If
        If txtsalary.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل الراتب")
            Exit Sub
        End If
        If txtAge.Text = "" Then
            ShowPopUpMsg(Me.Page, "فضلا ادخل العمر")
            Exit Sub
        End If
        If ddlBank.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا تحقق من البنك")
            Exit Sub
        End If
        If ddlWorkPlace.SelectedValue = "" Then
            ShowPopUpMsg(Me.Page, "فضلا تحقق من جهة العمل")
            Exit Sub
        End If

        If ddlService.SelectedValue = "M" Then
            If txtRealValue.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل القيمة السوقية للعقار")
                Exit Sub
            End If
            If txtMortegage.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل مبلغ الرهن")
                Exit Sub
            End If
        End If
        If ddlService.SelectedValue = "F" Then
            If txtCusEstateValue.Text = "" Then
                ShowPopUpMsg(Me.Page, "فضلا ادخل قيمة العقار ان وجد وان لم يوجد ادخل 0")
                Exit Sub
            End If
        End If
        If AgreeChb.Checked = False Then
            ShowPopUpMsg(Me.Page, "فضلا قم بالموافقة علي سياسة الخصوصية")
            Exit Sub
        End If


        If Not IsNothing(Session("emp_no")) Then
            If GetFieldValue("SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE STATUS='O' AND  LTRIM(RTRIM(CONTACT_NO)) = LTRIM(RTRIM(N'" & txtPhone.Text & "'))  ") <> "" Then
                ShowPopUpMsg(Me.Page, "العميل لديه طلب بالفعل")
                Exit Sub
            End If
        Else

            If GetFieldValue("SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE STATUS='O' AND  LTRIM(RTRIM(CONTACT_NO)) = LTRIM(RTRIM(N'" & txtPhone.Text & "')) AND FORMAT(DOC_DATE,'dd/MM/yyyy')=FORMAT(EnjazVB.GetServerDate(),'dd/MM/yyyy')  ") <> "" Then
                ShowPopUpMsg(Me.Page, "لديك طلب بالفعل الرجاء التواصل معنا")
                Exit Sub
            End If

            CNT = CInt(GetFieldValue("SELECT COUNT(DOC_NO)  FROM ARS_REQUEST_HDR WHERE   LTRIM(RTRIM(CONTACT_NO)) = LTRIM(RTRIM(N'" & txtPhone.Text & "')) AND DATEDIFF(DAY,DOC_DATE,EnjazVB.GetServerDate())>=4  "))
            If CNT > 1 Then
                ShowPopUpMsg(Me.Page, "لديك طلب بالفعل الرجاء التواصل معنا")
                Exit Sub
            End If
        End If









            Dim cn As New SqlConnection
        Dim cmd As New SqlCommand
        Dim trans As SqlTransaction

        cn = OpenConnection()
        trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
        cmd.Connection = cn
        cmd.Transaction = trans

        SetDateSession(cn, cmd)
        Dim saveFlag As Boolean = False
        Try
            If GetFieldValue(cn, cmd, "SELECT DOC_NO FROM ARS_REQUEST_HDR WHERE LTRIM(RTRIM(CONTACT_NO))= LTRIM(RTRIM(N'" & txtPhone.Text & "'))  AND STATUS='O' AND FORMAT(DOC_DATE,'dd/MM/yyyy')=FORMAT(EnjazVB.GetServerDate(),'dd/MM/yyyy')  ") = "" Then

                btnSave.Enabled = False
                DocNo = GetSeries(cn, cmd, "R")
                ViewState("ServerDate") = GetServerDate(cn, cmd)
                q = ""
                q = ""
                q = q & " INSERT INTO ars_request_hdr  "
                q = q & " ( "
                q = q & "      tran_type, "
                q = q & "      doc_no, "
                q = q & "      doc_date, "
                q = q & "      REQ_DATE ,"
                q = q & "      yr ,"
                q = q & "      emp_no, "
                q = q & "      br_assign, "
                q = q & "      dept_head, "
                q = q & "      CUST_ID, "
                q = q & "      req_action, "
                q = q & "      req_by, "
                q = q & "      trs_from, "
                q = q & "      trs_to, "
                q = q & "      status, "
                q = q & "      subject, "
                q = q & "      sys_userid, "
                q = q & "      comp_code, "
                q = q & "      refcomp_code, "
                q = q & "      contact_no, "

                q = q & "      other1, "  'bank
                q = q & "      other2, " 'salary
                q = q & "      other3, "  'workplace 
                'q = q & "      other8, "
                q = q & "      SERVICE, "
                If ddlService.SelectedValue.ToString = "M" Then
                    q = q & "      M_REAL_VALUE, "
                    q = q & "      MORTEGAGE_VALUE, "
                End If
                q = q & "     CusEstateValue,"
                q = q & "      ref_docno,DUP "
                q = q & " ) "
                q = q & " VALUES ("
                q = q & "      'R',"
                'q = q & "      '" & DocNo & "',"
                q = q & "      @doc_no,"
                q = q & "      FORMAT(convert(date,'" & CDate(ViewState("ServerDate")) & "'),'dd/MM/yyyy') , "
                q = q & "      '" & CDate(ViewState("ServerDate")).ToString("dd/MM/yyyy") & "' , "
                q = q & "      '" & CInt(CDate(ViewState("ServerDate")).ToString("yyyy")) & "' , "
                If Not IsNothing(Session("emp_no")) Then
                    q = q & "      '" & Session("emp_no").ToString & "',"
                Else
                    If Not IsNothing(ViewState("P1")) Then
                        q = q & "      '" & ViewState("P1").ToString & "',"
                    Else
                        q = q & "      '',"
                    End If


                End If

                If Not IsNothing(Session("emp_no")) Then
                    q = q & "      'EMP',"
                Else
                    If Source = "" Then
                        q = q & "      'CUS',"
                    Else
                        q = q & "      '" & Source & "',"
                    End If
                End If

                If Not IsNothing(Session("emp_no")) Then
                    q = q & "      '" & GetFieldValue("select sup from emp_mst where emp_no='" & Session("emp_no").ToString & "'") & "',"
                Else
                    q = q & "      '',"
                End If


                q = q & "      '',"
                q = q & "      '1',"
                q = q & "      N'" & txtname.Text & "',"
                q = q & "      N'" & txtAge.Text & "'," 'trs_from --age
                q = q & "      ''," 'trs_to
                q = q & "      'O',"
                q = q & "      '',"
                q = q & "      '',"
                q = q & "      '',"
                q = q & "      '',"
                q = q & "       N'" & txtPhone.Text & "', "
                q = q & "      '" & ddlBank.SelectedValue.ToString & "', "
                q = q & "      N'" & txtsalary.Text & "', "
                q = q & "      '" & ddlWorkPlace.Text.ToString & "', "
                'q = q & "      '" & ddlLoans.SelectedValue.ToString & "', " 'Quotation or Cash
                q = q & "      '" & ddlService.SelectedValue.ToString & "', "
                If ddlService.SelectedValue.ToString = "M" Then
                    q = q & "       N'" & txtRealValue.Text & "', "
                    q = q & "      N'" & txtMortegage.Text & "', "
                End If
                q = q & "      N'" & txtCusEstateValue.Text & "', "
                q = q & "      '','" & IIf(CNT > 0, "Y", "N") & "' "
                q = q & "      ) "
                cmd.CommandText = q
                If q.ToString.ToUpper.Contains("DELETE") Or q.ToString.ToUpper.Contains("UPDATE") Or q.ToString.ToUpper.Contains("DROP") Then
                    Throw New Exception("try again !")
                End If
                cmd.Parameters.AddWithValue("@doc_no", DocNo)
                cmd.ExecuteNonQuery()

                Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                AppWl.WL03ProcessCode = AppProcess.ProcCreate.ToString.ToUpper
                AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                AppWl.WL05RefID = DocNo
                ' AppWl.WL99RefWLID = ViewState("p1")
                AppWl.WL06RefDate = CDate(ViewState("ServerDate")).ToString("dd/MM/yyyy")
                AppWl.WL07Priority = "N"
                AppWl.WL08CompCode = AppWl.WL08CompCode
                AppWl.WL09SysUserID = AppWl.WL09SysUserID
                AppWl.WL13Status = "O"
                If Not IsNothing(Session("emp_no")) Or Not IsNothing(ViewState("P1")) Then
                    AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper
                Else
                    AppWl.WL14NextProcessCode = AppProcess.ProcAssign.ToString.ToUpper
                End If

                AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                AppWl.WL16RefStationID = ""
                AppWl.WL17RefTask = ""
                AppWl.WL18RefOther = "R"
                AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                If Not IsNothing(Session("emp_no")) Or Not IsNothing(ViewState("P1")) Then
                    AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                    If Not IsNothing(Session("emp_no")) Then
                        AppWl.WL98OnlyOwner = Session("emp_no").ToString
                    Else
                        AppWl.WL98OnlyOwner = ViewState("P1").ToString
                    End If

                    AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                Else
                    AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.ProcDefinedOwner
                    AppWl.WL99PageLink = "../Pages/CheckRequests.aspx"
                End If

                AppWl.WL99ModuleID = "R"
                AppWl.WL99ApprLevel = "0"
                InsertWorklist(cn, cmd, AppWl)




                trans.Commit()
                saveFlag = True
            End If
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.ToString)
            trans.Rollback()

        Finally
            cmd.Dispose()
            trans.Dispose()
            cn.Close()
            cn.Dispose()
        End Try
        If saveFlag = True Then

            If Not IsNothing(Session("emp_no")) Then
                ShowPopUpMsg(Me.Page, "تم رفع الطلب بنجاح ")
                clear()
                ' RedirectURL("~/pages/Worklist.aspx")
            Else
                ' ShowPopUpMsg(Me.Page, "تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة")
                'Response.Write("<script language='javascript'>window.alert('تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة');window.location='~/pages/MainPage.aspx';</script>")
                ' RedirectURL("~/pages/MainPage.aspx")
                '  Windows.location.href = "~/pages/MainPage.aspx"

                'ScriptManager.RegisterStartupScript(Me, Me.GetType(), "key", "ShowMessage()", True)
                clear()
                Dim message As String = "تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة"

                ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType(), "Alert", "<script type = 'text/javascript'>window.onload=new function(){setTimeout(""alert('" + message + "');window.location='/../pages/HomePage.aspx';"", 1000)};</script>", False)
                ' ScriptManager.RegisterClientScriptBlock(_page, _page.GetType(), "ModalScript", sb.ToString(), False)


                ' ShowPopUpMsg(Me.Page, "تم رفع طلبك بنجاح وسيتم التواصل معك خلال 24 ساعة")
                ' Threading.sleep()
                'Dim meta As New HtmlMeta()
                'meta.HttpEquiv = "Refresh"
                'meta.Content = "3;url=~/pages/MainPage.aspx"
                'Me.Page.Controls.Add(meta)
                'Label1.Text = "You will now be redirected in 5 seconds"


                'Page.ClientScript.RegisterStartupScript(Me.Page, Me.Page.GetType(), "Redirect", script, True)
                'Page.ClientScript.RegisterStartupScript(Me.[GetType](), "Redirect", script, True)

                ''''''ScriptManager.RegisterStartupScript(_Page.Page, _Page.GetType(), "showalert", sb.ToString(), True)
            End If

        End If

    End Sub

    Public Sub clear()
        txtname.Text = ""
        txtPhone.Text = ""
        txtsalary.Text = ""
        txtAge.Text = ""
        txtRealValue.Text = ""
        txtMortegage.Text = ""
        ddlService.SelectedIndex = -1
        ddlBank.SelectedIndex = -1
        ddlWorkPlace.SelectedIndex = -1
    End Sub

    Protected Sub btnCopy_Click(sender As Object, e As EventArgs)
        ' Clipboard.SetText("")
        ' My.Computer.Clipboard.SetText("This is a test string.")
        ' Clipboard.SetText("")
    End Sub

    Protected Sub ddlService_SelectedIndexChanged(sender As Object, e As EventArgs)
        If ddlService.SelectedValue = "F" Then
            divRealValue.Visible = False
            divMortegage.Visible = False
            divCustomEstateValue.Visible = True
        Else
            divRealValue.Visible = True
            divMortegage.Visible = True
            txtCusEstateValue.Text = "0"
            divCustomEstateValue.Visible = False
        End If
    End Sub

    Protected Sub btnPolicyDetails_Click(sender As Object, e As EventArgs)
        OpenModal(Me.Page, "myModal")

    End Sub



    Protected Sub btcloseUp_Click(sender As Object, e As EventArgs)
        CloseModal(Me.Page, "myModal")
    End Sub
End Class

Contents of ucWorklist.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucWorklist.ascx.vb" Inherits="EnjazVB.ucWorklist" %>
<div class="panel-body">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>  
                              
                <div class="form-horizontal">
                          <div class="form-group">
                        <div style="overflow: auto;">
                            <div style="direction:rtl;" class="table-responsive">
                                <asp:GridView ID="grdWL"   CssClass="table table-hover table-striped" runat="server" AllowPaging="True" AllowCustomPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" EmptyDataText="No records" GridLines="None" Width="100%" ForeColor="#333333" Style="margin: 0 auto; overflow: auto; width: 100%" meta:resourcekey="grdWLResource1">
                                    <AlternatingRowStyle BackColor="White" />
                                    <SortedAscendingHeaderStyle CssClass="sortdesc" BackColor="#6D95E1" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource1">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnRefresh" runat="server" CssClass="btn btn-primary btn-sm pull-right"  ToolTip="Refresh" meta:resourcekey="btnRefreshResource1" Text="
                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-refresh&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblSrNo" runat="server" Text='<%# Eval("srno") %>' meta:resourcekey="lblSrNoResource1"></asp:Label>
                                                <asp:HiddenField ID="hwl_days" runat="server" Value='<%# Eval("wl_days") %>' />
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>  
                                        

                                         <asp:TemplateField   HeaderText="اسناد الطلب" > 
                                                      <HeaderTemplate>
                                                            <asp:LinkButton ID="lblSEND" runat="server" Text="اسناد الطلب"  CssClass="control-label" Style="color: white;" OnCommand="btnSend_Command"  ></asp:LinkButton>
                                                            </HeaderTemplate>
                                                        <ItemTemplate>
                                                            <asp:CheckBox ID="chk" Enabled='<%# IIf(Eval("NEXT_PROCESS_ID").ToString.Equals("PROCASSIGN") Or Eval("NEXT_PROCESS_ID").ToString.Equals("PROCCHECK"), True, False) %>' runat="server"   />
                                                        </ItemTemplate>
                                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                    </asp:TemplateField>


                                        <asp:TemplateField HeaderText="الاجراء الحالي" SortExpression="NEXT_PROCESS_DESC" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWNextProcess" runat="server" Text="الاجراء الحالي" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="NEXT_PROCESS_DESC" ></asp:LinkButton>
                                                <asp:TextBox ID="NEXT_PROCESS_DESC" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                               <%--  <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>--%>
                                              <asp:LinkButton ID="btnStep" runat="server" OnCommand="btnStep_Command"
                                                     Text='<%# Bind("NEXT_PROCESS_DESC") %>'
                                                    ToolTip="Click to open the details" CommandName="Step" CommandArgument='<%# string.Concat(Eval("wl_id"), ",", Eval("ref_id"))%>'    />
                                           </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

      <%--                                  <asp:TemplateField HeaderText="Description" SortExpression="process_desc" meta:resourcekey="TemplateFieldResource5">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFProcessDesc" runat="server" Text="Description" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="process_desc" meta:resourcekey="lblFProcessDescResource1"></asp:LinkButton>
                                                <asp:TextBox ID="process_desc" AutoPostBack="True" CssClass="form-control input-sm" runat="server" meta:resourcekey="process_descResource2"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblProcDesc" runat="server" Text='<%# Eval("process_desc") %>' meta:resourcekey="lblProcDescResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>

                                        <asp:TemplateField HeaderText="العميل" SortExpression="customer" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFEmpName" runat="server" Text="العميل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="customer" ></asp:LinkButton>
                                                <asp:TextBox ID="customer" AutoPostBack="True" CssClass="form-control input-sm"  runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("customer") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="رقم الجوال" SortExpression="phone" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblPhone" runat="server" Text="رقم الجوال" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="phone" ></asp:LinkButton>
                                                <asp:TextBox ID="phone" AutoPostBack="True" CssClass="form-control input-sm" OnTextChanged="txtFWL_TextChanged" runat="server" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblStnName" runat="server" Text='<%# Eval("phone") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                    <%--    <asp:TemplateField HeaderText="بنك التمويل" SortExpression="priority"  >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFPriority" runat="server" Text="بنك التمويل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="priority" ></asp:LinkButton>
                                                <asp:TextBox ID="priority" AutoPostBack="True" CssClass="form-control input-sm" runat="server" meta:resourcekey="priorityResource1"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblPriority" runat="server" Text='<%# Eval("priority") %>' meta:resourcekey="lblPriorityResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>--%>

                                              <asp:TemplateField HeaderText="بنك الراتب" SortExpression="BANK"  >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblBank" runat="server" Text="بنك الراتب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="BANK" ></asp:LinkButton>
                                                <asp:TextBox ID="BANK" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" ></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblBank" runat="server" Text='<%# Eval("BANK") %>' ></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="تسلسل" SortExpression="wl_id" >
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWLID" runat="server" Text="تسلسل" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="wl_id" ></asp:LinkButton>
                                                <asp:TextBox ID="wl_id" AutoPostBack="True" CssClass="form-control input-sm" runat="server" OnTextChanged="txtFWL_TextChanged" meta:resourcekey="wl_idResource1"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblWlID" runat="server" Text='<%# Eval("wl_id") %>' meta:resourcekey="lblWlIDResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="تاريخ الطلب" SortExpression="wl_date" meta:resourcekey="TemplateFieldResource3">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="lblFWDate" runat="server" Text="تاريخ الطلب" CssClass="control-label" Style="color: white;" CommandName="Sort" CommandArgument="wl_date" ></asp:LinkButton>
                                                <asp:TextBox ID="wl_date" AutoPostBack="True" CssClass="form-control input-sm" TextMode="Date" runat="server" OnTextChanged="txtFWL_TextChanged" meta:resourcekey="wl_dateResource1"></asp:TextBox>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="lblDate" runat="server" Text='<%# Eval("wl_date") %>' meta:resourcekey="lblDateResource1"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>

                                         <asp:TemplateField Visible="false" HeaderText="next_process_id" >
                                          <ItemTemplate>
                                                <asp:Label ID="lblnext_process_id" runat="server" Text='<%# Eval("next_process_id") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:BoundField DataField="next_process_id" HeaderText="NextProcessID" Visible="False"  />
                                        <asp:BoundField DataField="process_id" HeaderText="ProcessID" Visible="False"  />

                                        <asp:TemplateField HeaderText="SrNo" meta:resourcekey="TemplateFieldResource13">
                                            <HeaderTemplate>
                                                <asp:LinkButton ID="btnpending" runat="server" CssClass="btn btn-primary btn-sm pull-right" ToolTip="Pending List"  Text="
                                                        &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-right&quot;&gt;&lt;/i&gt;
                                                " ></asp:LinkButton>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:LinkButton ID="btnPending" runat="server"
                                                    ToolTip="Add to Pending" CssClass="btn btn-primary btn-sm pull-right" CommandName="addpending" CommandArgument='<%# Eval("wl_id") %>'  OnClientClick="javascript:return confirm('Are you sure add to pending?');" meta:resourcekey="btnPendingResource2" Text="
                                                    &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-indent-left&quot;&gt;&lt;/i&gt;
                                                "></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <EditRowStyle BackColor="#2461BF" />
                                    <FooterStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle CssClass="HeaderStyle" Font-Bold="True" ForeColor="White" />
                                    <PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
                                    <PagerStyle CssClass="grdpages"  ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                    <SortedDescendingHeaderStyle BackColor="#4870BE" CssClass="sortdesc" />
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                
                    </div>

                  <div id="myModal" class="modal fade">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times; </button>
                        <h4 id="t4" class="modal-title" runat="server">
                            <asp:Localize ID="Localize3" runat="server" meta:resourcekey="Localize3Resource1" Text="تفاصيل الطلب"></asp:Localize></h4>
                    </div>
                    <div class="modal-body">
                     <div class="col-sm-8">
                                                  <asp:Label ID="LabelSUP" runat="server" Text="المشرف" Font-Bold="True" ></asp:Label>
                                               <asp:DropDownList ID="ddlSup"   runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
                                        <%-- <asp:TextBox ID="txtEmployee"   ReadOnly="true"  CssClass="form-control" runat="server" ></asp:TextBox>--%>
                                               </div>
                        <div class="col-sm-4">
                            <br />
                      <asp:LinkButton ID="btnSave" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnSave_Click"
                                                          Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; تحويل
                                                        " ></asp:LinkButton>    
                     </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" meta:resourcekey="btnCloseResource1"><i aria-hidden="true" class="glyphicon glyphicon-remove"></i>Close</button>
                    </div>

                </div>
            </div>
        </div>
                </ContentTemplate>
            </asp:UpdatePanel>
       </div>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
        <div class="progress"></div>
    </ProgressTemplate>
</asp:UpdateProgress>

Contents of ucWorklist.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucWorklist

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''grdWL control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents grdWL As Global.System.Web.UI.WebControls.GridView

    '''<summary>
    '''t4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents t4 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''Localize3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Localize3 As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''LabelSUP control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents LabelSUP As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlSup control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlSup As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''btnSave control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnSave As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucWorklist.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports WebClass.Sys.Classes
Imports EnjazVB.Sys.Classes

Public Class ucWorklist
    Inherits System.Web.UI.UserControl
    Dim sSql As String = ""


    Private Property PendingFlag As String
        Get
            Return Session("PendingFlag")
        End Get
        Set(value As String)
            Session("PendingFlag") = value
        End Set
    End Property

    Private Property pWLFilterCondition As String
        Get
            Return Session("pWLFilterCondition")
        End Get
        Set(value As String)
            Session("pWLFilterCondition") = value
        End Set
    End Property

    Private Property pWLFilterValue As String
        Get
            Return Session("pWLFilterValue")
        End Get
        Set(value As String)
            Session("pWLFilterValue") = value
        End Set
    End Property

    Private Property last_wl_days As Integer
        Get
            Return ViewState("last_wl_days")
        End Get
        Set(value As Integer)
            ViewState("last_wl_days") = value
        End Set
    End Property

    Public Property isSupper As Boolean
        Get
            Return Session("isSupper")
        End Get
        Set(value As Boolean)
            Session("isSupper") = value
        End Set
    End Property


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsNothing(Session("password")) Then
            If Session("password").ToString = "asdf" Then
                RedirectURL("~/pages/UpdatePassword.aspx")
            End If
        End If

        Try


            If Not IsPostBack Then
                isSupper = IIf(Session("supper_user").ToString = "True", True, False)
                ' grdWL.VirtualItemCount = GetOpenWL(Session("EmpNo").ToString, False)
                grdWL.VirtualItemCount = GetOpenWL(Session("emp_no").ToString, False)
                PendingFlag = "N"
                GetPageData(0, 10)
                If isSupper Then
                    grdWL.Columns(1).Visible = True
                    FillComboSelect(ddlSup, "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' AND  is_sup='Y'  ")
                Else
                    If GetFieldValue("SELECT IS_SUP FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "' AND  STATUS_FLAG='A' ") = "Y" Then
                        FillComboSelect(ddlSup, "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' AND SUP='" & Session("emp_no").ToString & "' ")
                        grdWL.Columns(1).Visible = True
                        LabelSUP.Text = "الموظف"
                    Else
                        grdWL.Columns(1).Visible = False
                    End If

                End If

            End If
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)
        End Try
        SetGridStyle(grdWL)
    End Sub

    Private Sub GetPageData(pgIndex As Integer, pgSize As Integer)

        Try
            Dim dt As New DataTable
            If pWLFilterCondition <> "" Then
                sSql = "SELECT WL.*  FROM ("
                sSql = sSql & " SELECT ROW_NUMBER() OVER (ORDER BY  WL_DAYS DESC, CAST(WL_ID AS NUMERIC(38, 10)) DESC) SRNO, A.* FROM VOPENWORKLIST A WHERE 1=1 "
                sSql = sSql & " AND OWNER='" & Session("emp_no").ToString & "' AND PENDING_FLAG='" & PendingFlag & "'"
                sSql = sSql & " AND " & pWLFilterCondition
                sSql = sSql & " ) WL"
                '23/12/2024
                ''  sSql = sSql & "  WHERE SRNO BETWEEN ((" & pgIndex & "*10)+1) AND ((" & pgIndex & "+1)*" & pgSize & ")"
                sSql = sSql & " ORDER BY SRNO"
            Else
                sSql = " SELECT WL.* FROM ("
                sSql = sSql & " SELECT ROW_NUMBER() OVER (ORDER BY  WL_DAYS DESC, CAST(WL_ID AS NUMERIC(38, 10)) DESC) SRNO, A.* FROM VOPENWORKLIST A WHERE 1=1"
                sSql = sSql & " AND OWNER='" & Session("emp_no").ToString & "' AND PENDING_FLAG='" & PendingFlag & "'"
                sSql = sSql & ") WL"
                sSql = sSql & "   "
                '23/12/2024
                'sSql = sSql & " WHERE  SRNO BETWEEN ((" & pgIndex & "*10)+1) AND ((" & pgIndex & "+1)*" & pgSize & ")"
                sSql = sSql & " ORDER BY SRNO"
            End If

            dt = GetTable(sSql)
            '23/12/2024 
            Dim dt2 = GetTableCon(sSql, "Enjazcon")
            dt.Merge(dt2)
            Dim sortedResults = From row In dt.AsEnumerable()
                                Order By CInt(row.Field(Of String)("WL_ID")) Descending

            dt = dt.Clone() ' Clone the structure (columns) of the original table
            ' Import each sorted row into the new DataTable
            Dim rowNumber As Integer = 1
            For Each row In sortedResults
                row("SRNO") = rowNumber
                dt.ImportRow(row)
                rowNumber += 1
            Next
            dt.AcceptChanges()
            ' Define row number range
            If dt.Rows.Count > 0 Then
                Dim startRow As Integer = (pgIndex * 10) + 1
                Dim endRow As Integer = (pgIndex + 1) * pgSize
                ' Filter rows based on row number
                Dim filteredRows = dt.AsEnumerable().Skip(startRow - 1).Take(endRow - startRow + 1)

                ' Create a new DataTable from filtered rows
                dt = filteredRows.CopyToDataTable()
                dt.AcceptChanges()
            End If

            If dt.Rows.Count = 0 Then
                Dim nr As DataRow = dt.NewRow
                'dinesh(17-04-23) add empty values as error rais null values to slect color
                'nr("priority") = ""
                nr("wl_days") = 0
                dt.Rows.Add(nr)
                dt.AcceptChanges()
            End If
            grdWL.DataSource = dt
            grdWL.DataBind()
            SetGridStyle(grdWL)
        Catch ex2 As ArgumentException
            ShowPopUpMsg(Me.Page, ex2.Message)
        Catch ex As Exception
            ShowPopUpMsg(Me.Page, ex.Message)

        End Try
    End Sub

    Protected Sub grdWL_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles grdWL.PageIndexChanging
        grdWL.PageIndex = e.NewPageIndex
        GetPageData(e.NewPageIndex, 10)
        SetGridStyle(grdWL)
    End Sub

    Private Sub grdWL_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles grdWL.RowDataBound
        If IsNothing(pWLFilterCondition) Then
            pWLFilterCondition = ""
        End If

        If e.Row.RowType = DataControlRowType.Header Then
            If pWLFilterCondition.ToLower.ToString.Contains("(next_process_desc") Then
                CType(e.Row.FindControl("next_process_desc"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If pWLFilterCondition.ToLower.ToString.Contains("(process_desc") Then
                CType(e.Row.FindControl("process_desc"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If pWLFilterCondition.ToLower.ToString.Contains("(customer") Then
                CType(e.Row.FindControl("customer"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If pWLFilterCondition.ToLower.ToString.Contains("(phone") Then
                CType(e.Row.FindControl("phone"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If pWLFilterCondition.ToLower.ToString.Contains("(BANK") Then
                CType(e.Row.FindControl("BANK"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If pWLFilterCondition.ToLower.ToString.Contains("(wl_id") Then
                CType(e.Row.FindControl("wl_id"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", Session("pWLFilterValue").ToString)
            End If
            If pWLFilterCondition.ToLower.ToString.Contains("(wl_date") Then
                'CType(e.Row.FindControl("wl_date"), TextBox).Text = IIf(Session("pWLFilterValue") Is Nothing, "", CDate(Session("pWLFilterValue")).ToString("yyyy-mm-dd"))
                CType(e.Row.FindControl("wl_date"), TextBox).Text = CDate(Session("pWLFilterValue")).ToString("yyyy-MM-dd")
            End If
        End If


        If e.Row.RowType = DataControlRowType.DataRow Then

            Dim wl_days As HiddenField = CType(e.Row.FindControl("hwl_days"), HiddenField)
            If wl_days.Value <> "" Then
                If wl_days.Value > 0 Then
                    last_wl_days = wl_days.Value
                    For Each cell As TableCell In e.Row.Cells
                        cell.BackColor = System.Drawing.Color.FromArgb(75, 198, 233) 'light blue
                        'cell.BorderColor = Drawing.Color.FromArgb(190, 190, 190)
                    Next
                End If
            End If

        End If


        SetGridStyle(grdWL)
    End Sub

    Protected Sub OnDataBound(sender As Object, e As EventArgs)
        For i As Integer = grdWL.Rows.Count - 1 To 1 Step -1
            Dim row As GridViewRow = grdWL.Rows(i)
            Dim previousRow As GridViewRow = grdWL.Rows(i - 1)
            For j As Integer = 0 To row.Cells.Count - 1
                If row.Cells(j).Text = previousRow.Cells(j).Text Then
                    If previousRow.Cells(j).RowSpan = 0 Then
                        If row.Cells(j).RowSpan = 0 Then
                            previousRow.Cells(j).RowSpan += 2
                        Else
                            previousRow.Cells(j).RowSpan = row.Cells(j).RowSpan + 1
                        End If
                        row.Cells(j).Visible = False
                    End If
                End If
            Next
        Next
        SetGridStyle(grdWL)
    End Sub



    Protected Sub txtFWL_TextChanged(sender As Object, e As EventArgs)
        Dim strText As String = "", strName As String = ""
        strText = CType(sender, TextBox).Text.ToString
        strName = CType(sender, TextBox).ID.ToString

        pWLFilterValue = strText
        pWLFilterCondition = ""


        If strText <> "" Then
            If strName = "wl_date" Or strName = "ref_date" Then
                strText = CDate(strText).ToString("dd/MM/yyyy")
                pWLFilterCondition = " format(" & strName & ") = format('" & strText & "','DD/MM/YYYY')"
            Else
                strText = "N'%" & strText.ToUpper & "%'"
                pWLFilterCondition = " upper(" & strName & ") Like " & strText
            End If
        End If

        GetPageData(0, 10)
        SetGridStyle(grdWL)
    End Sub



    Protected Sub btnStep_Command(sender As Object, e As CommandEventArgs)
        Dim q As String = ""
        Dim tkID As String = ""
        Dim wlStatus As String = "O" 'rblWLStatus.SelectedValue.ToString
        If e.CommandName = "Step" Then

            Dim sWorklistID As String, sRefID As String, sCurrentProcessCode As String, sNextProcessCode As String, sPageLink As String, sModuleID As String = "", sModuleLink As String = ""
            Dim sArgRefID As String = ""
            'sWorklistID = e.CommandArgument 'wl_id
            sWorklistID = e.CommandArgument.ToString.Split(",")(0).ToString
            sArgRefID = e.CommandArgument.ToString.Split(",")(1).ToString

            sRefID = ""
            sCurrentProcessCode = ""
            sNextProcessCode = ""
            sPageLink = ""


            q = "SELECT MODULE_ID,PROCESS_ID,REF_ID,NEXT_PROCESS_ID,PAGELINK FROM APP_WORKLIST WHERE WL_ID='" & sWorklistID & "' AND STATUS='" & wlStatus & "' "


            Dim dtr = GetTable(q)
            If dtr.Rows.Count = 0 Then
                dtr = GetTableCon(q, "Enjazcon")
            End If
            For Each rdr As DataRow In dtr.Rows
                sRefID = rdr("ref_id").ToString
                sCurrentProcessCode = rdr("process_id").ToString
                sNextProcessCode = rdr("next_process_id").ToString
                sPageLink = rdr("pagelink").ToString
                sModuleID = rdr("module_id").ToString
                Exit For
            Next


            'sModuleLink = clsGenClass.GetModuleLink(sModuleID)
            'sPageLink = sModuleLink & "/" & Session("Language").ToString & Replace(sPageLink, "..", "")

            '''If sWorklistID = "001" Then
            '''    'For Each grv As GridViewRow In grdWL.Rows
            '''    'If CType(grv.FindControl("lblDesc"), Label).Text = "Employee Charged" Then
            '''    'sPageLink = sModuleLink & "/" & Session("Language").ToString & "/Pages/VisaCharge.aspx?p1=" & sNextProcessCode
            '''    sPageLink = "Pages/VisaCharge.aspx?p1=" & sNextProcessCode
            '''    'End If
            '''    'Next
            '''ElseIf sWorklistID = "003" Then
            '''    sPageLink = "Pages/NewEmpConfirmCEO.aspx?p55=" & sNextProcessCode
            '''End If


            ''''If sRefID = "" Then
            '''If sNextProcessCode = "" Then
            '''    clsGenClass.ShowPopUpMsg(Me.Page, "This worklist item is no longer available for processing. Kindly refresh your page to view the latest transactions.")
            '''    Exit Sub
            '''End If

            If sPageLink <> "" Then
                ' sPageLink = "../../../" & sModuleID & "/" & Session("Language") & "/" & Replace(sPageLink, "../", "") 'format for the new system
                sPageLink = "../../../" & Replace(sPageLink, "../", "") 'format for the new system

                If Not sPageLink.ToUpper.Contains(".ASPX") Then
                    ' clsGenClass.OpenTab(Me.Page, sPageLink & "&ViewMode=" & rblWLStatus.SelectedValue.ToString)
                    'tkID = clsGenClass.InsertToken("N")
                    'clsGenClass.OpenTab(Me.Page, sModuleLink & "default.aspx?token=" & tkID.ToString & "&div=" & Session("CompCode") & "&lnk=" & Server.UrlEncode(Replace(sPageLink, "..", Session("Language").ToString) & "&ViewMode=" & rblWLStatus.SelectedValue.ToString))
                    OpenWorklistPage(Me.Page, sWorklistID, sCurrentProcessCode, sNextProcessCode, sRefID, wlStatus, sPageLink)
                Else
                    OpenTab(Me.Page, sPageLink & "&ViewMode=" & wlStatus, sWorklistID)
                End If
            End If
        ElseIf e.CommandName = "addpending" Then
            ' AddtoPending(e.CommandArgument)
            'AddtoPending(e.CommandArgument.ToString.Split(",")(0).ToString)
            'GetPageData(0, 10)
        End If
        SetGridStyle(grdWL)
    End Sub

    Protected Sub btnSend_Command(sender As Object, e As CommandEventArgs)
        Dim count = 0
        For i As Integer = 0 To grdWL.Rows.Count - 1
            Dim r = grdWL.Rows(i)
            If CType(r.FindControl("chk"), CheckBox).Checked Then
                count = count + 1
            End If
        Next
        If count > 0 Then
            OpenModal(Me.Page, "myModal")
        Else
            ShowPopUpMsg(Me.Page, "فضلا اختر طلب واحد علي الاقل")
        End If
    End Sub

    Protected Sub btnSave_Click(sender As Object, e As EventArgs)
        Dim Q = ""

        Dim saveFlag As Boolean = False



        'Dim cn As New SqlConnection
        'Dim cmd As New SqlCommand
        'Dim trans As SqlTransaction


        For i As Integer = 0 To grdWL.Rows.Count - 1
            Dim r = grdWL.Rows(i)
            If CType(r.FindControl("chk"), CheckBox).Checked Then

                Dim wlid = CType(r.FindControl("lblWlID"), Label).Text
                Dim nextProcessId = CType(r.FindControl("lblnext_process_id"), Label).Text
                Dim requestId = GetFieldValue("SELECT REF_ID FROM APP_WORKLIST WHERE WL_ID='" & wlid & "'  ")
                If requestId = "" Then
                    requestId = GetFieldValueCon("SELECT REF_ID FROM APP_WORKLIST WHERE WL_ID='" & wlid & "'  ", "Enjazcon")
                End If
                'cn = OpenConnection()
                'trans = cn.BeginTransaction(IsolationLevel.ReadCommitted)
                'cmd.Connection = cn
                'cmd.Transaction = trans

                'SetDateSession(cn, cmd)

                'Try
                Using cn As New SqlConnection(GetConnString)
                    cn.Open()
                    Using trans As SqlTransaction = cn.BeginTransaction()
                        Try

                            Using cmd As New SqlCommand()
                                cmd.Connection = cn        ' Set the connection
                                cmd.Transaction = trans    ' Set the transaction
                                SetDateSession(cn, cmd)

                                Dim AppWl As clsGlobarVar.Worklist = New clsGlobarVar.Worklist
                                AppWl.WL03ProcessCode = AppProcess.ProcAssign.ToString.ToUpper
                                AppWl.WL04ProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL03ProcessCode)
                                AppWl.WL05RefID = requestId
                                ' AppWl.WL99RefWLID = ViewState("p1")
                                AppWl.WL06RefDate = CDate(GetServerDate(cn, cmd)).ToString("dd/MM/yyyy")
                                AppWl.WL07Priority = "N"
                                AppWl.WL08CompCode = AppWl.WL08CompCode
                                AppWl.WL09SysUserID = AppWl.WL09SysUserID
                                AppWl.WL13Status = "O"
                                ' If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                                If nextProcessId = AppProcess.ProcAssign.ToString.ToUpper Then
                                    AppWl.WL14NextProcessCode = AppProcess.ProcCheck.ToString.ToUpper()
                                Else
                                    AppWl.WL14NextProcessCode = AppProcess.ProcUploadDoc.ToString.ToUpper()
                                End If

                                AppWl.WL15NextProcessDesc = GetProcessDesc(cn, cmd, AppWl.WL14NextProcessCode)
                                AppWl.WL16RefStationID = ""
                                AppWl.WL17RefTask = ""
                                AppWl.WL18RefOther = "R"
                                AppWl.WL99OrigProcessID = AppProcess.ProcCreate.ToString.ToUpper

                                AppWl.WL99TypeOfOwner = clsGlobarVar.WLOwnerType.OnlyOwner
                                AppWl.WL98OnlyOwner = ddlSup.SelectedValue.ToString
                                'If pageProcess = AppProcess.ProcAssign.ToString.ToUpper Then
                                If nextProcessId = AppProcess.ProcAssign.ToString.ToUpper Then
                                    AppWl.WL99PageLink = "../Pages/CheckRequests.aspx"
                                Else
                                    AppWl.WL99PageLink = "../Pages/ProcessingPage.aspx"
                                End If


                                AppWl.WL99ModuleID = "R"
                                AppWl.WL99ApprLevel = "0"
                                InsertWorklist(cn, cmd, AppWl)
                                ' CloseWorklist(cn, cmd, worklistId, Session("UserID"), txtProcRemarks.Text)
                                CloseWorklist(cn, cmd, wlid, Session("user_id").ToString, "C", "")

                                Q = ""
                                If nextProcessId = AppProcess.ProcAssign.ToString.ToUpper Then
                                    Q = Q & " update ars_request_hdr set dept_head ='" & ddlSup.SelectedValue.ToString & "' where doc_no= '" & requestId & "'   "
                                Else
                                    Q = Q & " update ars_request_hdr set emp_no ='" & ddlSup.SelectedValue.ToString & "' where doc_no= '" & requestId & "'   "
                                End If
                                cmd.CommandText = Q
                                cmd.ExecuteNonQuery()
                                RunInOtherDb(Q)
                            End Using
                            trans.Commit()
                            saveFlag = True
                        Catch ex As Exception
                            ShowPopUpMsg(Me.Page, ex.ToString)
                            trans.Rollback()

                        Finally
                            ' cmd.Dispose()
                            trans.Dispose()
                            cn.Close()
                            cn.Dispose()
                        End Try
                    End Using
                End Using
            End If


        Next






        If saveFlag = True Then
            CloseModal(Me.Page, "myModal")
            GetPageData(0, 10)
        End If

    End Sub

End Class

Contents of ucDailyReport.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucDailyReport.ascx.vb" Inherits="EnjazVB.ucDailyReport" %>
<%@ Register Src="~/RPT/Controls/ucMainReportViewer.ascx" TagPrefix="uc1" TagName="ucMainReportViewer" %>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <%-- <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>--%>
    <ContentTemplate>
        <fieldset>
            <legend class="noLegend"></legend>
            <div class="panel panel-primary">
                <div class="panel-heading text-center">
                    <h2 id="H2" class="panel-title" runat="server"><asp:Localize ID="loc_Details" runat="server" Text="التقارير"></asp:Localize></h2>
                    <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i>
                    </span>
                </div>
                <div class="panel-body">
                  
                    <div class="container-fluid">
                        <div class="form-horizontal">



                 <div class="col-sm-4">
        <asp:Label ID="Label3" runat="server" Text="التاريخ" Font-Bold="True" ></asp:Label>
      <div class="form-group">
                <div class="col-sm-12">
            <asp:TextBox ID="txtDateFrom" TextMode="Date"  CssClass="form-control" runat="server" ></asp:TextBox>
          </div>
        
          </div>
                 </div>

 </div>

        <div class="form-group">



 
      <div class="col-sm-4">
        <asp:Label ID="Label1" runat="server" Text="الموظف" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlEmp"  runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>
    </div>


            </div>

          <div class="form-group">
              <div class="col-sm-4">
                        <asp:LinkButton ID="btnDisplay" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnDisplay_Click" 
                                      Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; عرض
                                                        " ></asp:LinkButton>
                  </div>
              </div>


 


<div class="form-group">

    <div class="col-sm-12">
        <div class="container-fluid">
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <div class="form-horizontal">
                <uc1:ucMainReportViewer runat="server" ID="ucMainReportViewer" />

                <div class="form-group">
                    <div class="col-sm-6">
                       
                        <asp:LinkButton ID="btnPrint" runat="server" CssClass="btn btn-primary btn-md" OnClick="btnPrint_Click" meta:resourcekey="btnPrint">
                                    <i aria-hidden="true" class="glyphicon glyphicon-print"></i> View Data
                        </asp:LinkButton>
                        <asp:LinkButton ID="btnClose" runat="server" CssClass="btn btn-primary btn-md" OnClick="btnClose_Click" meta:resourcekey="btnClose">
                                    <i aria-hidden="true" class="glyphicon glyphicon-remove"></i> Close
                        </asp:LinkButton>
                       <asp:LinkButton ID="lnkReportExport" Visible="false"  runat="server" CssClass="btn btn-primary btn-md" OnClick="lnkReportExport_Click"  Text="Export to Excel "></asp:LinkButton>
                                          

                    </div>
                </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
        <ProgressTemplate>
            <div class="progress"></div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>
        </div>
  
    </div>

  
                            </div>
                        </div>
                    </div>
                </div>
            </fieldset>
        </ContentTemplate>
    </asp:UpdatePanel>

Contents of ucDailyReport.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucDailyReport

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''H2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H2 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''loc_Details control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents loc_Details As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtDateFrom control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDateFrom As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlEmp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlEmp As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''btnDisplay control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnDisplay As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdatePanel2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel2 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''ucMainReportViewer control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucMainReportViewer As Global.EnjazVB.ucMainReportViewer

    '''<summary>
    '''btnPrint control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnPrint As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnClose control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnClose As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''lnkReportExport control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lnkReportExport As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucDailyReport.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Imports ClosedXML.Excel

Public Class ucDailyReport
    Inherits System.Web.UI.UserControl
    Dim q As String = ""
    Dim sSql As String = ""

    Public Property isSupper As Boolean
        Get
            Return Session("isSupper")
        End Get
        Set(value As Boolean)
            Session("isSupper") = value
        End Set
    End Property

    Public Property isQulity As Boolean
        Get
            Return Session("isQulity")
        End Get
        Set(value As Boolean)
            Session("isQulity") = value
        End Set
    End Property

    Public Property isSupvisor As Boolean
        Get
            Return Session("isSupvisor")
        End Get
        Set(value As Boolean)
            Session("isSupvisor") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            isSupper = IIf(Session("supper_user").ToString = "True", True, False)
            isSupvisor = IIf(GetFieldValue("SELECT IS_SUP FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
            isQulity = IIf(GetFieldValue("SELECT QUALITY FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)

            q = "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' "
            If isSupper Or (isSupvisor And isQulity) Then
            Else
                Dim sql As String = ""
                sql = sql & "   WITH N ( EMP_NO,EMP_NAME  ) AS ( "
                sql = sql & "   SELECT   EMP_NO,EMP_NAME FROM EMP_MST WITH (NOLOCK)  WHERE  EMP_NO='" & Session("emp_no").ToString & "'  "
                sql = sql & "   UNION  ALL "
                sql = sql & "   SELECT    C.EMP_NO,C.EMP_NAME FROM EMP_MST C WITH (NOLOCK)  JOIN N    ON C.SUP=N.EMP_NO "
                sql = sql & "   )    SELECT DISTINCT '' + STUFF(( SELECT    TOP 100  ', '''+ EMP_NO +''+'''' FROM   N X  WITH (NOLOCK)  "
                sql = sql & "   FOR XML  PATH(''), TYPE).value('.', 'VARCHAR(MAX)'), 1, 2, '') AS EMP  "
                'Dim EMPS = GetFieldValue(sql)

                'q = q & " AND EMP_NO IN (" & EMPS & " ) "
                q = q & " AND (SUP='" & Session("emp_no").ToString & "' OR EMP_NO= '" & Session("emp_no").ToString & "' )"
            End If

            FillComboSelectText(ddlEmp, q, "الكل")

            Dim sm As ScriptManager = ScriptManager.GetCurrent(Me.Page)
            sm.RegisterPostBackControl(lnkReportExport)
        End If
    End Sub


    Protected Sub btnDisplay_Click(sender As Object, e As EventArgs)
        Dim CLOSED_DATE As String = ""
        If IsDate(txtDateFrom.Text) Then
            CLOSED_DATE = CDate(txtDateFrom.Text).ToString("dd/MM/yyyy")
        Else
            CLOSED_DATE = ""
        End If



        sSql = "  "
        ''sSql = sSql & "   SELECT EMP_NO,EMP_NAME,COUNT(REF_ID) AS WL_COUNT ,'" & CLOSED_DATE & "' as CLOSED_DATE  "
        ''sSql = sSql & "    FROM ( "
        sSql = sSql & "   SELECT DISTINCT REF_ID,'" & CLOSED_DATE & "' AS CLOSED_DATE,E.EMP_NO,EMP_NAME FROM APP_REMARKS W JOIN  APP_USERS U  "
        ''sSql = sSql & "   SELECT DISTINCT REF_ID,FORMAT(WL_DATE,'DD/MM/YYYY') AS CLOSED_DATE,E.EMP_NO,EMP_NAME FROM APP_REMARKS W JOIN  APP_USERS U  "
        sSql = sSql & "   ON W.CLOSED_BY=U.USER_ID     JOIN EMP_MST E ON U.EMP_NO=E.EMP_NO "
        sSql = sSql & "   WHERE 1=1   "
        ' sSql = sSql & "    STATUS Not IN ('O','P')  "
        'sSql = sSql & "   AND NEXT_PROCESS_ID='" & AppProcess.ProcRemarks.ToString.ToUpper & "'  "
        If ddlEmp.SelectedValue.ToString <> "" Then                          '==================================updated by ali 22/05/2018=================='
            sSql = sSql & "  AND E.EMP_NO = '" & ddlEmp.SelectedValue & "' "
        Else
            If isSupper Or (isSupvisor And isQulity) Then
            Else

                Dim sql As String = ""
                sql = sql & "   WITH N ( EMP_NO,EMP_NAME  ) AS ( "
                sql = sql & "   SELECT   EMP_NO,EMP_NAME FROM EMP_MST WITH (NOLOCK)  WHERE  EMP_NO='" & Session("emp_no").ToString & "'  "
                sql = sql & "   UNION  ALL "
                sql = sql & "   SELECT    C.EMP_NO,C.EMP_NAME FROM EMP_MST C WITH (NOLOCK)  JOIN N    ON C.SUP=N.EMP_NO "
                sql = sql & "   )    SELECT DISTINCT '' + STUFF(( SELECT    TOP 100  ', '''+ EMP_NO +''+'''' FROM   N X  WITH (NOLOCK)  "
                sql = sql & "   FOR XML  PATH(''), TYPE).value('.', 'VARCHAR(MAX)'), 1, 2, '') AS EMP  "
                'Dim EMPS = GetFieldValue(sql)

                ' sSql = sSql & " AND E.EMP_NO IN  (" & EMPS & " )  "
                sSql = sSql & " AND E.EMP_NO IN  (SELECT EMP_NO FROM EMP_MST WHERE  SUP='" & Session("emp_no").ToString & "' OR EMP_NO= '" & Session("emp_no").ToString & "' )"
            End If
        End If


        If IsDate(txtDateFrom.Text) Then
            sSql = sSql & "  AND FORMAT(WL_DATE,'dd/MM/yyyy') ='" & CDate(txtDateFrom.Text).ToString("dd/MM/yyyy") & "'  "
        End If
        ''sSql = sSql & "  )T GROUP BY EMP_NO,EMP_NAME   "
        ' sSql = sSql & "  )T GROUP BY EMP_NO,EMP_NAME ORDER BY CAST( EMP_NO AS INT)  "
        Dim dt = GetTable(sSql)


        sSql = "  "
        'sSql = sSql & "   SELECT  EMP_NO,EMP_NAME,COUNT(REF_ID) AS WL_COUNT ,'" & CLOSED_DATE & "' as CLOSED_DATE  "
        'sSql = sSql & "    FROM ( "
        sSql = sSql & "   SELECT DISTINCT REF_ID,'" & CLOSED_DATE & "' AS CLOSED_DATE,E.EMP_NO,EMP_NAME FROM APP_REMARKS W JOIN  APP_USERS U  "
        ''sSql = sSql & "   SELECT DISTINCT REF_ID,FORMAT(WL_DATE,'DD/MM/YYYY') AS CLOSED_DATE,E.EMP_NO,EMP_NAME FROM APP_REMARKS W JOIN  APP_USERS U  "
        sSql = sSql & "   ON W.CLOSED_BY=U.USER_ID     JOIN EMP_MST E ON U.EMP_NO=E.EMP_NO "
        sSql = sSql & "   WHERE 1=1   "
        ' sSql = sSql & "    STATUS Not IN ('O','P')  "
        'sSql = sSql & "   AND NEXT_PROCESS_ID='" & AppProcess.ProcRemarks.ToString.ToUpper & "'  "
        If ddlEmp.SelectedValue.ToString <> "" Then                          '==================================updated by ali 22/05/2018=================='
            sSql = sSql & "  AND E.EMP_NO = '" & ddlEmp.SelectedValue & "' "
        Else
            If isSupper Or (isSupvisor And isQulity) Then
            Else

                Dim sql As String = ""
                sql = sql & "   WITH N ( EMP_NO,EMP_NAME  ) AS ( "
                sql = sql & "   SELECT   EMP_NO,EMP_NAME FROM EMP_MST WITH (NOLOCK)  WHERE  EMP_NO='" & Session("emp_no").ToString & "'  "
                sql = sql & "   UNION  ALL "
                sql = sql & "   SELECT    C.EMP_NO,C.EMP_NAME FROM EMP_MST C WITH (NOLOCK)  JOIN N    ON C.SUP=N.EMP_NO "
                sql = sql & "   )    SELECT DISTINCT '' + STUFF(( SELECT    TOP 100  ', '''+ EMP_NO +''+'''' FROM   N X  WITH (NOLOCK)  "
                sql = sql & "   FOR XML  PATH(''), TYPE).value('.', 'VARCHAR(MAX)'), 1, 2, '') AS EMP  "
                'Dim EMPS = GetFieldValue(sql)

                ' sSql = sSql & " AND E.EMP_NO IN  (" & EMPS & " )  "
                sSql = sSql & " AND E.EMP_NO IN  (SELECT EMP_NO FROM EMP_MST WHERE  SUP='" & Session("emp_no").ToString & "' OR EMP_NO= '" & Session("emp_no").ToString & "' )"
            End If
        End If


        If IsDate(txtDateFrom.Text) Then
            sSql = sSql & "  AND FORMAT(WL_DATE,'dd/MM/yyyy') ='" & CDate(txtDateFrom.Text).ToString("dd/MM/yyyy") & "'  "
        End If
        ''sSql = sSql & "  )T GROUP BY EMP_NO,EMP_NAME   "

        Dim DT2 = GetTableCon(sSql, "Enjazcon")

        dt.Merge(DT2)
        Dim groupedData = From row In dt.AsEnumerable()
                          Where Not row.IsNull("CLOSED_DATE")
                          Group row By EMP_NO = row.Field(Of String)("EMP_NO"),
                                      EMP_NAME = row.Field(Of String)("EMP_NAME") Into Group
                          Select New With {
                              .EMP_NO = EMP_NO,
                              .EMP_NAME = EMP_NAME,
                              .CLOSED_DATE = CLOSED_DATE,
                              .WL_COUNT = Group.Select(Function(r) r.Field(Of String)("REF_ID")).Count()
                          }

        Dim groupedTable As DataTable = ConvertToDataTable(groupedData)
        Dim orderedResult = From row In groupedTable.AsEnumerable()
                            Order By CInt(row.Field(Of String)("EMP_NO")) Ascending


        Dim sortedDataTable As DataTable = groupedTable.Clone() ' Clone the structure (columns) of the original table

        ' Import each sorted row into the new DataTable
        For Each row In orderedResult
            sortedDataTable.ImportRow(row)
        Next

        ucMainReportViewer.pReportTable = sortedDataTable
        ' ucMainReportViewer.pReportTable = dt
        ucMainReportViewer.pViewReport = "~/RPT/reports/DailyReport.rdlc"
        ucMainReportViewer.pReportTitle = "Main Report : " & Now.Date.ToString("dd/MM/yyyy")
        ucMainReportViewer.pReportComment = "انجاز  العقارية"
        ucMainReportViewer.pReportID = "mainRptDt"
        ucMainReportViewer.LoadReport()
    End Sub

    Private Function ConvertToDataTable(Of T)(ByVal data As IEnumerable(Of T)) As DataTable
        Dim table As New DataTable()

        ' Use reflection to get the properties of the type T
        Dim properties = GetType(T).GetProperties()

        ' Add columns to DataTable based on the properties of T
        For Each prop In properties
            table.Columns.Add(prop.Name, prop.PropertyType)
        Next

        ' Add rows to DataTable
        For Each item In data
            Dim row As DataRow = table.NewRow()
            For Each prop In properties
                row(prop.Name) = prop.GetValue(item, Nothing)
            Next
            table.Rows.Add(row)
        Next

        Return table
    End Function
    Protected Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click


    End Sub

    Protected Sub lnkReportExport_Click(sender As Object, e As EventArgs)

        Dim dtReport As New DataTable



        dtReport = ViewState("dtReport")

        'dtReport.Columns.Remove("emp_name_ar")
        dtReport.AcceptChanges()

        'Using wb As New XLWorkbook()
        '    wb.Worksheets.Add(dtReport, "Medical Insurance Report")



        '    Response.Clear()
        '    Response.Buffer = True
        '    Response.Charset = ""
        '    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
        '    Response.AddHeader("content-disposition", "attachment;filename=MedicalInsurance_" & Date.Now.Month.ToString & Date.Now.Year.ToString & ".xlsx")
        '    Using MyMemoryStream As New MemoryStream()
        '        wb.SaveAs(MyMemoryStream)
        '        MyMemoryStream.WriteTo(Response.OutputStream)
        '        Response.Flush()
        '        Response.End()
        '    End Using
        'End Using

    End Sub

    Protected Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
        'ucReportViewerC.Dispose()
        '  clsGenClass.RedirectURL("../Pages/myWorklist.aspx")
        RedirectURL("~/Pages/worklist.aspx")
    End Sub


End Class

Contents of ucEmpRequest.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEmpRequest.ascx.vb" Inherits="EnjazVB.ucEmpRequest" %>
<%@ Register Src="~/RPT/Controls/ucMainReportViewer.ascx" TagPrefix="uc1" TagName="ucMainReportViewer" %>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <%-- <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>--%>
    <ContentTemplate>
        <fieldset>
            <legend class="noLegend"></legend>
            <div class="panel panel-primary">
                <div class="panel-heading text-center">
                    <h2 id="H2" class="panel-title" runat="server"><asp:Localize ID="loc_Details" runat="server" Text="التقارير"></asp:Localize></h2>
                    <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i>
                    </span>
                </div>
                <div class="panel-body">
                  
                    <div class="container-fluid">
                        <div class="form-horizontal">



                 <div class="col-sm-4">
        <asp:Label ID="Label3" runat="server" Text="التاريخ" Font-Bold="True" ></asp:Label>
      <div class="form-group">
                <div class="col-sm-6">
            <asp:TextBox ID="txtDateFrom" TextMode="Date"  CssClass="form-control" runat="server" ></asp:TextBox>
          </div>
           <div class="col-sm-6">
            <asp:TextBox ID="txtDateTO" TextMode="Date"  CssClass="form-control" runat="server" ></asp:TextBox>
          </div>
          </div>
                 </div>

 





 
      <div class="col-sm-3">
        <asp:Label ID="Label1" runat="server" Text="الموظف" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlEmp"  runat="server" CssClass="form-control" Width="100%"></asp:DropDownList>
    </div>


           

                         <div class="col-sm-3">
                              <asp:Label ID="Label2" runat="server" Text="الحالة" Font-Bold="True" ></asp:Label>
                                    <asp:DropDownList ID="ddlStatus" CssClass="form-control" runat="server" AutoPostBack="True"
                                         >
                                    </asp:DropDownList>
                                </div>


              <div class="col-sm-1">
                   <asp:Label ID="Label4" runat="server" Text="." Font-Bold="True" ></asp:Label>
                        <asp:LinkButton ID="btnDisplay" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnDisplay_Click" 
                                      Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; عرض
                                                        " ></asp:LinkButton>
                  </div>
            
              </div>


 


<div class="form-group">

    <div class="col-sm-12">
        <div class="container-fluid">
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <div class="form-horizontal">
                <uc1:ucMainReportViewer runat="server" ID="ucMainReportViewer" />

                <div class="form-group">
                    <div class="col-sm-6">
                       
                        <asp:LinkButton ID="btnPrint" runat="server" CssClass="btn btn-primary btn-md" OnClick="btnPrint_Click" meta:resourcekey="btnPrint">
                                    <i aria-hidden="true" class="glyphicon glyphicon-print"></i> View Data
                        </asp:LinkButton>
                        <asp:LinkButton ID="btnClose" runat="server" CssClass="btn btn-primary btn-md" OnClick="btnClose_Click" meta:resourcekey="btnClose">
                                    <i aria-hidden="true" class="glyphicon glyphicon-remove"></i> Close
                        </asp:LinkButton>
                       <asp:LinkButton ID="lnkReportExport" Visible="false"  runat="server" CssClass="btn btn-primary btn-md" OnClick="lnkReportExport_Click"  Text="Export to Excel "></asp:LinkButton>
                                          

                    </div>
                </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
        <ProgressTemplate>
            <div class="progress"></div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>
        </div>
  
    </div>

  
                            </div>
                        </div>
                    </div>
                </div>
            </fieldset>
        </ContentTemplate>
    </asp:UpdatePanel>

Contents of ucEmpRequest.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucEmpRequest

    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''H2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H2 As Global.System.Web.UI.HtmlControls.HtmlGenericControl

    '''<summary>
    '''loc_Details control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents loc_Details As Global.System.Web.UI.WebControls.Localize

    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''txtDateFrom control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDateFrom As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''txtDateTO control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDateTO As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlEmp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlEmp As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ddlStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlStatus As Global.System.Web.UI.WebControls.DropDownList

    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''btnDisplay control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnDisplay As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdatePanel2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel2 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''ucMainReportViewer control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucMainReportViewer As Global.EnjazVB.ucMainReportViewer

    '''<summary>
    '''btnPrint control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnPrint As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''btnClose control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnClose As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''lnkReportExport control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lnkReportExport As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucEmpRequest.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Imports ClosedXML.Excel
Public Class ucEmpRequest
    Inherits System.Web.UI.UserControl
    Dim q As String = ""
    Dim sSql As String = ""

    Public Property isSupper As Boolean
        Get
            Return Session("isSupper")
        End Get
        Set(value As Boolean)
            Session("isSupper") = value
        End Set
    End Property

    Public Property isQulity As Boolean
        Get
            Return Session("isQulity")
        End Get
        Set(value As Boolean)
            Session("isQulity") = value
        End Set
    End Property

    Public Property isSupvisor As Boolean
        Get
            Return Session("isSupvisor")
        End Get
        Set(value As Boolean)
            Session("isSupvisor") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            isSupper = IIf(Session("supper_user").ToString = "True", True, False)
            isSupvisor = IIf(GetFieldValue("SELECT IS_SUP FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)
            isQulity = IIf(GetFieldValue("SELECT QUALITY FROM EMP_MST WHERE EMP_NO='" & Session("emp_no").ToString & "'") = "Y", True, False)


            q = "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' "
            If isSupper Or (isSupvisor And isQulity) Then
            Else
                q = q & " AND (SUP='" & Session("emp_no").ToString & "' OR EMP_NO= '" & Session("emp_no").ToString & "' )"
            End If

            FillComboSelectText(ddlEmp, q, "الكل")

            FillComboSelectText(ddlStatus, "select type_category, type_Desc from type_mst where type_code='RS'   UNION SELECT 'U' ,N'طلبات مرفوعة '  ", "حالة الطلب")
            Dim sm As ScriptManager = ScriptManager.GetCurrent(Me.Page)
            sm.RegisterPostBackControl(lnkReportExport)
        End If
    End Sub

    Protected Sub btnDisplay_Click(sender As Object, e As EventArgs)
        Dim CLOSED_DATE As String = ""
        If IsDate(txtDateFrom.Text) Then
            CLOSED_DATE = CDate(txtDateFrom.Text).ToString("dd/MM/yyyy")
        Else
            CLOSED_DATE = ""
        End If
        'sSql = "  "
        'sSql = sSql & "  select a.*, '" & CLOSED_DATE & "' as CLOSED_DATE from (  "
        'sSql = sSql & "   select E.EMP_NO,EMP_NAME,COUNT(WL_ID) AS WL_COUNT from app_worklist W JOIN  APP_USERS U  "
        'sSql = sSql & "    ON W.CLOSED_BY=U.USER_ID "
        'sSql = sSql & "    JOIN EMP_MST E ON U.EMP_NO=E.EMP_NO "
        'sSql = sSql & "    where NEXT_PROCESS_ID='" & AppProcess.ProcRemarks.ToString.ToUpper & "' AND  status NOT IN ('O','P')  "
        'If ddlEmp.SelectedValue.ToString <> "" Then                          '==================================updated by ali 22/05/2018=================='
        '    sSql = sSql & "  AND E.EMP_NO = '" & ddlEmp.SelectedValue & "' "
        'Else
        '    If isSupper Then
        '    Else
        '        sSql = sSql & " AND E.EMP_NO IN  (SELECT EMP_NO FROM EMP_MST WHERE  SUP='" & Session("emp_no").ToString & "' OR EMP_NO= '" & Session("emp_no").ToString & "' )"
        '    End If
        'End If


        'If IsDate(txtDateFrom.Text) Then
        '    sSql = sSql & "  AND FORMAT(CLOSED_DATE,'dd/MM/yyyy') ='" & CDate(txtDateFrom.Text).ToString("dd/MM/yyyy") & "'  "
        'End If
        'sSql = sSql & "   GROUP BY E.EMP_NO,EMP_NAME   "
        'sSql = sSql & "  ) a "


        sSql = "  "
        sSql = sSql & "    SELECT EMP_NO,EMP_NAME,SUM(CASE WHEN STATUS='C' THEN 1 ELSE 0 END ) AS CLOSED,SUM(CASE WHEN STATUS='O' AND  ISNULL(T2.CNT,0) =0 THEN 1 ELSE 0 END ) AS OPEN_ ,SUM(CASE WHEN STATUS='O' AND T2.CNT > 0 THEN 1 ELSE 0 END ) AS UPLOADED "
        sSql = sSql & "     ,SUM(CASE WHEN STATUS='N' THEN 1 ELSE 0 END ) AS PENDING, SUM(CASE WHEN STATUS='D' THEN 1 ELSE 0 END ) AS CANCELLED,  "
        sSql = sSql & "     COUNT(STATUS) AS TOTAL   FROM ("
        sSql = sSql & "     SELECT H.EMP_NO,E.EMP_NAME,STATUS,DOC_NO  FROM ARS_REQUEST_HDR H, EMP_MST E  "
        sSql = sSql & "     WHERE H.EMP_NO=E.EMP_NO  AND H.TRAN_TYPE='R'  "

        If ddlEmp.SelectedValue.ToString <> "" Then                          '==================================updated by ali 22/05/2018=================='
            sSql = sSql & "  AND E.EMP_NO = '" & ddlEmp.SelectedValue & "' "
        Else
            If isSupper Then 'Or (isSupvisor And isQulity)
            Else
                sSql = sSql & " AND E.EMP_NO IN  (SELECT EMP_NO FROM EMP_MST WHERE  SUP='" & Session("emp_no").ToString & "' OR EMP_NO= '" & Session("emp_no").ToString & "' )"
            End If
        End If


        If ddlStatus.SelectedValue.ToString <> "" Then
            If ddlStatus.SelectedValue.ToString = "O" Then
                sSql = sSql & " AND H.STATUS='O'"
                sSql = sSql & " AND H.DOC_NO NOT  IN (SELECT DISTINCT REF_ID  FROM APP_WORKLIST WHERE  NEXT_PROCESS_ID NOT  "
                sSql = sSql & " IN ('" & AppProcess.ProcUploadDoc.ToString.ToUpper & "','" & AppProcess.ProcCreate.ToString.ToUpper & "','" & AppProcess.ProcCheck.ToString.ToUpper & "','" & AppProcess.ProcCancelConfirm.ToString.ToUpper & "','" & AppProcess.ProcAssign.ToString.ToUpper & "' ) AND STATUS='O' )    "
            ElseIf ddlStatus.SelectedValue.ToString = "U" Then
                sSql = sSql & " AND H.STATUS='O'"
                sSql = sSql & " AND H.DOC_NO   IN  (SELECT DISTINCT REF_ID  FROM APP_WORKLIST WHERE  NEXT_PROCESS_ID NOT  "
                sSql = sSql & " IN ('" & AppProcess.ProcUploadDoc.ToString.ToUpper & "','" & AppProcess.ProcCreate.ToString.ToUpper & "','" & AppProcess.ProcCheck.ToString.ToUpper & "','" & AppProcess.ProcCancelConfirm.ToString.ToUpper & "','" & AppProcess.ProcAssign.ToString.ToUpper & "' ) AND STATUS='O' )    "
            Else
                sSql = sSql & " AND H.STATUS='" & ddlStatus.SelectedValue.ToString & "'"
            End If
        Else
            If isQulity Then
                sSql = sSql & "  AND (H.STATUS<>'C' OR (H.STATUS = 'C' AND   E.EMP_NO='" & Session("emp_no").ToString & "') ) "
            End If
        End If

        If IsDate(txtDateFrom.Text) And IsDate(txtDateTO.Text) Then
            sSql = sSql & "  AND CONVERT(DATE,(CASE WHEN H.STATUS='O' THEN  H.DOC_DATE  ELSE H.LASTUPDATEDATE END ),103) BETWEEN  CONVERT(DATE,'" & CDate(txtDateFrom.Text).ToString("dd/MM/yyyy") & "',103) AND  CONVERT(DATE,'" & CDate(txtDateTO.Text).ToString("dd/MM/yyyy") & "',103)  "
        End If

        sSql = sSql & " )T     "
        sSql = sSql & "  LEFT JOIN (SELECT REF_ID, COUNT(REF_ID)CNT  FROM APP_WORKLIST WHERE  NEXT_PROCESS_ID NOT  "
        sSql = sSql & "  IN ('" & AppProcess.ProcUploadDoc.ToString.ToUpper & "','" & AppProcess.ProcCreate.ToString.ToUpper & "','" & AppProcess.ProcCheck.ToString.ToUpper & "','" & AppProcess.ProcCancelConfirm.ToString.ToUpper & "','" & AppProcess.ProcAssign.ToString.ToUpper & "' ) AND STATUS='O' GROUP BY REF_ID) T2   "
        sSql = sSql & "  ON T.DOC_NO=T2.REF_ID   "
        sSql = sSql & "GROUP BY EMP_NO,EMP_NAME   ORDER BY CAST( EMP_NO AS INT)  "

        Dim dt = GetTable(sSql)
        ucMainReportViewer.pReportTable = dt
        ucMainReportViewer.pViewReport = "~/RPT/reports/EmpRequests.rdlc"
        ucMainReportViewer.pReportTitle = "Main Report : " & Now.Date.ToString("dd/MM/yyyy")
        ucMainReportViewer.pReportComment = "انجاز  العقارية"
        ucMainReportViewer.pReportID = "mainRptDt"
        ucMainReportViewer.LoadReport()
    End Sub

    Protected Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click


    End Sub

    Protected Sub lnkReportExport_Click(sender As Object, e As EventArgs)

        Dim dtReport As New DataTable



        dtReport = ViewState("dtReport")

        'dtReport.Columns.Remove("emp_name_ar")
        dtReport.AcceptChanges()

        'Using wb As New XLWorkbook()
        '    wb.Worksheets.Add(dtReport, "Medical Insurance Report")



        '    Response.Clear()
        '    Response.Buffer = True
        '    Response.Charset = ""
        '    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
        '    Response.AddHeader("content-disposition", "attachment;filename=MedicalInsurance_" & Date.Now.Month.ToString & Date.Now.Year.ToString & ".xlsx")
        '    Using MyMemoryStream As New MemoryStream()
        '        wb.SaveAs(MyMemoryStream)
        '        MyMemoryStream.WriteTo(Response.OutputStream)
        '        Response.Flush()
        '        Response.End()
        '    End Using
        'End Using

    End Sub

    Protected Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
        'ucReportViewerC.Dispose()
        '  clsGenClass.RedirectURL("../Pages/myWorklist.aspx")
        RedirectURL("~/Pages/worklist.aspx")
    End Sub
End Class

Contents of ucMainReport.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucMainReport.ascx.vb" Inherits="EnjazVB.ucMainReport" %>
<%@ Register Src="~/RPT/Controls/ucReportViewerC.ascx" TagPrefix="uc1" TagName="ucReportViewerC" %>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <%-- <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>--%>
    <ContentTemplate>
        <fieldset>
            <legend class="noLegend"></legend>
            <div class="panel panel-primary">
                <div class="panel-heading text-center">
                    <h2 id="H2" class="panel-title" runat="server"><asp:Localize ID="loc_Details" runat="server" Text="التقارير"></asp:Localize></h2>
                    <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i>
                    </span>
                </div>
                <div class="panel-body">
                  
                    <div class="container-fluid">
                        <div class="form-horizontal">

<div class="form-group">
    <div class="col-sm-4">
        <asp:Label ID="Label7" runat="server" Text="جهة التمويل" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlBank"  runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
   </div>

     <div class="col-sm-4">
        <asp:Label ID="Label1" runat="server" Text="الموظف" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlEmp"  runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>
       

       <div class="col-sm-4">
  <asp:Label ID="Label2" runat="server" Text="حالة الطلب" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlStatus"  runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>
        
    </div>

        <div class="form-group">

             <div class="col-sm-4">
        <asp:Label ID="Label3" runat="server" Text="التاريخ" Font-Bold="True" ></asp:Label>
      <div class="form-group">
                <div class="col-sm-6">
            <asp:TextBox ID="txtDateFrom" TextMode="Date"  CssClass="form-control" runat="server" ></asp:TextBox>
          </div>
         <div class="col-sm-6">
               <asp:TextBox ID="txtDateTo" TextMode="Date"  CssClass="form-control" runat="server" ></asp:TextBox>
          </div>
          </div>
                 </div>

 
    

     <div class="col-sm-4">
        <asp:Label ID="Label4" runat="server" Text="جهة العمل" Font-Bold="True" ></asp:Label>
   <asp:DropDownList ID="ddlWork"  runat="server" CssClass="form-control input-sm" Width="100%"></asp:DropDownList>
    </div>
            </div>

          <div class="form-group">
              <div class="col-sm-4">
                        <asp:LinkButton ID="btnDisplay" runat="server"  CssClass="btn btn-primary btn-md" OnClick="btnDisplay_Click" 
                                      Text="
                                                            &lt;i aria-hidden=&quot;true&quot; class=&quot;glyphicon glyphicon-ok&quot;&gt;&lt;/i&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; عرض
                                                        " ></asp:LinkButton>
                  </div>
              </div>


 


<div class="form-group">

    <div class="col-sm-12">
        <div class="container-fluid">
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <div class="form-horizontal">
                <uc1:ucReportViewerC runat="server" ID="ucReportViewerC" />

                <div class="form-group">
                    <div class="col-sm-6">
                       
                        <asp:LinkButton ID="btnPrint" runat="server" CssClass="btn btn-primary btn-md" OnClick="btnPrint_Click" meta:resourcekey="btnPrint">
                                    <i aria-hidden="true" class="glyphicon glyphicon-print"></i> View Data
                        </asp:LinkButton>
                        <asp:LinkButton ID="btnClose" runat="server" CssClass="btn btn-primary btn-md" OnClick="btnClose_Click" meta:resourcekey="btnClose">
                                    <i aria-hidden="true" class="glyphicon glyphicon-remove"></i> Close
                        </asp:LinkButton>
                       <asp:LinkButton ID="lnkReportExport" Visible="false"  runat="server" CssClass="btn btn-primary btn-md" OnClick="lnkReportExport_Click"  Text="Export to Excel "></asp:LinkButton>
                                          

                    </div>
                </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
        <ProgressTemplate>
            <div class="progress"></div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>
        </div>
  
    </div>

  
                            </div>
                        </div>
                    </div>
                </div>
            </fieldset>
        </ContentTemplate>
    </asp:UpdatePanel>

Contents of ucMainReport.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucMainReport
    
    '''<summary>
    '''UpdatePanel1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel1 As Global.System.Web.UI.UpdatePanel
    
    '''<summary>
    '''H2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents H2 As Global.System.Web.UI.HtmlControls.HtmlGenericControl
    
    '''<summary>
    '''loc_Details control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents loc_Details As Global.System.Web.UI.WebControls.Localize
    
    '''<summary>
    '''Label7 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label7 As Global.System.Web.UI.WebControls.Label
    
    '''<summary>
    '''ddlBank control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlBank As Global.System.Web.UI.WebControls.DropDownList
    
    '''<summary>
    '''Label1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label
    
    '''<summary>
    '''ddlEmp control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlEmp As Global.System.Web.UI.WebControls.DropDownList
    
    '''<summary>
    '''Label2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label2 As Global.System.Web.UI.WebControls.Label
    
    '''<summary>
    '''ddlStatus control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlStatus As Global.System.Web.UI.WebControls.DropDownList
    
    '''<summary>
    '''Label3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label3 As Global.System.Web.UI.WebControls.Label
    
    '''<summary>
    '''txtDateFrom control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDateFrom As Global.System.Web.UI.WebControls.TextBox
    
    '''<summary>
    '''txtDateTo control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDateTo As Global.System.Web.UI.WebControls.TextBox
    
    '''<summary>
    '''Label4 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label
    
    '''<summary>
    '''ddlWork control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ddlWork As Global.System.Web.UI.WebControls.DropDownList
    
    '''<summary>
    '''btnDisplay control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnDisplay As Global.System.Web.UI.WebControls.LinkButton
    
    '''<summary>
    '''UpdatePanel2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdatePanel2 As Global.System.Web.UI.UpdatePanel

    '''<summary>
    '''ucReportViewerC control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucReportViewerC As Global.EnjazVB.ucReportViewerC

    '''<summary>
    '''btnPrint control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnPrint As Global.System.Web.UI.WebControls.LinkButton
    
    '''<summary>
    '''btnClose control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents btnClose As Global.System.Web.UI.WebControls.LinkButton
    
    '''<summary>
    '''lnkReportExport control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lnkReportExport As Global.System.Web.UI.WebControls.LinkButton
    
    '''<summary>
    '''UpdateProgress1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents UpdateProgress1 As Global.System.Web.UI.UpdateProgress
End Class

Contents of ucMainReport.ascx.vb:

Imports System.IO
Imports System.Data.SqlClient
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports EnjazVB.Sys.Classes
Imports System.Globalization
Imports ClosedXML.Excel

Public Class ucMainReport
    Inherits System.Web.UI.UserControl
    Dim q As String = ""
    Dim sSql As String = ""

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            FillComboSelect(ddlBank, "SELECT type_category , type_desc FROM type_mst WHERE type_code='BK' ")
            FillComboSelect(ddlEmp, "SELECT EMP_NO , EMP_NAME FROM EMP_MST WHERE STATUS_FLAG='A' ")
            FillComboSelect(ddlStatus, "select type_category, type_Desc from type_mst where type_code='RS'")
            FillComboSelect(ddlWork, "select type_category,type_Desc from type_mst where type_Code='WE' ORDER BY  TYPE_ABBR")

            Dim sm As ScriptManager = ScriptManager.GetCurrent(Me.Page)
            sm.RegisterPostBackControl(lnkReportExport)
        End If
    End Sub

    Protected Sub btnDisplay_Click(sender As Object, e As EventArgs)
        sSql = "  "
        sSql = sSql & "  select * from (  "
        sSql = sSql & "    select ROW_NUMBER() OVER (ORDER BY  doc_date DESC) as srno, h.doc_no AS Request_id ,format(h.doc_date,'dd/MM/yyyy')doc_Date, REQ_BY AS customerName, BK.TYPE_DESC AS SalaryBank, W.TYPE_dESC AS workType,H.CONTACT_NO as Phone  ,s.type_desc as status , "
        sSql = sSql & "    IK.TYPE_DESC  as financeBank,H.other2 as salary,h.other11 as personal, h.other12 as realEstate, e.emp_name as employee,(case when h.other8='N' THEN 'NO' ELSE 'YES' END ) AS Loans"
        sSql = sSql & "   from ARS_REQUEST_HDR h left join  emp_mst e  on h.emp_no=e.emp_no inner join (select * from type_mst where type_code='RS') S on h.status=s.type_category  "
        sSql = sSql & "   left join (select * from type_mst where type_Code='BK') BK ON H.OTHER1=BK.TYPE_cATEGORY "
        sSql = sSql & "   left join (select * from type_mst where type_Code='BK') IK ON H.OTHER4=IK.TYPE_cATEGORY "
        sSql = sSql & "   left join (select * from type_mst where type_Code='WE')W ON H.OTHER3=W.TYPE_CATEGORY "

        sSql = sSql & "   where 1=1 AND H.TRAN_TYPE='R'"


        If (ddlStatus.SelectedIndex > 0) Then                          '==================================updated by ali 22/05/2018=================='
            sSql = sSql & "  AND H.status = '" & ddlStatus.SelectedValue & "' "
        End If
        If ddlEmp.SelectedValue.ToString <> "" Then                          '==================================updated by ali 22/05/2018=================='
            sSql = sSql & "  AND H.EMP_NO = '" & ddlEmp.SelectedValue & "' "
        End If

        If ddlBank.SelectedValue.ToString <> "" Then                          '==================================updated by ali 22/05/2018=================='
            sSql = sSql & "  AND H.OTHER4 = '" & ddlBank.SelectedValue & "' "
        End If

        If ddlWork.SelectedValue.ToString <> "" Then
            sSql = sSql & "  AND H.OTHER3 = '" & ddlWork.SelectedValue & "' "
        End If

        sSql = sSql & "  ) a "

        Dim dt = GetTable(sSql)
        ucReportViewerC.pReportTable = dt
        ucReportViewerC.pViewReport = "~/RPT/reports/mainReport.rpt"
        ucReportViewerC.pReportTitle = "Main Report : " & Now.Date.ToString("dd/MM/yyyy")
        ucReportViewerC.pReportComment = "انجاز الاملاك العقارية"
        ucReportViewerC.pReportID = "mainRptDt"
        ucReportViewerC.LoadReport()
    End Sub

    Protected Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click


    End Sub

    Protected Sub lnkReportExport_Click(sender As Object, e As EventArgs)

        Dim dtReport As New DataTable



        dtReport = ViewState("dtReport")

        dtReport.Columns.Remove("emp_name_ar")
        dtReport.AcceptChanges()

        'Using wb As New XLWorkbook()
        '    wb.Worksheets.Add(dtReport, "Medical Insurance Report")



        '    Response.Clear()
        '    Response.Buffer = True
        '    Response.Charset = ""
        '    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
        '    Response.AddHeader("content-disposition", "attachment;filename=MedicalInsurance_" & Date.Now.Month.ToString & Date.Now.Year.ToString & ".xlsx")
        '    Using MyMemoryStream As New MemoryStream()
        '        wb.SaveAs(MyMemoryStream)
        '        MyMemoryStream.WriteTo(Response.OutputStream)
        '        Response.Flush()
        '        Response.End()
        '    End Using
        'End Using

    End Sub

    Protected Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
        'ucReportViewerC.Dispose()
        '  clsGenClass.RedirectURL("../Pages/myWorklist.aspx")
        RedirectURL("~/Pages/worklist.aspx")
    End Sub

End Class

Contents of ucMainReportViewer.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucMainReportViewer.ascx.vb" Inherits="EnjazVB.ucMainReportViewer" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Culture=neutral"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<style type="text/css">
   div#code1281 {
        font-family: "Code 128" !important;
    }

   .barcodeClass{
        font-family: "Code 128" !important;
    }
</style>

<%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>--%>
        <div class="panel panel-primary">
            <div class="panel-heading text-center">
                <h3 class="panel-title">Report Viewer</h3>
                <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i></span>
            </div>
            <div class="panel-body">
                <div class="container-fluid">
                    <div class="form-horizontal">
                        <fieldset>
                            <legend class="noLegend"></legend>                            
                            <div class="form-group">
                                <div  style="overflow:auto">
                                  <rsweb:ReportViewer ID="rptViewer" ZoomMode="PageWidth" ZoomPercent="80"    Width="100%" runat="server"></rsweb:ReportViewer>
 </div>
                            </div>
                        </fieldset>
                    </div>
                </div>
            </div>
        </div>

Contents of ucMainReportViewer.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucMainReportViewer

    '''<summary>
    '''rptViewer control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents rptViewer As Global.Microsoft.Reporting.WebForms.ReportViewer
End Class

Contents of ucMainReportViewer.ascx.vb:

Imports Oracle.ManagedDataAccess.Client
Imports WebClass.Sys.Classes
Imports System.Data
'Imports Microsoft.Reporting.WebForms
Imports CrystalDecisions
Imports CrystalDecisions.CrystalReports
'Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.IO
Imports System.Drawing.Printing
Imports System.ComponentModel
'Imports Microsoft.Reporting.WebForms
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports System.Guid
Imports Microsoft.Reporting.WebForms
Public Class ucMainReportViewer
    Inherits System.Web.UI.UserControl
    Dim _ViewQuery As String
    Dim _ReportName As String
    Dim _ReportTable As New DataTable
    Dim _ReportDataSet As New DataSet
    Dim _SubReportTable As New DataTable
    Dim _Para1 As String = ""
    Dim _Para2 As String = ""
    Dim _ReportID As String = ""
    Dim _ReportTitle As String = ""
    Dim _ReportComment As String = ""

    Public Property pReportComment() As String
        Get
            Return ViewState("pReportComment")
        End Get
        Set(value As String)
            ViewState("pReportComment") = value
        End Set
    End Property

    Public Property pReportTitle() As String
        Get
            Return ViewState("pReportTitle")
        End Get
        Set(value As String)
            ViewState("pReportTitle") = value
        End Set
    End Property

    Public Property pPara2() As String
        Get
            Return ViewState("pPara2")
        End Get
        Set(value As String)
            ViewState("pPara2") = value
        End Set
    End Property

    Public Property pPara1() As String
        Get
            Return ViewState("pPara1")
        End Get
        Set(value As String)
            ViewState("pPara1") = value
        End Set
    End Property

    Public Property pViewReport() As String
        Get
            Return ViewState("pViewReport")
        End Get
        Set(value As String)
            ViewState("pViewReport") = value
        End Set
    End Property

    Public Property pViewQuery() As String
        Get
            Return ViewState("pViewQuery")
        End Get
        Set(value As String)
            ViewState("pViewQuery") = value
        End Set
    End Property

    Public Property pReportTable() As DataTable
        Get
            Return ViewState("pReportTable")
        End Get
        Set(value As DataTable)
            ViewState("pReportTable") = value
        End Set
    End Property

    Public Property pReportDataSet() As DataSet
        Get
            Return ViewState("pReportDataSet")
        End Get
        Set(value As DataSet)
            ViewState("pReportDataSet") = value
        End Set
    End Property

    Public Property pSubReportTable() As DataTable
        Get
            Return ViewState("pSubReportTable")
        End Get
        Set(value As DataTable)
            ViewState("pSubReportTable") = value
        End Set
    End Property

    Public Property pReportID() As String
        Get
            Return ViewState("pReportID")
        End Get
        Set(value As String)
            ViewState("pReportID") = value
        End Set
    End Property

    Public Property DataSources As List(Of DataTable)
        Get
            Return ViewState("DataSources")
        End Get
        Set(value As List(Of DataTable))
            ViewState("DataSources") = value
        End Set
    End Property

    <DefaultValue(True)> Public Property pSeparatePages() As Boolean
        Get
            If ViewState("pSeparatePages") Is Nothing Then
                Return True
            Else
                Return ViewState("pSeparatePages")
            End If
        End Get
        Set(value As Boolean)
            ViewState("pSeparatePages") = value
        End Set
    End Property
    'Added by Abdul kareem 04/01/2019

    <DefaultValue(True)> Public Property pHasExportButton() As Boolean
        Get
            If ViewState("pHasExportButton") Is Nothing Then
                Return True
            Else
                Return ViewState("pHasExportButton")
            End If
        End Get
        Set(value As Boolean)
            ViewState("pHasExportButton") = value
        End Set
    End Property
    <DefaultValue(True)> Public Property pHasPrintButton() As Boolean
        Get
            If ViewState("pHasPrintButton") Is Nothing Then
                Return True
            Else
                Return ViewState("pHasPrintButton")
            End If
        End Get
        Set(value As Boolean)
            ViewState("pHasPrintButton") = value
        End Set
    End Property
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack Then

            If Session(pReportID) IsNot Nothing Then
                If Not ViewState("dtAbsent") Is Nothing Then
                    ' LoadReport2(ViewState("dtAbsent"))
                Else
                    LoadReport()
                End If

            End If
        End If
    End Sub


    Public Sub LoadReport()
        'ViewState("ReportID") = pReportID
        Dim dtRpt As New DataTable
        Dim dsRpt As New DataSet

        'If Session(pReportID) IsNot Nothing Then
        '    dtRpt = Session(pReportID)
        'Else
        If pViewQuery <> "" Then
            dtRpt = GetTable(pViewQuery)
        Else
            dtRpt = pReportTable
        End If
        'End If


        If pReportDataSet IsNot Nothing Then
            dsRpt = pReportDataSet
        End If

        If dtRpt IsNot Nothing AndAlso (dtRpt.Rows.Count > 0 Or dsRpt.Tables.Count > 0) Then
            'Dim rptDoc As New ReportDocument
            'rptDoc = New ReportDocument
            dtRpt.TableName = "Crystal Report Example"
            'rptDoc.Load(Server.MapPath(pViewReport))

            'rptViewer.ProcessingMode = ProcessingMode.Local
            rptViewer.LocalReport.ReportPath = Server.MapPath(pViewReport)

            rptViewer.LocalReport.DataSources.Clear()
            Dim datasource As New ReportDataSource("DataSet1", dtRpt)
            rptViewer.LocalReport.DataSources.Add(datasource)


        Else
            rptViewer.LocalReport.DataSources.Clear()
            Dim datasource As New ReportDataSource("DataSet1", dtRpt)
            rptViewer.LocalReport.DataSources.Add(datasource)
            ShowPopUpMsg(Me.Page, "No Record(s).")
        End If
    End Sub

End Class

Contents of ucReportViewerC.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucReportViewerC.ascx.vb" Inherits="EnjazVB.ucReportViewerC" %>
<%@ Register assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral" namespace="CrystalDecisions.Web" tagprefix="CR" %>


<style type="text/css">
   div#code1281 {
        font-family: "Code 128" !important;
    }

   .barcodeClass{
        font-family: "Code 128" !important;
    }
</style>

<%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>--%>
        <div class="panel panel-primary">
            <div class="panel-heading text-center">
                <h3 class="panel-title">Report Viewer</h3>
                <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i></span>
            </div>
            <div class="panel-body">
                <div class="container-fluid">
                    <div class="form-horizontal">
                        <fieldset>
                            <legend class="noLegend"></legend>                            
                            <div class="form-group">
                                <div  style="overflow:auto">
                                  


                                    <CR:CrystalReportViewer ID="rptViewer" BestFitPage="false" runat="server" Width="100%" ClientIDMode="Static"
                                        ToolPanelView="None" PrintMode="ActiveX" GroupTreeImagesFolderUrl=""   HyperlinkTarget="_blank"
                                        ToolbarImagesFolderUrl="" ToolPanelWidth="200px"></CR:CrystalReportViewer>
<%--                                   <CR:CrystalReportViewer ID="rptViewer" BestFitPage="false" runat="server" Width="100%" ClientIDMode="Static"
                                        ToolPanelView="None" PrintMode="ActiveX" GroupTreeImagesFolderUrl=""   HyperlinkTarget="_blank"
                                        ToolbarImagesFolderUrl="" ToolPanelWidth="200px"  />--%>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </div>
            </div>
        </div>
<%--    </ContentTemplate>
</asp:UpdatePanel>--%>

<%--<div id="dvReport">
<iframe  style="border:1px solid #666CCC" title="PDF in an i-Frame" src="../../../ReportStorage/reportpdf.pdf" frameborder="1" scrolling="auto" height="1100" width="850" ></iframe>
    </div>
<input  type="button" id="btnPrint" value="Print" onclick="Print()" />

<script type="text/javascript">
    function Print() {
        var dvReport = document.getElementById("dvReport");
        var frame1 = dvReport.getElementsByTagName("iframe")[0];
        if (navigator.appName.indexOf("Internet Explorer") != -1) {
            frame1.name = frame1.id;
            window.frames[frame1.id].focus();
            window.frames[frame1.id].print();
        }
        else {
            var frameDoc = frame1.contentWindow ? frame1.contentWindow : frame1.contentDocument.document ? frame1.contentDocument.document : frame1.contentDocument;
            frameDoc.print();
        }
    }
</script>--%>

Contents of ucReportViewerC.ascx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class ucReportViewerC
    
    '''<summary>
    '''rptViewer control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents rptViewer As Global.CrystalDecisions.Web.CrystalReportViewer
End Class

Contents of ucReportViewerC.ascx.vb:

Imports Oracle.ManagedDataAccess.Client
Imports WebClass.Sys.Classes
Imports System.Data
'Imports Microsoft.Reporting.WebForms
Imports CrystalDecisions
Imports CrystalDecisions.CrystalReports
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.IO
Imports System.Drawing.Printing
Imports System.ComponentModel
Imports EnjazVB.Sys.Classes.MainClass
Imports EnjazVB.Sys.Classes.clsGlobarVar
Imports System.Guid

Public Class ucReportViewerC
    Inherits System.Web.UI.UserControl

    Dim _ViewQuery As String
    Dim _ReportName As String
    Dim _ReportTable As New DataTable
    Dim _ReportDataSet As New DataSet
    Dim _SubReportTable As New DataTable
    Dim _Para1 As String = ""
    Dim _Para2 As String = ""
    Dim _ReportID As String = ""
    Dim _ReportTitle As String = ""
    Dim _ReportComment As String = ""

    Dim rptDoc As New ReportDocument
    Public Property pReportComment() As String
        Get
            Return ViewState("pReportComment")
        End Get
        Set(value As String)
            ViewState("pReportComment") = value
        End Set
    End Property

    Public Property pReportTitle() As String
        Get
            Return ViewState("pReportTitle")
        End Get
        Set(value As String)
            ViewState("pReportTitle") = value
        End Set
    End Property

    Public Property pPara2() As String
        Get
            Return ViewState("pPara2")
        End Get
        Set(value As String)
            ViewState("pPara2") = value
        End Set
    End Property

    Public Property pPara1() As String
        Get
            Return ViewState("pPara1")
        End Get
        Set(value As String)
            ViewState("pPara1") = value
        End Set
    End Property

    Public Property pViewReport() As String
        Get
            Return ViewState("pViewReport")
        End Get
        Set(value As String)
            ViewState("pViewReport") = value
        End Set
    End Property

    Public Property pViewQuery() As String
        Get
            Return ViewState("pViewQuery")
        End Get
        Set(value As String)
            ViewState("pViewQuery") = value
        End Set
    End Property

    Public Property pReportTable() As DataTable
        Get
            Return ViewState("pReportTable")
        End Get
        Set(value As DataTable)
            ViewState("pReportTable") = value
        End Set
    End Property

    Public Property pReportDataSet() As DataSet
        Get
            Return ViewState("pReportDataSet")
        End Get
        Set(value As DataSet)
            ViewState("pReportDataSet") = value
        End Set
    End Property

    Public Property pSubReportTable() As DataTable
        Get
            Return ViewState("pSubReportTable")
        End Get
        Set(value As DataTable)
            ViewState("pSubReportTable") = value
        End Set
    End Property

    Public Property pReportID() As String
        Get
            Return ViewState("pReportID")
        End Get
        Set(value As String)
            ViewState("pReportID") = value
        End Set
    End Property

    Public Property DataSources As List(Of DataTable)
        Get
            Return ViewState("DataSources")
        End Get
        Set(value As List(Of DataTable))
            ViewState("DataSources") = value
        End Set
    End Property

    <DefaultValue(True)> Public Property pSeparatePages() As Boolean
        Get
            If ViewState("pSeparatePages") Is Nothing Then
                Return True
            Else
                Return ViewState("pSeparatePages")
            End If
        End Get
        Set(value As Boolean)
            ViewState("pSeparatePages") = value
        End Set
    End Property
    'Added by Abdul kareem 04/01/2019

    <DefaultValue(True)> Public Property pHasExportButton() As Boolean
        Get
            If ViewState("pHasExportButton") Is Nothing Then
                Return True
            Else
                Return ViewState("pHasExportButton")
            End If
        End Get
        Set(value As Boolean)
            ViewState("pHasExportButton") = value
        End Set
    End Property
    <DefaultValue(True)> Public Property pHasPrintButton() As Boolean
        Get
            If ViewState("pHasPrintButton") Is Nothing Then
                Return True
            Else
                Return ViewState("pHasPrintButton")
            End If
        End Get
        Set(value As Boolean)
            ViewState("pHasPrintButton") = value
        End Set
    End Property
    '-------------END---------

    Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        '''  rptViewer.PrintMode = Web.PrintMode.ActiveX
        If IsPostBack Then

            If Session(pReportID) IsNot Nothing Then
                If Not ViewState("dtAbsent") Is Nothing Then
                    ' LoadReport2(ViewState("dtAbsent"))
                Else
                    LoadReport()
                End If

            End If
        End If
    End Sub

    Public Sub LoadReport()
        'ViewState("ReportID") = pReportID
        Dim dtRpt As New DataTable
        Dim dsRpt As New DataSet

        'If Session(pReportID) IsNot Nothing Then
        '    dtRpt = Session(pReportID)
        'Else
        If pViewQuery <> "" Then
            dtRpt = GetTable(pViewQuery)
        Else
            dtRpt = pReportTable
        End If
        'End If


        If pReportDataSet IsNot Nothing Then
            dsRpt = pReportDataSet
        End If

        If dtRpt IsNot Nothing AndAlso (dtRpt.Rows.Count > 0 Or dsRpt.Tables.Count > 0) Then
            'Dim rptDoc As New ReportDocument
            rptDoc = New ReportDocument
            dtRpt.TableName = "Crystal Report Example"
            rptDoc.Load(Server.MapPath(pViewReport))
            'rptDoc.SetDataSource(dtRpt)

            If dsRpt.Tables.Count > 0 Then
                rptDoc.SetDataSource(dsRpt.Tables(0))
                'Session(pReportID) = dsRpt.Tables(0)
            Else
                rptDoc.SetDataSource(dtRpt)
                'Session(pReportID) = dtRpt
            End If

            rptDoc.SummaryInfo.ReportTitle = pReportTitle
            rptDoc.SummaryInfo.ReportComments = pReportComment
            rptViewer.SeparatePages = pSeparatePages
            'Added by Abdul kareem 04/01/2019
            rptViewer.HasPrintButton = pHasExportButton
            rptViewer.HasExportButton = pHasExportButton
            '--------END

            rptViewer.ReportSource = rptDoc
            'Session(pReportID) = rptDoc

            'If (DataSources IsNot Nothing AndAlso rptDoc.Subreports.Count > 0) Then
            '    For i As Integer = 0 To rptDoc.Subreports.Count - 1
            '        rptDoc.Subreports(i).SetDataSource(DataSources(i))
            '    Next
            'End If

            Dim strSubReportName As String = ""
            If (dsRpt.Tables.Count > 0 AndAlso rptDoc.Subreports.Count > 0) Then
                For i As Integer = 0 To rptDoc.Subreports.Count - 1
                    If pSubReportTable.Rows.Count > 0 Then

                        strSubReportName = rptDoc.Subreports(i).Name.ToString()

                        For Each dRow As DataRow In pSubReportTable.Rows
                            If strSubReportName = dRow("SubReportName").ToString Then
                                rptDoc.Subreports(i).SetDataSource(dsRpt.Tables(CInt(dRow("SubReportTable").ToString())))
                            End If
                        Next
                    Else
                        rptDoc.Subreports(i).SetDataSource(dsRpt.Tables(i + 1))
                    End If
                Next
            End If



            rptViewer.DataBind()
            rptViewer.RefreshReport()
            ''' rptViewer.PrintMode = Web.PrintMode.ActiveX
            Session(pReportID) = pReportID
        Else
            rptViewer.ReportSource = Nothing
            rptViewer.RefreshReport()
            ShowPopUpMsg(Me.Page, "No Record(s).")
        End If
    End Sub

    'Public Sub PrintReport()
    '    ViewState("ReportID") = pReportID
    '    Dim dtRpt As New DataTable
    '    If pViewQuery <> "" Then
    '        dtRpt = clsGenClass.GetTable(pViewQuery)
    '    Else
    '        If (pReportTable Is Nothing) Then
    '            dtRpt = ViewState("dtAbsent")
    '        Else
    '            dtRpt = pReportTable
    '        End If
    '    End If

    '    If dtRpt.Rows.Count > 0 Then
    '        'Dim rptDoc As New ReportDocument
    '        rptDoc = New ReportDocument
    '        dtRpt.TableName = "Crystal Report Example"
    '        rptDoc.Load(Server.MapPath(pViewReport))
    '        rptDoc.SetDataSource(dtRpt)
    '        rptDoc.SummaryInfo.ReportTitle = pReportTitle
    '        rptDoc.SummaryInfo.ReportComments = pReportComment
    '        ' rptDoc.PrintOptions.PrinterName = "HP Color LaserJet CP1510 Series PCL6 Class Driver-IT"
    '        'rptDoc.PrintOptions.PrinterName = GetDefaultPrinter()
    '        rptDoc.PrintToPrinter(1, True, 0, 0)
    '        'rptDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, False, "~\ImageStorage\" & Guid.NewGuid.ToString & ".pdf")
    '        'rptDoc.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "~\ReportStorage\" & Guid.NewGuid.ToString & ".pdf")

    '    Else
    '            clsGenClass.ShowPopUpMsg(Me.Page, "No Record(s).")
    '    End If
    'End Sub

    Private Function GetDefaultPrinter() As String
        Dim settings As PrinterSettings = New PrinterSettings()
        For Each printer As String In PrinterSettings.InstalledPrinters
            settings.PrinterName = printer
            If settings.IsDefaultPrinter Then
                Return printer
            End If
        Next
        Return String.Empty
    End Function

    Protected Sub btnPrint_Click(sender As Object, e As EventArgs)
        '' PrintReport()
    End Sub

    Private Sub ucReportViewerC_Init(sender As Object, e As EventArgs) Handles Me.Init
        'rptViewer.PrintMode = Web.PrintMode.ActiveX
        'If IsPostBack Then
        '    'added by ztp10122017; dispose report to clean memory
        '    rptDoc.Close()
        '    rptDoc.Dispose()
        '    pReportID = ViewState("ReportID")
        '    If Session(pReportID) IsNot Nothing Then
        '        rptViewer.ReportSource = Session(pReportID)
        '    End If
        'End If
    End Sub

    'Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
    '    Dim report1 As CrystalReport1 = New CrystalReport1()
    '    Dim dialog1 As PrintDialog = New PrintDialog()

    '    report1.SetDatabaseLogon("username", "password")

    '    dialog1.AllowSomePages = True
    '    dialog1.AllowPrintToFile = False


    '    If dialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
    '        Dim copies As Integer = dialog1.PrinterSettings.Copies
    '        Dim fromPage As Integer = dialog1.PrinterSettings.FromPage
    '        Dim toPage As Integer = dialog1.PrinterSettings.ToPage
    '        Dim collate As Boolean = dialog1.PrinterSettings.Collate

    '        report1.PrintOptions.PrinterName = dialog1.PrinterSettings.PrinterName
    '        report1.PrintToPrinter(copies, collate, fromPage, toPage)
    '    End If

    '    report1.Dispose()
    '    dialog1.Dispose()
    'End Sub

    '''Public Sub LoadReport2(ByVal dt As DataTable)                       '====================created by ali 03/07/2018======================='
    '''    'ViewState("ReportID") = pReportID
    '''    Dim dtRpt As New DataTable
    '''    Dim dsRpt As New DataSet
    '''    ViewState("dtAbsent") = dt
    '''    'If Session(pReportID) IsNot Nothing Then
    '''    '    dtRpt = Session(pReportID)
    '''    'Else

    '''    dtRpt = dt
    '''    'If dt.Rows.Count > 0 Then
    '''    '    dtRpt = dt
    '''    'Else
    '''    '    dtRpt = pReportTable
    '''    'End If
    '''    'End If


    '''    If pReportDataSet IsNot Nothing Then
    '''        dsRpt = pReportDataSet
    '''    End If

    '''    If dtRpt.Rows.Count > 0 Or dsRpt.Tables.Count > 0 Then
    '''        'Dim rptDoc As New ReportDocument
    '''        rptDoc = New ReportDocument
    '''        dtRpt.TableName = "Crystal Report Example"
    '''        rptDoc.Load(Server.MapPath(pViewReport))
    '''        'rptDoc.SetDataSource(dtRpt)

    '''        If dsRpt.Tables.Count > 0 Then
    '''            rptDoc.SetDataSource(dsRpt.Tables(0))
    '''            'Session(pReportID) = dsRpt.Tables(0)
    '''        Else
    '''            rptDoc.SetDataSource(dtRpt)
    '''            'Session(pReportID) = dtRpt
    '''        End If

    '''        rptDoc.SummaryInfo.ReportTitle = pReportTitle
    '''        rptDoc.SummaryInfo.ReportComments = pReportComment
    '''        rptViewer.SeparatePages = pSeparatePages
    '''        rptViewer.ReportSource = rptDoc
    '''        'Session(pReportID) = rptDoc

    '''        'If (DataSources IsNot Nothing AndAlso rptDoc.Subreports.Count > 0) Then
    '''        '    For i As Integer = 0 To rptDoc.Subreports.Count - 1
    '''        '        rptDoc.Subreports(i).SetDataSource(DataSources(i))
    '''        '    Next
    '''        'End If

    '''        Dim strSubReportName As String = ""
    '''        If (dsRpt.Tables.Count > 0 AndAlso rptDoc.Subreports.Count > 0) Then
    '''            For i As Integer = 0 To rptDoc.Subreports.Count - 1
    '''                If pSubReportTable.Rows.Count > 0 Then

    '''                    strSubReportName = rptDoc.Subreports(i).Name.ToString()

    '''                    For Each dRow As DataRow In pSubReportTable.Rows
    '''                        If strSubReportName = dRow("SubReportName").ToString Then
    '''                            rptDoc.Subreports(i).SetDataSource(dsRpt.Tables(CInt(dRow("SubReportTable").ToString())))
    '''                        End If
    '''                    Next
    '''                Else
    '''                    rptDoc.Subreports(i).SetDataSource(dsRpt.Tables(i + 1))
    '''                End If
    '''            Next
    '''        End If

    '''        rptViewer.DataBind()
    '''        rptViewer.RefreshReport()
    '''        rptViewer.PrintMode = Web.PrintMode.ActiveX
    '''        Session(pReportID) = pReportID
    '''    Else
    '''        rptViewer.ReportSource = Nothing
    '''        rptViewer.RefreshReport()
    '''        clsGenClass.ShowPopUpMsg(Me.Page, "No Record(s).")
    '''    End If
    '''End Sub

    'Private Sub rptViewer_Unload(sender As Object, e As EventArgs) Handles rptViewer.Unload
    '    If rptDoc.IsLoaded Then
    '        rptDoc.Dispose()
    '        rptDoc.Close()
    '    End If
    '    rptViewer.Dispose()
    'End Sub
End Class

Contents of DailyReport.aspx:

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="DailyReport.aspx.vb" Inherits="EnjazVB.DailyReport1" %>
<%@ Register Src="~/RPT/Controls/ucDailyReport.ascx" TagPrefix="uc1" TagName="ucDailyReport" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <uc1:ucDailyReport runat="server" id="ucDailyReport" />
</asp:Content>

Contents of DailyReport.aspx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class DailyReport1

    '''<summary>
    '''ucDailyReport control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucDailyReport As Global.EnjazVB.ucDailyReport
End Class

Contents of DailyReport.aspx.vb:

Public Class DailyReport1
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

End Class

Contents of EmpRequests.aspx:

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="EmpRequests.aspx.vb" Inherits="EnjazVB.EmpRequests" %>
<%@ Register Src="~/RPT/Controls/ucEmpRequest.ascx" TagPrefix="uc1" TagName="ucEmpRequest" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <uc1:ucEmpRequest runat="server" id="ucEmpRequest" />
</asp:Content>

Contents of EmpRequests.aspx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class EmpRequests

    '''<summary>
    '''ucEmpRequest control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucEmpRequest As Global.EnjazVB.ucEmpRequest
End Class

Contents of EmpRequests.aspx.vb:

Public Class EmpRequests
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

End Class

Contents of MainReport.aspx:

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="MainReport.aspx.vb" Inherits="EnjazVB.MainReport1" %>
<%@ Register Src="~/RPT/Controls/ucMainReport.ascx" TagPrefix="uc1" TagName="ucMainReport" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <uc1:ucMainReport runat="server" id="ucMainReport" />
</asp:Content>

Contents of MainReport.aspx.designer.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class MainReport1
    
    '''<summary>
    '''ucMainReport control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ucMainReport As Global.EnjazVB.ucMainReport
End Class

Contents of MainReport.aspx.vb:

Public Class MainReport1
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

End Class

Contents of DailyReport.rdlc:

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <Body>
    <ReportItems>
      <Tablix Name="Tablix1">
        <TablixBody>
          <TablixColumns>
            <TablixColumn>
              <Width>1.375in</Width>
            </TablixColumn>
            <TablixColumn>
              <Width>3.41541in</Width>
            </TablixColumn>
            <TablixColumn>
              <Width>0.96875in</Width>
            </TablixColumn>
          </TablixColumns>
          <TablixRows>
            <TablixRow>
              <Height>0.25in</Height>
              <TablixCells>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox7">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>عدد الطلبات </Value>
                              <Style>
                                <FontSize>11pt</FontSize>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox7</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>DimGray</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                    <rd:Selected>true</rd:Selected>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox19">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>الموظف </Value>
                              <Style>
                                <FontSize>11pt</FontSize>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox19</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>DimGray</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox6">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>تسلسل</Value>
                              <Style>
                                <FontSize>11pt</FontSize>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox6</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>DimGray</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
              </TablixCells>
            </TablixRow>
            <TablixRow>
              <Height>0.25in</Height>
              <TablixCells>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="WL_COUNT">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Fields!WL_COUNT.Value</Value>
                              <Style />
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>WL_COUNT</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>=iif(RowNumber(Nothing) Mod 2, "LightGrey", "Transparent")</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="EMP_NAME">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Fields!EMP_NAME.Value</Value>
                              <Style />
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>EMP_NAME</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>=iif(RowNumber(Nothing) Mod 2, "LightGrey", "Transparent")</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox10">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=RowNumber(Nothing)</Value>
                              <Style />
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox10</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>=iif(RowNumber(Nothing) Mod 2, "LightGrey", "Transparent")</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
              </TablixCells>
            </TablixRow>
          </TablixRows>
        </TablixBody>
        <TablixColumnHierarchy>
          <TablixMembers>
            <TablixMember>
              <KeepTogether>true</KeepTogether>
            </TablixMember>
            <TablixMember />
            <TablixMember />
          </TablixMembers>
        </TablixColumnHierarchy>
        <TablixRowHierarchy>
          <TablixMembers>
            <TablixMember>
              <KeepWithGroup>After</KeepWithGroup>
              <RepeatOnNewPage>true</RepeatOnNewPage>
            </TablixMember>
            <TablixMember>
              <Group Name="Details" />
            </TablixMember>
          </TablixMembers>
        </TablixRowHierarchy>
        <DataSetName>DataSet1</DataSetName>
        <Top>0.01389in</Top>
        <Height>0.5in</Height>
        <Width>5.75916in</Width>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
        </Style>
      </Tablix>
    </ReportItems>
    <Height>0.66667in</Height>
    <Style />
  </Body>
  <Width>5.80209in</Width>
  <Page>
    <PageHeader>
      <Height>0.80083in</Height>
      <PrintOnFirstPage>true</PrintOnFirstPage>
      <PrintOnLastPage>true</PrintOnLastPage>
      <ReportItems>
        <Textbox Name="Textbox1">
          <CanGrow>true</CanGrow>
          <KeepTogether>true</KeepTogether>
          <Paragraphs>
            <Paragraph>
              <TextRuns>
                <TextRun>
                  <Value>التقرير اليومي لتحديث الطلبات </Value>
                  <Style>
                    <FontSize>14pt</FontSize>
                    <FontWeight>Bold</FontWeight>
                  </Style>
                </TextRun>
              </TextRuns>
              <Style>
                <TextAlign>Center</TextAlign>
              </Style>
            </Paragraph>
          </Paragraphs>
          <rd:DefaultName>Textbox1</rd:DefaultName>
          <Top>0.10417in</Top>
          <Left>1.375in</Left>
          <Height>0.29167in</Height>
          <Width>3.58208in</Width>
          <Style>
            <Border>
              <Style>None</Style>
            </Border>
            <PaddingLeft>2pt</PaddingLeft>
            <PaddingRight>2pt</PaddingRight>
            <PaddingTop>2pt</PaddingTop>
            <PaddingBottom>2pt</PaddingBottom>
          </Style>
        </Textbox>
        <Textbox Name="Textbox2">
          <CanGrow>true</CanGrow>
          <KeepTogether>true</KeepTogether>
          <Paragraphs>
            <Paragraph>
              <TextRuns>
                <TextRun>
                  <Value>=IIF(First(Fields!CLOSED_DATE.Value, "DataSet1")="","",":تاريخ التحديث")</Value>
                  <Style>
                    <FontWeight>Bold</FontWeight>
                  </Style>
                </TextRun>
              </TextRuns>
              <Style />
            </Paragraph>
          </Paragraphs>
          <rd:DefaultName>Textbox2</rd:DefaultName>
          <Top>0.45139in</Top>
          <Left>3.28in</Left>
          <Height>0.25in</Height>
          <Width>1.27084in</Width>
          <ZIndex>1</ZIndex>
          <Style>
            <Border>
              <Style>None</Style>
            </Border>
            <PaddingLeft>2pt</PaddingLeft>
            <PaddingRight>2pt</PaddingRight>
            <PaddingTop>2pt</PaddingTop>
            <PaddingBottom>2pt</PaddingBottom>
          </Style>
        </Textbox>
        <Textbox Name="CLOSED_DATE">
          <CanGrow>true</CanGrow>
          <KeepTogether>true</KeepTogether>
          <Paragraphs>
            <Paragraph>
              <TextRuns>
                <TextRun>
                  <Value>=First(Fields!CLOSED_DATE.Value, "DataSet1")</Value>
                  <Style>
                    <FontWeight>Bold</FontWeight>
                  </Style>
                </TextRun>
              </TextRuns>
              <Style />
            </Paragraph>
          </Paragraphs>
          <rd:DefaultName>CLOSED_DATE</rd:DefaultName>
          <Top>0.43751in</Top>
          <Left>2.33208in</Left>
          <Height>0.27777in</Height>
          <Width>0.90625in</Width>
          <ZIndex>2</ZIndex>
          <Style>
            <Border>
              <Style>None</Style>
            </Border>
            <PaddingLeft>2pt</PaddingLeft>
            <PaddingRight>2pt</PaddingRight>
            <PaddingTop>2pt</PaddingTop>
            <PaddingBottom>2pt</PaddingBottom>
          </Style>
        </Textbox>
      </ReportItems>
      <Style>
        <Border>
          <Style>None</Style>
        </Border>
      </Style>
    </PageHeader>
    <PageFooter>
      <Height>0.01042in</Height>
      <PrintOnFirstPage>true</PrintOnFirstPage>
      <PrintOnLastPage>true</PrintOnLastPage>
      <Style>
        <Border>
          <Style>None</Style>
        </Border>
      </Style>
    </PageFooter>
    <LeftMargin>3.5cm</LeftMargin>
    <RightMargin>0.5cm</RightMargin>
    <TopMargin>2cm</TopMargin>
    <BottomMargin>2cm</BottomMargin>
    <Style />
  </Page>
  <AutoRefresh>0</AutoRefresh>
  <DataSources>
    <DataSource Name="MainDataSet">
      <ConnectionProperties>
        <DataProvider>System.Data.DataSet</DataProvider>
        <ConnectString>/* Local Connection */</ConnectString>
      </ConnectionProperties>
      <rd:DataSourceID>1575d1c2-29a6-4421-b4f7-b888e88259dd</rd:DataSourceID>
    </DataSource>
  </DataSources>
  <DataSets>
    <DataSet Name="DataSet1">
      <Query>
        <DataSourceName>MainDataSet</DataSourceName>
        <CommandText>/* Local Query */</CommandText>
      </Query>
      <Fields>
        <Field Name="EMP_NAME">
          <DataField>EMP_NAME</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="WL_COUNT">
          <DataField>WL_COUNT</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="CLOSED_DATE">
          <DataField>CLOSED_DATE</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
      </Fields>
      <rd:DataSetInfo>
        <rd:DataSetName>MainDataSet</rd:DataSetName>
        <rd:SchemaPath>F:\systems\EnjazVB\EnjazVB\app_data\MainDataSet.xsd</rd:SchemaPath>
        <rd:TableName>DailyReport</rd:TableName>
        <rd:TableAdapterFillMethod />
        <rd:TableAdapterGetDataMethod />
        <rd:TableAdapterName />
      </rd:DataSetInfo>
    </DataSet>
  </DataSets>
  <rd:ReportUnitType>Inch</rd:ReportUnitType>
  <rd:ReportID>f8a5d115-1512-4685-830e-e442c1588297</rd:ReportID>
</Report>

Contents of DailyReport.rpt:

Contents of DailyReport.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:4.0.30319.42000
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Shared
Imports System
Imports System.ComponentModel


Public Class DailyReport
    Inherits ReportClass

    Public Sub New()
        MyBase.New
    End Sub

    Public Overrides Property ResourceName() As String
        Get
            Return "DailyReport.rpt"
        End Get
        Set
            'Do nothing
        End Set
    End Property

    Public Overrides Property NewGenerator() As Boolean
        Get
            Return True
        End Get
        Set
            'Do nothing
        End Set
    End Property

    Public Overrides Property FullResourceName() As String
        Get
            Return "EnjazVB.DailyReport.rpt"
        End Get
        Set
            'Do nothing
        End Set
    End Property

    <Browsable(False),
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property Section1() As CrystalDecisions.CrystalReports.Engine.Section
        Get
            Return Me.ReportDefinition.Sections(0)
        End Get
    End Property

    <Browsable(False),
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property Section2() As CrystalDecisions.CrystalReports.Engine.Section
        Get
            Return Me.ReportDefinition.Sections(1)
        End Get
    End Property

    <Browsable(False),
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property Section3() As CrystalDecisions.CrystalReports.Engine.Section
        Get
            Return Me.ReportDefinition.Sections(2)
        End Get
    End Property

    <Browsable(False),
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property Section4() As CrystalDecisions.CrystalReports.Engine.Section
        Get
            Return Me.ReportDefinition.Sections(3)
        End Get
    End Property

    <Browsable(False),
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property Section5() As CrystalDecisions.CrystalReports.Engine.Section
        Get
            Return Me.ReportDefinition.Sections(4)
        End Get
    End Property
End Class

<System.Drawing.ToolboxBitmapAttribute(GetType(CrystalDecisions.[Shared].ExportOptions), "report.bmp")>
Public Class CachedDailyReport
    Inherits Component
    Implements ICachedReport

    Public Sub New()
        MyBase.New
    End Sub

    <Browsable(False),
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>
    Public Overridable Property IsCacheable() As Boolean Implements CrystalDecisions.ReportSource.ICachedReport.IsCacheable
        Get
            Return True
        End Get
        Set
            '
        End Set
    End Property

    <Browsable(False),
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>
    Public Overridable Property ShareDBLogonInfo() As Boolean Implements CrystalDecisions.ReportSource.ICachedReport.ShareDBLogonInfo
        Get
            Return False
        End Get
        Set
            '
        End Set
    End Property

    <Browsable(False),
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>
    Public Overridable Property CacheTimeOut() As System.TimeSpan Implements CrystalDecisions.ReportSource.ICachedReport.CacheTimeOut
        Get
            Return CachedReportConstants.DEFAULT_TIMEOUT
        End Get
        Set
            '
        End Set
    End Property

    Public Overridable Function CreateReport() As CrystalDecisions.CrystalReports.Engine.ReportDocument Implements CrystalDecisions.ReportSource.ICachedReport.CreateReport
        Dim rpt As mainReport = New mainReport()
        rpt.Site = Me.Site
        Return rpt
    End Function

    Public Overridable Function GetCustomizedCacheKey(ByVal request As RequestContext) As String Implements CrystalDecisions.ReportSource.ICachedReport.GetCustomizedCacheKey
        Dim key As [String] = Nothing
        '// The following is the code used to generate the default
        '// cache key for caching report jobs in the ASP.NET Cache.
        '// Feel free to modify this code to suit your needs.
        '// Returning key == null causes the default cache key to
        '// be generated.
        '
        'key = RequestContext.BuildCompleteCacheKey(
        '    request,
        '    null,       // sReportFilename
        '    this.GetType(),
        '    this.ShareDBLogonInfo );
        Return key
    End Function
End Class

Contents of EmpRequests.rdlc:

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <Body>
    <ReportItems>
      <Tablix Name="Tablix1">
        <TablixBody>
          <TablixColumns>
            <TablixColumn>
              <Width>1in</Width>
            </TablixColumn>
            <TablixColumn>
              <Width>0.83333in</Width>
            </TablixColumn>
            <TablixColumn>
              <Width>0.70833in</Width>
            </TablixColumn>
            <TablixColumn>
              <Width>0.79167in</Width>
            </TablixColumn>
            <TablixColumn>
              <Width>1in</Width>
            </TablixColumn>
            <TablixColumn>
              <Width>0.63542in</Width>
            </TablixColumn>
            <TablixColumn>
              <Width>2in</Width>
            </TablixColumn>
          </TablixColumns>
          <TablixRows>
            <TablixRow>
              <Height>0.25in</Height>
              <TablixCells>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox1">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>الاجمالي</Value>
                              <Style>
                                <FontSize>12pt</FontSize>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox1</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>DimGray</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox3">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>ملغية</Value>
                              <Style>
                                <FontSize>12pt</FontSize>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox3</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>DimGray</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox5">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>مؤجلة</Value>
                              <Style>
                                <FontSize>12pt</FontSize>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox5</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>DimGray</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox13">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>تحت الاجراء</Value>
                              <Style>
                                <FontSize>12pt</FontSize>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox13</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>DimGray</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox4">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>طلبات مرفوعة</Value>
                              <Style>
                                <FontSize>12pt</FontSize>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox4</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>DimGray</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox11">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>إفراغ</Value>
                              <Style>
                                <FontSize>12pt</FontSize>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox11</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>DimGray</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox9">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>الاسم</Value>
                              <Style>
                                <FontSize>12pt</FontSize>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox9</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>DimGray</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
              </TablixCells>
            </TablixRow>
            <TablixRow>
              <Height>0.25in</Height>
              <TablixCells>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Total">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Fields!Total.Value</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Total</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>=iif(RowNumber(Nothing) Mod 2, "LightGrey", "Transparent")</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Cancelled">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Fields!Cancelled.Value</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Cancelled</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>=iif(RowNumber(Nothing) Mod 2, "LightGrey", "Transparent")</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Pending">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Fields!Pending.Value</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Pending</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>=iif(RowNumber(Nothing) Mod 2, "LightGrey", "Transparent")</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="OPEN_">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Fields!OPEN_.Value</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>OPEN_</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>=iif(RowNumber(Nothing) Mod 2, "LightGrey", "Transparent")</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Uploaded">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Fields!Uploaded.Value</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Uploaded</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>=iif(RowNumber(Nothing) Mod 2, "LightGrey", "Transparent")</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Closed">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Fields!Closed.Value</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Closed</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>=iif(RowNumber(Nothing) Mod 2, "LightGrey", "Transparent")</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="EMP_NAME">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Fields!EMP_NAME.Value</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>EMP_NAME</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>=iif(RowNumber(Nothing) Mod 2, "LightGrey", "Transparent")</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
              </TablixCells>
            </TablixRow>
            <TablixRow>
              <Height>0.25in</Height>
              <TablixCells>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox15">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value />
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox15</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                    <ColSpan>7</ColSpan>
                  </CellContents>
                </TablixCell>
                <TablixCell />
                <TablixCell />
                <TablixCell />
                <TablixCell />
                <TablixCell />
                <TablixCell />
              </TablixCells>
            </TablixRow>
            <TablixRow>
              <Height>0.25in</Height>
              <TablixCells>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox21">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Sum(Fields!Total.Value)</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox21</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>LightGrey</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox22">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Sum(Fields!Cancelled.Value)</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox22</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>LightGrey</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox27">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Sum(Fields!Pending.Value)</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox27</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>LightGrey</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox28">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Sum(Fields!OPEN_.Value)</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox28</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>LightGrey</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox7">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Sum(Fields!Uploaded.Value)</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox7</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>LightGrey</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                    <rd:Selected>true</rd:Selected>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox29">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>=Sum(Fields!Closed.Value)</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox29</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>LightGrey</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
                <TablixCell>
                  <CellContents>
                    <Textbox Name="Textbox30">
                      <CanGrow>true</CanGrow>
                      <KeepTogether>true</KeepTogether>
                      <Paragraphs>
                        <Paragraph>
                          <TextRuns>
                            <TextRun>
                              <Value>الاجمالي</Value>
                              <Style>
                                <FontWeight>Bold</FontWeight>
                              </Style>
                            </TextRun>
                          </TextRuns>
                          <Style>
                            <TextAlign>Right</TextAlign>
                          </Style>
                        </Paragraph>
                      </Paragraphs>
                      <rd:DefaultName>Textbox30</rd:DefaultName>
                      <Style>
                        <Border>
                          <Color>LightGrey</Color>
                          <Style>Solid</Style>
                        </Border>
                        <BackgroundColor>LightGrey</BackgroundColor>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                    </Textbox>
                  </CellContents>
                </TablixCell>
              </TablixCells>
            </TablixRow>
          </TablixRows>
        </TablixBody>
        <TablixColumnHierarchy>
          <TablixMembers>
            <TablixMember />
            <TablixMember />
            <TablixMember />
            <TablixMember />
            <TablixMember />
            <TablixMember />
            <TablixMember />
          </TablixMembers>
        </TablixColumnHierarchy>
        <TablixRowHierarchy>
          <TablixMembers>
            <TablixMember>
              <KeepWithGroup>After</KeepWithGroup>
            </TablixMember>
            <TablixMember>
              <Group Name="Details" />
            </TablixMember>
            <TablixMember>
              <KeepWithGroup>Before</KeepWithGroup>
            </TablixMember>
            <TablixMember>
              <KeepWithGroup>Before</KeepWithGroup>
            </TablixMember>
          </TablixMembers>
        </TablixRowHierarchy>
        <DataSetName>DataSet1</DataSetName>
        <Height>1in</Height>
        <Width>6.96875in</Width>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
        </Style>
      </Tablix>
    </ReportItems>
    <Height>1.02083in</Height>
    <Style />
  </Body>
  <Width>6.96875in</Width>
  <Page>
    <PageHeader>
      <Height>0.59375in</Height>
      <PrintOnFirstPage>true</PrintOnFirstPage>
      <PrintOnLastPage>true</PrintOnLastPage>
      <ReportItems>
        <Textbox Name="Textbox2">
          <CanGrow>true</CanGrow>
          <KeepTogether>true</KeepTogether>
          <Paragraphs>
            <Paragraph>
              <TextRuns>
                <TextRun>
                  <Value>تقرير طلبات الموظفين</Value>
                  <Style>
                    <FontSize>14pt</FontSize>
                    <FontWeight>Bold</FontWeight>
                  </Style>
                </TextRun>
              </TextRuns>
              <Style>
                <TextAlign>Center</TextAlign>
              </Style>
            </Paragraph>
          </Paragraphs>
          <rd:DefaultName>Textbox1</rd:DefaultName>
          <Top>0.18229in</Top>
          <Left>1.19854in</Left>
          <Height>0.29167in</Height>
          <Width>3.58208in</Width>
          <Style>
            <Border>
              <Style>None</Style>
            </Border>
            <PaddingLeft>2pt</PaddingLeft>
            <PaddingRight>2pt</PaddingRight>
            <PaddingTop>2pt</PaddingTop>
            <PaddingBottom>2pt</PaddingBottom>
          </Style>
        </Textbox>
      </ReportItems>
      <Style>
        <Border>
          <Style>None</Style>
        </Border>
      </Style>
    </PageHeader>
    <LeftMargin>1.2in</LeftMargin>
    <RightMargin>1in</RightMargin>
    <TopMargin>1in</TopMargin>
    <BottomMargin>1in</BottomMargin>
    <Style />
  </Page>
  <AutoRefresh>0</AutoRefresh>
  <DataSources>
    <DataSource Name="MainDataSet">
      <ConnectionProperties>
        <DataProvider>System.Data.DataSet</DataProvider>
        <ConnectString>/* Local Connection */</ConnectString>
      </ConnectionProperties>
      <rd:DataSourceID>c280922a-82c7-4a41-abed-051079f47eb3</rd:DataSourceID>
    </DataSource>
  </DataSources>
  <DataSets>
    <DataSet Name="DataSet1">
      <Query>
        <DataSourceName>MainDataSet</DataSourceName>
        <CommandText>/* Local Query */</CommandText>
      </Query>
      <Fields>
        <Field Name="EMP_NAME">
          <DataField>EMP_NAME</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="Closed">
          <DataField>Closed</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="OPEN_">
          <DataField>OPEN_</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="Pending">
          <DataField>Pending</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="Cancelled">
          <DataField>Cancelled</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="Total">
          <DataField>Total</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="Uploaded">
          <DataField>Uploaded</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
      </Fields>
      <rd:DataSetInfo>
        <rd:DataSetName>MainDataSet</rd:DataSetName>
        <rd:SchemaPath>F:\systems\EnjazVB\EnjazVB\app_data\MainDataSet.xsd</rd:SchemaPath>
        <rd:TableName>EmpRequests</rd:TableName>
        <rd:TableAdapterFillMethod />
        <rd:TableAdapterGetDataMethod />
        <rd:TableAdapterName />
      </rd:DataSetInfo>
    </DataSet>
  </DataSets>
  <rd:ReportUnitType>Inch</rd:ReportUnitType>
  <rd:ReportID>72ec26e1-218f-48bc-8ce6-737bb242314e</rd:ReportID>
</Report>

Contents of mainReport.rpt:

Contents of mainReport.vb:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:4.0.30319.42000
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Shared
Imports System
Imports System.ComponentModel


Public Class mainReport
    Inherits ReportClass
    
    Public Sub New()
        MyBase.New
    End Sub
    
    Public Overrides Property ResourceName() As String
        Get
            Return "mainReport.rpt"
        End Get
        Set
            'Do nothing
        End Set
    End Property
    
    Public Overrides Property NewGenerator() As Boolean
        Get
            Return true
        End Get
        Set
            'Do nothing
        End Set
    End Property
    
    Public Overrides Property FullResourceName() As String
        Get
            Return "EnjazVB.mainReport.rpt"
        End Get
        Set
            'Do nothing
        End Set
    End Property
    
    <Browsable(false),  _
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>  _
    Public ReadOnly Property Section1() As CrystalDecisions.CrystalReports.Engine.Section
        Get
            Return Me.ReportDefinition.Sections(0)
        End Get
    End Property
    
    <Browsable(false),  _
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>  _
    Public ReadOnly Property Section2() As CrystalDecisions.CrystalReports.Engine.Section
        Get
            Return Me.ReportDefinition.Sections(1)
        End Get
    End Property
    
    <Browsable(false),  _
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>  _
    Public ReadOnly Property Section3() As CrystalDecisions.CrystalReports.Engine.Section
        Get
            Return Me.ReportDefinition.Sections(2)
        End Get
    End Property
    
    <Browsable(false),  _
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>  _
    Public ReadOnly Property Section4() As CrystalDecisions.CrystalReports.Engine.Section
        Get
            Return Me.ReportDefinition.Sections(3)
        End Get
    End Property
    
    <Browsable(false),  _
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>  _
    Public ReadOnly Property Section5() As CrystalDecisions.CrystalReports.Engine.Section
        Get
            Return Me.ReportDefinition.Sections(4)
        End Get
    End Property
End Class

<System.Drawing.ToolboxBitmapAttribute(GetType(CrystalDecisions.[Shared].ExportOptions), "report.bmp")>  _
Public Class CachedmainReport
    Inherits Component
    Implements ICachedReport
    
    Public Sub New()
        MyBase.New
    End Sub
    
    <Browsable(false),  _
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>  _
    Public Overridable Property IsCacheable() As Boolean Implements CrystalDecisions.ReportSource.ICachedReport.IsCacheable
        Get
            Return true
        End Get
        Set
            '
        End Set
    End Property
    
    <Browsable(false),  _
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>  _
    Public Overridable Property ShareDBLogonInfo() As Boolean Implements CrystalDecisions.ReportSource.ICachedReport.ShareDBLogonInfo
        Get
            Return false
        End Get
        Set
            '
        End Set
    End Property
    
    <Browsable(false),  _
     DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>  _
    Public Overridable Property CacheTimeOut() As System.TimeSpan Implements CrystalDecisions.ReportSource.ICachedReport.CacheTimeOut
        Get
            Return CachedReportConstants.DEFAULT_TIMEOUT
        End Get
        Set
            '
        End Set
    End Property
    
    Public Overridable Function CreateReport() As CrystalDecisions.CrystalReports.Engine.ReportDocument Implements CrystalDecisions.ReportSource.ICachedReport.CreateReport
        Dim rpt As mainReport = New mainReport()
        rpt.Site = Me.Site
        Return rpt
    End Function
    
    Public Overridable Function GetCustomizedCacheKey(ByVal request As RequestContext) As String Implements CrystalDecisions.ReportSource.ICachedReport.GetCustomizedCacheKey
        Dim key As [String] = Nothing
        '// The following is the code used to generate the default
        '// cache key for caching report jobs in the ASP.NET Cache.
        '// Feel free to modify this code to suit your needs.
        '// Returning key == null causes the default cache key to
        '// be generated.
        '
        'key = RequestContext.BuildCompleteCacheKey(
        '    request,
        '    null,       // sReportFilename
        '    this.GetType(),
        '    this.ShareDBLogonInfo );
        Return key
    End Function
End Class

Directories zipped successfully.
Download ZIP file