void GetUserUploadedFilesList()
    {
        SqlConnection con = new SqlConnection(constr);

        con.Open();
        SqlCommand cmd = new SqlCommand("select  UploadFileName_WithExt \"Original filename\", UploadedFileSize \" Size \", Category \" Category \", Mode \" Upload Mode \", UploadDateTime \" Upload Date\\Time \",SharedWith \"Shared With\" from DBFiles where UploaderUserName=@UserName", con);

        cmd.Parameters.AddWithValue("@UserName", "Sourav");
        SqlDataReader reader = cmd.ExecuteReader();

        GridViewUploadedFiles.DataSource = reader;
        GridViewUploadedFiles.DataBind();
        con.Close();
        int totalFilesNo;

        for (totalFilesNo = 0; totalFilesNo < GridViewUploadedFiles.Rows.Count; totalFilesNo++)
        {
            LinkButton linkDownload = new LinkButton();
            LinkButton linkView     = new LinkButton();

            string fullFileAddressInServerDB = "~/UploadedFiles/ServerDatabase/" + GridViewUploadedFiles.Rows[totalFilesNo].Cells[3].Text + "s/" + GridViewUploadedFiles.Rows[totalFilesNo].Cells[1].Text + ".zip";

            linkDownload = (LinkButton)GridViewUploadedFiles.Rows[totalFilesNo].FindControl("lnkbtnDownloadContent");
            linkView     = (LinkButton)GridViewUploadedFiles.Rows[totalFilesNo].FindControl("lnkbtnViewContent");

            linkDownload.CommandArgument = fullFileAddressInServerDB;
            linkView.CommandArgument     = fullFileAddressInServerDB;
        }
        lblFileDeletion.Text = "You have uploded " + totalFilesNo.ToString() + " file(s) currently in the Database";
    }
示例#2
0
    void GetUserUploadedFilesList()
    {
        if (txtSearch.Text.Trim() == "")
        {
            lblDeleteFilesWarning.Text = "Please enter a search query to search file(s)!"; return;
        }
        SqlConnection con = new SqlConnection(constr);

        con.Open();
        string     sqlQuery = "select distinct UploadedFileName_WithExt \" Original Filename \", UploadedFileSize \" Size \", Category \" Category \", UploadDateTime \" Upload Date/Time \" from DBFiles where Mode='General' and UploadedFileName like '%" + txtSearch.Text.Trim() + "%'";
        SqlCommand cmd      = new SqlCommand(sqlQuery, con);

        //Response.Write(" | txtSearch.Text.Trim() = " + txtSearch.Text.Trim() + " | sqlQuery = " + sqlQuery);

        SqlDataReader reader = cmd.ExecuteReader();

        GridViewUploadedFiles.DataSource = reader;
        GridViewUploadedFiles.DataBind();
        con.Close();
        int totalFilesNo;

        for (totalFilesNo = 0; totalFilesNo < GridViewUploadedFiles.Rows.Count; totalFilesNo++)
        {
            LinkButton linkView = new LinkButton();

            string fullFileAddressInServerDB = "~/UploadedFiles/ServerDatabase/" + GridViewUploadedFiles.Rows[totalFilesNo].Cells[3].Text + "s/" + GridViewUploadedFiles.Rows[totalFilesNo].Cells[1].Text + ".zip";
            linkView = (LinkButton)GridViewUploadedFiles.Rows[totalFilesNo].FindControl("lnkbtnViewContentUploadedFiles");
            linkView.CommandArgument = fullFileAddressInServerDB;
        }
        lblSearchResultNo.Text = totalFilesNo.ToString() + " file(s) matched your searched query in the Database";

        //Response.Write(" | GridViewUploadedFiles.Rows.Count = " + GridViewUploadedFiles.Rows.Count + " | totalFilesNo = " + totalFilesNo);

        // Check for GridView rows number
        if (GridViewUploadedFiles.Rows.Count == 0)
        {
            lblSearchResultNo.Text    = "No results matched your search query!";
            CheckBoxSelectAll.Enabled = false;
            ButtonDeleteFile.Enabled  = false;
        }
        else
        {
            CheckBoxSelectAll.Enabled = true;
            ButtonDeleteFile.Enabled  = true;
        }
    }
示例#3
0
    protected void btnSearchAllFiles_Click(object sender, EventArgs e)
    {
        if (PanelSearchAllFiles.Visible == true)
        {
            PanelSearchAllFiles.Visible = false;
        }
        else
        {
            CheckBoxSelectAll.Enabled = false;
            ButtonDeleteFile.Enabled  = false;

            GridViewUploadedFiles.DataSource = "";
            GridViewUploadedFiles.DataBind();
            lblDeleteFilesWarning.Text   = "";
            txtSearch.Text               = "";
            lblSearchResultNo.Text       = "";
            PanelCheckNewFiles.Visible   = false;
            PanelCheckNewUsers.Visible   = false;
            PanelRegisteredUser.Visible  = false;
            PanelUpdateAdminInfo.Visible = false;
            PanelSearchAllFiles.Visible  = true;
        }
        UpdatePanelUsageInfo();
    }