/// <summary>
    /// This loads the record of the selected document to be uploaded
    /// </summary>
    /// <param name="id">An integer which is the id of the selected document</param>
    public void loadSupportingDocs(int id)
    {
        LoanDSTableAdapters.SupportingDocumentsTableAdapter suppDocs = new LoanDSTableAdapters.SupportingDocumentsTableAdapter();
        LoanDS.SupportingDocumentsDataTable tblSuppDocs = suppDocs.GetSupportingDocDetails(id);

        if (tblSuppDocs.Rows.Count > 0)
        {
            txtDescription.Value = tblSuppDocs[0].datDescription.ToString();
            txtDocumentType.Value = tblSuppDocs[0].datFileName.ToString();
            //Find a way to show the uploaded Docs
            this.docView.Visible = true;
            HyperDocs.NavigateUrl = "";

            this.editskip.Value = "2";
        }
    }
    public void loadSupportingDocs(int id)
    {
        LoanDSTableAdapters.SupportingDocumentsTableAdapter suppDocs = new LoanDSTableAdapters.SupportingDocumentsTableAdapter();
        LoanDS.SupportingDocumentsDataTable tblSuppDocs = suppDocs.GetSupportingDocDetails(id);

        if (tblSuppDocs.Rows.Count > 0)
        {
            txtDescription.Value  = tblSuppDocs[0].datDescription.ToString();
            txtDocumentType.Value = tblSuppDocs[0].datFileName.ToString();
            //Find a way to show the uploaded Docs
            this.docView.Visible  = true;
            HyperDocs.NavigateUrl = "";

            this.editskip.Value = "2";
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string fileName = fuDocument.FileName;
        string targetPath = @"~\uploadDocs";
        try
        {

            string filepath = "";
            if (fuDocument.HasFile)
                // Call a helper method routine to save the file.
                filepath = SaveFile(fuDocument.PostedFile);
            else
                // Notify the user that a file was not uploaded.
                UploadStatusLabel.Text = "You did not specify a file to upload.";

            LoanDSTableAdapters.SupportingDocumentsTableAdapter tblSupportingDoc = new LoanDSTableAdapters.SupportingDocumentsTableAdapter();
            if (!(type == "update"))
            {
                


                tblSupportingDoc.InsertSupportingDocuments(MySessionManager.ClientID,
                                                           MySessionManager.AppID,
                                                           txtDocumentType.Value.Trim(),
                                                           txtDescription.Value.Trim(),
                                                           filepath,
                                                           MySessionManager.CurrentUser.UserID);
           
               
            }
            else if (type == "update")
            {
                tblSupportingDoc.UpdateSupportingDocument(txtDocumentType.Value.Trim(),
                                                          txtDescription.Value.Trim(),
                                                          filepath,
                                                          MySessionManager.CurrentUser.UserID,
                                                          id);
            
            
            }
           
        }
        catch (Exception ex) { }

      
        Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "sdedit"));
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string fileName   = fuDocument.FileName;
        string targetPath = @"~\uploadDocs";

        try
        {
            string filepath = "";
            if (fuDocument.HasFile)
            {
                // Call a helper method routine to save the file.
                filepath = SaveFile(fuDocument.PostedFile);
            }
            else
            {
                // Notify the user that a file was not uploaded.
                UploadStatusLabel.Text = "You did not specify a file to upload.";
            }

            LoanDSTableAdapters.SupportingDocumentsTableAdapter tblSupportingDoc = new LoanDSTableAdapters.SupportingDocumentsTableAdapter();
            if (!(type == "update"))
            {
                tblSupportingDoc.InsertSupportingDocuments(MySessionManager.ClientID,
                                                           MySessionManager.AppID,
                                                           txtDocumentType.Value.Trim(),
                                                           txtDescription.Value.Trim(),
                                                           filepath,
                                                           MySessionManager.CurrentUser.UserID);
            }
            else if (type == "update")
            {
                tblSupportingDoc.UpdateSupportingDocument(txtDocumentType.Value.Trim(),
                                                          txtDescription.Value.Trim(),
                                                          filepath,
                                                          MySessionManager.CurrentUser.UserID,
                                                          id);
            }
        }
        catch (Exception ex) { }


        Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "sdedit"));
    }