public virtual int Fill(CloudAccountDA.ReportTasksInvoicedDataTable dataTable, int?TaskID, string Status, DateTime?FromDate, DateTime?ToDate) { this.Adapter.SelectCommand = this.CommandCollection[0]; if (TaskID.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = TaskID.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } if (Status == null) { this.Adapter.SelectCommand.Parameters[2].Value = DBNull.Value; } else { this.Adapter.SelectCommand.Parameters[2].Value = Status; } 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.ReportTasksInvoicedDataTable GetData(int?TaskID, string Status, DateTime?FromDate, DateTime?ToDate) { this.Adapter.SelectCommand = this.CommandCollection[0]; if (TaskID.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = TaskID.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } if (Status == null) { this.Adapter.SelectCommand.Parameters[2].Value = DBNull.Value; } else { this.Adapter.SelectCommand.Parameters[2].Value = Status; } 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.ReportTasksInvoicedDataTable dataTable = new CloudAccountDA.ReportTasksInvoicedDataTable(); 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.ddlTasks.SelectedIndex > 0) { int iTaskID = int.Parse(this.ddlTasks.SelectedItem.Value); string sStatus = (string)null; DateTime?dtFromDate = new DateTime?(); DateTime?dtToDate = new DateTime?(); if (this.ddlStatusSearch.SelectedIndex > 0) { sStatus = this.ddlStatusSearch.SelectedItem.Text; } 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.objReportTasksInvoicedDT = this.objReportTasksInvoicedBll.GetData(iTaskID, sStatus, dtFromDate, dtToDate); Label label1 = new Label() { Text = this.ddlTasks.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.objReportTasksInvoicedDT; gridView1.CssClass = "reportTable table table-responsive"; gridView1.Width = Unit.Percentage(100.0); gridView1.GridLines = GridLines.None; 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.ddlTasks.DataBind(); foreach (ListItem listItem in this.ddlTasks.Items) { string s = listItem.Value; if (!string.IsNullOrEmpty(s)) { int iTaskID = int.Parse(s); string sStatus = (string)null; DateTime?dtFromDate = new DateTime?(); DateTime?dtToDate = new DateTime?(); if (this.ddlStatusSearch.SelectedIndex > 0) { sStatus = this.ddlStatusSearch.SelectedItem.Text; } 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.objReportTasksInvoicedDT = this.objReportTasksInvoicedBll.GetData(iTaskID, sStatus, 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.objReportTasksInvoicedDT; gridView1.CssClass = "reportTable table table-responsive"; gridView1.Width = Unit.Percentage(100.0); gridView1.GridLines = GridLines.None; 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 />")); } } } }