//Button Click Event For Submission
    protected void ReportDateRange_Click(object sender, EventArgs e)
    {
        if (this.IsPostBack)
        {
            conn.Open();

            //SQL Query to add data to fields
            SqlDataAdapter sda = new SqlDataAdapter("SELECT SubmitIssuesTable.IssueId, SubmitIssuesTable.IssueName, SubmitIssuesTable.IssueDescription, SubmitIssuesTable.IssueReporter, SubmitIssuesTable.IssueDate, ResponderTable.ResponderName, ResponderTable.ResponderDetails FROM SubmitIssuesTable INNER JOIN ResponderTable ON SubmitIssuesTable.IssueId = ResponderTable.IssueId WHERE IssueDate BETWEEN '" + ReportDateFromTextBox.Text + "' AND '" + ReportDateToTextBox.Text + "'", conn);

            //Create Dataset and GridView Table
            DataSet ds = new DataSet();
            sda.Fill(ds, "SubmitIssuesTable");
            ReportGridView.DataSource = ds.Tables["SubmitIssuesTable"];
            ReportGridView.DataBind();

            SqlCommand Countcmd = new SqlCommand
            {
                CommandText = "SELECT Count(IssueId) FROM SubmitIssuesTable",
                Connection  = conn
            };

            FlagCountTextBox.Text = Countcmd.ExecuteScalar().ToString();
            conn.Close();
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        user = (Employee)Session["User"];
        List <Employee> employees;

        if (user.IsAdmin())
        {
            employees = db.Employees.ToList();
        }
        else
        {
            employees = db.Employees.Where(emp => emp.EmployeeId == user.EmployeeId).ToList();
        }

        ReportGridView.DataSource = employees;
        ReportGridView.DataBind();

        ReportTitleLabel.Text = "Overall Employee Balance (as of " + DateTime.Today.ToShortDateString() + ")";
    }
Exemple #3
0
 private void PopulateForm(Employee employee)
 {
     ReportTitleLabel.Text     = "Employee's Detailed Report (as of " + DateTime.Today.ToShortDateString() + ")";
     ReportGridView.DataSource = employee.EmployeePTOHistories.OrderByDescending(hist => hist.EmployeePTOHistoryID);
     ReportGridView.DataBind();
 }