protected void btnStatusGenerateReport_Click(object sender, EventArgs e) { pieChartPanel.Visible = false; claimStatusPanel.Visible = true; GridClaimData.Visible = true; SqlConnection con1 = new SqlConnection(cs); using (con1) { using (cmd = new SqlCommand("select ERSClaimID,ERSApproverName,EmployeeName,ERSClaimType,(Currency+'.' + ' '+CAST(ERSBillAmount as varchar(30))) as ERSBillAmount,ERSClaimStatus from ERSClaim left join Employee on Employee.EmployeeID = ERSClaim.ERSEmployeeID left join ERSApprover on ERSClaim.ERSApproverID=ERSApprover.ERSApproverID Where ERSClaimStatus='" + ClaimStatusDropDown.SelectedValue + "'")) { SqlDataAdapter dt = new SqlDataAdapter(); try { cmd.Connection = con1; con1.Open(); dt.SelectCommand = cmd; DataTable dTable = new DataTable(); dt.Fill(dTable); SqlDataReader sdr = cmd.ExecuteReader(); GridClaimData.DataSource = dTable; GridClaimData.DataBind(); } catch (Exception ex) { // Error msg display here Response.Write(ex.Message); } } } }
private void ClaimDataGrid() { SqlConnection con = new SqlConnection(cs); using (con) { using (SqlCommand cmd = new SqlCommand("select ERSClaimID,ERSApproverID,ERSEmployeeID,ERSClaimType,(Currency+'.' + ' '+CAST(ERSBillAmount as varchar(30))) as ERSBillAmount,ERSClaimStatus,ERSClaimProcessDate from ERSClaim Where (ERSClaimDate>='" + TextBox1.Text + "'and ERSClaimDate<='" + TextBox2.Text + "') and ERSApproverID='" + Session["SessionEmployeeID"].ToString() + "' ")) { SqlDataAdapter dt = new SqlDataAdapter(); try { cmd.Connection = con; con.Open(); dt.SelectCommand = cmd; DataTable dTable = new DataTable(); dt.Fill(dTable); SqlDataReader sdr = cmd.ExecuteReader(); GridClaimData.DataSource = dTable; GridClaimData.DataBind(); //if (GridClaimData.Columns.Count > 0) //{ // GridClaimData.Columns[0].Visible = false; // GridClaimData.Columns[6].Visible = false; //} //else //{ // GridClaimData.HeaderRow.Cells[0].Visible = false; // GridClaimData.HeaderRow.Cells[6].Visible = false; // foreach (GridViewRow gvr in GridClaimData.Rows) // { // gvr.Cells[0].Visible = false; // } //} } catch (Exception ex) { // Error msg display here Response.Write(ex.Message); } } } }
protected void btnEmployeeGenerateReports_Click(object sender, EventArgs e) { pieChartPanel.Visible = false; employeePanel.Visible = true; GridClaimData.Visible = true; SqlConnection con = new SqlConnection(cs); SqlCommand cmd; using (con) { using (cmd = new SqlCommand("select ERSClaimID,ERSApproverName,EmployeeName,ERSClaimType,(Currency+'.' + ' '+CAST(ERSBillAmount as varchar(30))) as ERSBillAmount,ERSClaimStatus from ERSClaim left join Employee on Employee.EmployeeID = ERSClaim.ERSEmployeeID left join ERSApprover on ERSClaim.ERSApproverID=ERSApprover.ERSApproverID where EmployeeName='" + DropDownList2.SelectedValue + "'", con)) { SqlDataAdapter dt = new SqlDataAdapter(); try { cmd.Connection = con; con.Open(); dt.SelectCommand = cmd; DataTable dTable = new DataTable(); dt.Fill(dTable); SqlDataReader sdr = cmd.ExecuteReader(); GridClaimData.DataSource = dTable; GridClaimData.DataBind(); } catch (Exception ex) { Response.Write(ex.Message); } } if (GridClaimData.Rows.Count > 0) { GridClaimData.CssClass = "table table-bordered table-striped table-inverse nomargin"; GridClaimData.UseAccessibleHeader = true; GridClaimData.HeaderRow.TableSection = TableRowSection.TableHeader; GridClaimData.FooterRow.TableSection = TableRowSection.TableFooter; } } }
private void ClaimDataGrid2() { if (DropDownList1.SelectedIndex == 2) { SqlConnection con = new SqlConnection(cs); using (con) { using (cmd = new SqlCommand("select ERSClaimID,ERSApproverName,EmployeeName,ERSClaimType,(Currency+'.' + ' '+CAST(ERSBillAmount as varchar(30))) as ERSBillAmount,ERSClaimStatus from ERSClaim left join Employee on Employee.EmployeeID = ERSClaim.ERSEmployeeID left join ERSApprover on ERSClaim.ERSApproverID=ERSApprover.ERSApproverID Where ERSClaimDate>='" + TextBox1.Text + "'and ERSClaimDate<='" + TextBox3.Text + "'", con)) { SqlDataAdapter dt = new SqlDataAdapter(); try { cmd.Connection = con; con.Open(); dt.SelectCommand = cmd; DataTable dTable = new DataTable(); dt.Fill(dTable); SqlDataReader sdr = cmd.ExecuteReader(); GridClaimData.DataSource = dTable; GridClaimData.DataBind(); } catch (Exception ex) { // Error msg display here Response.Write(ex.Message); } } } if (GridClaimData.Rows.Count > 0) { GridClaimData.CssClass = "table table-bordered table-striped table-inverse nomargin"; GridClaimData.UseAccessibleHeader = true; GridClaimData.HeaderRow.TableSection = TableRowSection.TableHeader; GridClaimData.FooterRow.TableSection = TableRowSection.TableFooter; } } }