public virtual int Fill(CloudAccountDA.ReportItemSalesDataTable dataTable, int?ItemID, string Status, DateTime?FromDate, DateTime?ToDate)
 {
     this.Adapter.SelectCommand = this.CommandCollection[0];
     if (ItemID.HasValue)
     {
         this.Adapter.SelectCommand.Parameters[1].Value = ItemID.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.ReportItemSalesDataTable GetData(int?ItemID, string Status, DateTime?FromDate, DateTime?ToDate)
 {
     this.Adapter.SelectCommand = this.CommandCollection[0];
     if (ItemID.HasValue)
     {
         this.Adapter.SelectCommand.Parameters[1].Value = ItemID.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.ReportItemSalesDataTable dataTable = new CloudAccountDA.ReportItemSalesDataTable();
     this.Adapter.Fill(dataTable);
     return(dataTable);
 }
Пример #3
0
        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.ddlItems.SelectedIndex > 0)
            {
                int      iItemID    = int.Parse(this.ddlItems.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.objReportItemSalesDT = this.objReportItemSalesBll.GetData(iItemID, sStatus, dtFromDate, dtToDate);
                Label label1 = new Label()
                {
                    Text = this.ddlItems.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.objReportItemSalesDT;
                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.ddlItems.DataBind();
                foreach (ListItem listItem in this.ddlItems.Items)
                {
                    string s = listItem.Value;
                    if (!string.IsNullOrEmpty(s))
                    {
                        int      iItemID    = 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.objReportItemSalesDT = this.objReportItemSalesBll.GetData(iItemID, 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.objReportItemSalesDT;
                        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 />"));
                    }
                }
            }
        }