public virtual int Fill(CloudAccountDA.ReportProjectTaskDataTable dataTable, int?CompanyID, int?TaskID, 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 (TaskID.HasValue) { this.Adapter.SelectCommand.Parameters[2].Value = TaskID.Value; } else { this.Adapter.SelectCommand.Parameters[2].Value = DBNull.Value; } 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)); }
public virtual CloudAccountDA.ReportProjectTaskDataTable GetData(int?CompanyID, int?TaskID, 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 (TaskID.HasValue) { this.Adapter.SelectCommand.Parameters[2].Value = TaskID.Value; } else { this.Adapter.SelectCommand.Parameters[2].Value = DBNull.Value; } 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; } CloudAccountDA.ReportProjectTaskDataTable dataTable = new CloudAccountDA.ReportProjectTaskDataTable(); this.Adapter.Fill(dataTable); return(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.ddlTask.SelectedIndex > 0) { int iTaskID = 0; DateTime?dtFromDate = new DateTime?(); DateTime?dtToDate = new DateTime?(); if (this.ddlTask.SelectedIndex > 0) { iTaskID = int.Parse(this.ddlTask.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.objReportProjectTaskDT = this.objReportProjectTaskBll.GetData(int.Parse(this.hfCompanyID.Value), iTaskID, dtFromDate, dtToDate); Label label1 = new Label() { Text = this.ddlTask.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.objReportProjectTaskDT; 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.ddlTask.DataBind(); foreach (ListItem listItem in this.ddlTask.Items) { if (!string.IsNullOrEmpty(listItem.Value)) { DateTime?dtFromDate = new DateTime?(); DateTime?dtToDate = new DateTime?(); int iTaskID = int.Parse(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.objReportProjectTaskDT = this.objReportProjectTaskBll.GetData(int.Parse(this.hfCompanyID.Value), iTaskID, 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.objReportProjectTaskDT; 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 />")); } } } }