public virtual int Fill(CloudAccountDA.ReportProjectUserDataTable dataTable, int?CompanyID, string EntryFor, 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 (EntryFor == null) { this.Adapter.SelectCommand.Parameters[2].Value = DBNull.Value; } else { this.Adapter.SelectCommand.Parameters[2].Value = EntryFor; } if (FromDate.HasValue) { this.Adapter.SelectCommand.Parameters[3].Value = FromDate.Value; } else { this.Adapter.SelectCommand.Parameters[3].Value = DBNull.Value; } if (ToDate.HasValue) { this.Adapter.SelectCommand.Parameters[4].Value = ToDate.Value; } else { this.Adapter.SelectCommand.Parameters[4].Value = DBNull.Value; } if (this.ClearBeforeFill) { dataTable.Clear(); } return(this.Adapter.Fill(dataTable)); }
private void BindGrid() { string[] formats = new string[7] { this.dateFormat, "MM/dd/yy", "MM/dd/yyyy", "dd/MM/yy", "dd/MM/yyyy", "yy-MM-dd", "yyyy-MM-dd" }; string str = DateTime.ParseExact(this.txtDateFrom.Text, formats, (IFormatProvider)CultureInfo.InvariantCulture, DateTimeStyles.None).ToString("dd/MMM/yy") + " to " + DateTime.ParseExact(this.txtDateTo.Text, formats, (IFormatProvider)CultureInfo.InvariantCulture, DateTimeStyles.None).ToString("dd/MMM/yy"); if (this.ddlTeam.SelectedIndex > 0) { string sEntryFor = (string)null; DateTime?dtFromDate = new DateTime?(); DateTime?dtToDate = new DateTime?(); if (this.ddlTeam.SelectedIndex > 0) { sEntryFor = this.ddlTeam.SelectedItem.Value; } 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())); } this.objReportProjectUserDT = this.objReportProjectUserBll.GetData(int.Parse(this.hfCompanyID.Value), sEntryFor, dtFromDate, dtToDate); Label label1 = new Label() { Text = this.ddlTeam.SelectedItem.Text }; label1.Font.Bold = true; this.divGrids.Controls.Add((Control)label1); Label label2 = new Label() { Text = str }; label2.Font.Bold = true; label2.Attributes.Add("style", "float: right;"); this.divGrids.Controls.Add((Control)label2); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); GridView gridView1 = new GridView(); gridView1.DataSource = (object)this.objReportProjectUserDT; 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.RowDataBound += new GridViewRowEventHandler(this.gv_RowDataBound); 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)) { DateTime?dtFromDate = new DateTime?(); DateTime?dtToDate = new DateTime?(); string sEntryFor = listItem.Value; 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())); } this.objReportProjectUserDT = this.objReportProjectUserBll.GetData(int.Parse(this.hfCompanyID.Value), sEntryFor, dtFromDate, dtToDate); Label label1 = new Label() { Text = listItem.Text }; label1.Font.Bold = true; this.divGrids.Controls.Add((Control)label1); Label label2 = new Label() { Text = str }; label2.Font.Bold = true; label2.Attributes.Add("style", "float: right;"); this.divGrids.Controls.Add((Control)label2); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); GridView gridView1 = new GridView(); gridView1.DataSource = (object)this.objReportProjectUserDT; 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.RowDataBound += new GridViewRowEventHandler(this.gv_RowDataBound); gridView2.DataBind(); this.divGrids.Controls.Add((Control)gridView2); this.divGrids.Controls.Add((Control) new LiteralControl("<br />")); } } } }