public virtual int Fill(CloudAccountDA.ReportTimesheetDetailsProjectDataTable dataTable, int?CompanyID, int?ProjectID, bool?Billed, DateTime?FromDate, DateTime?ToDate) { this.Adapter.SelectCommand = this.CommandCollection[0]; if (CompanyID.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = CompanyID.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } if (ProjectID.HasValue) { this.Adapter.SelectCommand.Parameters[2].Value = ProjectID.Value; } else { this.Adapter.SelectCommand.Parameters[2].Value = DBNull.Value; } if (Billed.HasValue) { this.Adapter.SelectCommand.Parameters[3].Value = Billed.Value; } else { this.Adapter.SelectCommand.Parameters[3].Value = DBNull.Value; } if (FromDate.HasValue) { this.Adapter.SelectCommand.Parameters[4].Value = FromDate.Value; } else { this.Adapter.SelectCommand.Parameters[4].Value = DBNull.Value; } if (ToDate.HasValue) { this.Adapter.SelectCommand.Parameters[5].Value = ToDate.Value; } else { this.Adapter.SelectCommand.Parameters[5].Value = DBNull.Value; } if (this.ClearBeforeFill) { dataTable.Clear(); } return(this.Adapter.Fill(dataTable)); }
private void BindGrid() { DateTime?dtFromDate = new DateTime?(); DateTime?dtToDate = new DateTime?(); bool? bBilled = new bool?(); if (this.txtDateFrom.Text.Trim().Length > 0) { dtFromDate = new DateTime?(DateTime.Parse(this.txtDateFrom.Text.Trim())); } if (this.txtDateTo.Text.Trim().Length > 0) { dtToDate = new DateTime?(DateTime.Parse(this.txtDateTo.Text.Trim())); } if (this.ddlBilled.SelectedIndex > 0) { bBilled = new bool?(bool.Parse(this.ddlBilled.SelectedItem.Value)); } if (this.ddlGroupBy.SelectedItem.Text == "Team") { int?iProjectID = new int?(); if (this.ddlProject.SelectedIndex > 0) { iProjectID = new int?(int.Parse(this.ddlProject.SelectedItem.Value)); } if (this.ddlTeam.SelectedIndex > 0) { this.objReportTimesheetDetailsTeamDT = this.objReportTimesheetDetailsTeamBll.GetData(int.Parse(this.hfCompanyID.Value), this.ddlTeam.SelectedItem.Text, iProjectID, bBilled, dtFromDate, dtToDate); Label label = new Label() { Text = this.ddlTeam.SelectedItem.Text }; label.Font.Bold = true; this.divGrids.Controls.Add((Control)label); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); GridView gridView1 = new GridView(); gridView1.DataSource = (object)this.objReportTimesheetDetailsTeamDT; gridView1.CssClass = "reportTable table table-responsive"; gridView1.Width = Unit.Percentage(100.0); gridView1.GridLines = GridLines.None; gridView1.EmptyDataText = "No Timesheet entry found"; GridView gridView2 = gridView1; gridView2.HeaderStyle.BackColor = ColorTranslator.FromHtml("#0083E0"); gridView2.HeaderStyle.ForeColor = Color.White; gridView2.DataBind(); this.divGrids.Controls.Add((Control)gridView2); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); } else { this.ddlTeam.DataBind(); foreach (ListItem listItem in this.ddlTeam.Items) { if (!string.IsNullOrEmpty(listItem.Value)) { this.objReportTimesheetDetailsTeamDT = this.objReportTimesheetDetailsTeamBll.GetData(int.Parse(this.hfCompanyID.Value), listItem.Value, iProjectID, bBilled, dtFromDate, dtToDate); Label label = new Label() { Text = listItem.Text }; label.Font.Bold = true; this.divGrids.Controls.Add((Control)label); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); GridView gridView1 = new GridView(); gridView1.DataSource = (object)this.objReportTimesheetDetailsTeamDT; gridView1.CssClass = "reportTable table table-responsive"; gridView1.Width = Unit.Percentage(100.0); gridView1.GridLines = GridLines.None; gridView1.EmptyDataText = "No Timesheet entry found"; GridView gridView2 = gridView1; gridView2.HeaderStyle.BackColor = ColorTranslator.FromHtml("#0083E0"); gridView2.HeaderStyle.ForeColor = Color.White; gridView2.DataBind(); this.divGrids.Controls.Add((Control)gridView2); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); } } } } else if (this.ddlGroupBy.SelectedItem.Text == "Client") { int?iProjectID = new int?(); if (this.ddlProject.SelectedIndex > 0) { iProjectID = new int?(int.Parse(this.ddlProject.SelectedItem.Value)); } this.ddlClient.DataBind(); foreach (ListItem listItem in this.ddlClient.Items) { if (!string.IsNullOrEmpty(listItem.Value)) { this.objReportTimesheetDetailsClientDT = this.objReportTimesheetDetailsClientBll.GetData(int.Parse(this.hfCompanyID.Value), new int?(int.Parse(listItem.Value)), iProjectID, bBilled, dtFromDate, dtToDate); Label label = new Label() { Text = listItem.Text }; label.Font.Bold = true; this.divGrids.Controls.Add((Control)label); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); GridView gridView1 = new GridView(); gridView1.DataSource = (object)this.objReportTimesheetDetailsClientDT; gridView1.CssClass = "reportTable table table-responsive"; gridView1.Width = Unit.Percentage(100.0); gridView1.GridLines = GridLines.None; gridView1.EmptyDataText = "No Timesheet entry found"; GridView gridView2 = gridView1; gridView2.HeaderStyle.BackColor = ColorTranslator.FromHtml("#0083E0"); gridView2.HeaderStyle.ForeColor = Color.White; gridView2.DataBind(); this.divGrids.Controls.Add((Control)gridView2); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); } } } else if (this.ddlGroupBy.SelectedItem.Text == "Project") { if (this.ddlProject.SelectedIndex > 0) { int?iProjectID = new int?(); if (this.ddlProject.SelectedIndex > 0) { iProjectID = new int?(int.Parse(this.ddlProject.SelectedItem.Value)); } this.objReportTimesheetDetailsProjectDT = this.objReportTimesheetDetailsProjectBll.GetData(int.Parse(this.hfCompanyID.Value), iProjectID, bBilled, dtFromDate, dtToDate); Label label = new Label() { Text = this.ddlProject.SelectedItem.Text }; label.Font.Bold = true; this.divGrids.Controls.Add((Control)label); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); GridView gridView1 = new GridView(); gridView1.DataSource = (object)this.objReportTimesheetDetailsProjectDT; gridView1.CssClass = "reportTable table table-responsive"; gridView1.Width = Unit.Percentage(100.0); gridView1.GridLines = GridLines.None; gridView1.EmptyDataText = "No Timesheet entry found"; GridView gridView2 = gridView1; gridView2.HeaderStyle.BackColor = ColorTranslator.FromHtml("#0083E0"); gridView2.HeaderStyle.ForeColor = Color.White; gridView2.DataBind(); this.divGrids.Controls.Add((Control)gridView2); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); } else { this.ddlProject.DataBind(); foreach (ListItem listItem in this.ddlProject.Items) { if (!string.IsNullOrEmpty(listItem.Value)) { this.objReportTimesheetDetailsProjectDT = this.objReportTimesheetDetailsProjectBll.GetData(int.Parse(this.hfCompanyID.Value), new int?(int.Parse(listItem.Value)), bBilled, dtFromDate, dtToDate); Label label = new Label() { Text = listItem.Text }; label.Font.Bold = true; this.divGrids.Controls.Add((Control)label); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); GridView gridView1 = new GridView(); gridView1.DataSource = (object)this.objReportTimesheetDetailsProjectDT; gridView1.CssClass = "reportTable table table-responsive"; gridView1.Width = Unit.Percentage(100.0); gridView1.GridLines = GridLines.None; gridView1.EmptyDataText = "No Timesheet entry found"; GridView gridView2 = gridView1; gridView2.HeaderStyle.BackColor = ColorTranslator.FromHtml("#0083E0"); gridView2.HeaderStyle.ForeColor = Color.White; gridView2.DataBind(); this.divGrids.Controls.Add((Control)gridView2); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); } } } } else { if (!(this.ddlGroupBy.SelectedItem.Text == "Task")) { return; } this.ddlTask.DataBind(); foreach (ListItem listItem in this.ddlTask.Items) { if (!string.IsNullOrEmpty(listItem.Value)) { this.objReportTimesheetDetailsTaskDT = this.objReportTimesheetDetailsTaskBll.GetData(int.Parse(this.hfCompanyID.Value), int.Parse(listItem.Value), bBilled, dtFromDate, dtToDate); Label label = new Label() { Text = listItem.Text }; label.Font.Bold = true; this.divGrids.Controls.Add((Control)label); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); GridView gridView1 = new GridView(); gridView1.DataSource = (object)this.objReportTimesheetDetailsTaskDT; gridView1.CssClass = "reportTable table table-responsive"; gridView1.Width = Unit.Percentage(100.0); gridView1.GridLines = GridLines.None; gridView1.EmptyDataText = "No Timesheet entry found"; GridView gridView2 = gridView1; gridView2.HeaderStyle.BackColor = ColorTranslator.FromHtml("#0083E0"); gridView2.HeaderStyle.ForeColor = Color.White; gridView2.DataBind(); this.divGrids.Controls.Add((Control)gridView2); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); } } } }