示例#1
0
    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();
        }
    }