void Load_Play() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("ShowName", typeof(string))); dt.Columns.Add(new DataColumn("Location", typeof(string))); dt.Columns.Add(new DataColumn("Show Date", typeof(string))); dt.Columns.Add(new DataColumn("Show Time", typeof(string))); dt.Columns.Add(new DataColumn("Show Time Code", typeof(string))); dt.Columns.Add(new DataColumn("locationcode", typeof(string))); AuditReport ar = new AuditReport(); DateTime PlayDate = DateTime.Now; ar.Date = Convert.ToDateTime(PlayDate.ToString()); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Start Load Play"); DataTable dtlocation = VistaBOL.Select_Play(); if (dtlocation != null && dtlocation.Rows.Count > 0) { foreach (DataRow dr in dtlocation.Rows) { ar.ShowName = dr[0].ToString(); DataTable dtAudi = VistaBOL.Select_Audi(ar.ShowName.ToString()); foreach (DataRow dr1 in dtAudi.Rows) { ar.LocationText = dr1[1].ToString(); ar.LocationValue = dr1[0].ToString(); DataTable drtime = VistaBOL.Select_PlayTime_Audit(ar.LocationValue, ar.ShowName, ar.Date.ToString("dd/MM/yyyy")); foreach (DataRow dr2 in drtime.Rows) { ar.Timetext = Convert.ToDateTime(dr2[0].ToString()); ar.Timevalue = dr2[1].ToString(); dt.Rows.Add(ar.ShowName, ar.LocationText, ar.Date.ToString("ddd, MMM dd,yyyy"), ar.Timetext.ToShortTimeString(), ar.Timevalue, ar.LocationValue); } } } } DataSet ds = new DataSet(); ds.Tables.Add(dt); GridView_ShowDetail.DataSource = ds.Tables[0]; GridView_ShowDetail.DataBind(); }
protected void btnCreateAudit_Click(object sender, EventArgs e) { Btn_CreateAudit.Enabled = false; string ShowName = ddl_Play.SelectedValue; string ShowLocation = ddl_Location.SelectedValue; string ShowDate = dateofshow.Text.Length > 0 ? dateofshow.Text : "0"; string ShowTime = ddl_ShowTimes.SelectedValue; string ShowTime1 = ddl_ShowTimes.SelectedItem.Text; string ShowDate1 = Convert.ToDateTime(dateofshow.Text.ToString()).ToString("dd/MM/yyyy"); DataTable dtreport = GTICKV.AuditSeatsReport(ShowTime, ShowDate); DataTable dtauditnoreport = TransactionBOL.AuditNumberReport(ShowDate1, ShowName, ShowLocation, 1, ShowTime1); List <List1> listofgridview = new List <List1>(); foreach (DataRow row in dtreport.Rows) { List1 gd = new List1(); gd.totalnoofseat = Convert.ToInt32(row[0]); gd.category = Convert.ToString(row[1]); if (row[2].ToString() == "") { gd.totalnoofbookseat = 0; } else { gd.totalnoofbookseat = Convert.ToInt32(row[2]); } if (row[3].ToString() == "") { gd.tcktnotprinted = 0; } else { gd.tcktnotprinted = Convert.ToInt32(row[3]); } listofgridview.Add(gd); } List <List2> listofgridview1 = new List <List2>(); foreach (DataRow row in dtauditnoreport.Rows) { List2 gd = new List2(); gd.auditno1 = Convert.ToInt32(row[0]); gd.auditno2 = Convert.ToInt32(row[1]); gd.category = Convert.ToString(row[2]); listofgridview1.Add(gd); } var query = from u in listofgridview join k in listofgridview1 on u.category equals k.category into p from h in p.DefaultIfEmpty() select new { Seats = u.totalnoofseat, Category = u.category, AuditNo1 = (h == null ? 0 : h.auditno1), AuditNo2 = (h == null ? 0 : h.auditno2), BookedSeats = u.totalnoofbookseat, TicketnotPrinted = u.tcktnotprinted }; gv_Report.DataSource = query; gv_Report.DataBind(); btnGridCalculation.Visible = true; if (dateofshow.Text == "" || dateofshow.Text == "Select" || dateofshow.Text == null) { Label1.Visible = true; Label1.Text = "Please Enter Either The Show Dates !!"; dateofshow.Focus(); } else { Label1.Visible = false; GridView_ShowDetail.DataSource = FlipDataSet(c()); GridView_ShowDetail.DataBind(); } }