Ejemplo n.º 1
0
    protected void btnGo_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsPostBack)
            {
                lblMess.Text = "No Records Found!";
                gv_Failed.Dispose();
                gv_Report.Dispose();
                gv_Report.DataBind();
                gv_Failed.DataBind();
            }

            long    BookingID     = txt_BookingID.Text.Length > 0 ? long.Parse(txt_BookingID.Text) : 0;
            string  ReceiptNo     = txt_ReceiptNo.Text.Length > 0 ? txt_ReceiptNo.Text : "0";
            string  Name          = txt_Name.Text.Length > 0 ? txt_Name.Text : "0";
            string  today         = DateTime.Today.ToShortDateString();
            string  daysfromtoday = DateTime.Today.Subtract(TimeSpan.FromDays(30)).ToShortDateString();
            DataSet ds            = TransactionBOL.Select_Report_SearchFromTransactions_DS(BookingID, ReceiptNo, daysfromtoday, today, "0", "0", Name, "0");
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                gv_Report.DataSource = ds;
                lblMess.Text         = "BOOKINGS IN LAST 30 DAYS";
                gv_Report.DataBind();
            }
            else
            {
                lblMess.Text = "NO BOOKINGS IN LAST 30 DAYS";
            }

            TransactionRecord tr = new TransactionRecord();
            tr.BookingID     = txt_BookingID.Text.Length > 0 ? long.Parse(txt_BookingID.Text) : 0;
            tr.ReceiptNo     = txt_ReceiptNo.Text.Length > 0 ? txt_ReceiptNo.Text : "0";
            tr.DateOfBooking = daysfromtoday;
            //location is bookingDate to
            tr.Location = today;
            tr.ShowDate = "0";  // ShowDateFrom
            tr.MobileNo = "0";  //used as ShowDateTo

            tr.Name = txt_Name.Text.Length > 0 ? txt_Name.Text : "0";
            ds      = TransactionBOL.Select_Report_SearchFromTransactionsTemp_DS(tr);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                gv_Failed.DataSource = ds;
                lblMess2.Text        = "FAILED TRANSACTIONS IN LAST 30 DAYS";
                gv_Failed.DataBind();
            }
            else
            {
                lblMess2.Text = "NO FAILED TRANSACTION IN LAST 30 DAYS";
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
        }
    }
Ejemplo n.º 2
0
    protected void btnGo_Click(object sender, EventArgs e)
    {
        if (txt_Name.Text == "" && txt_BookingDate.Text == "" && txt_bookingDateTo.Text == "" && txt_ShowDate.Text == "" && txt_ShowDateTo.Text == "")
        {
            lblValidation.Visible = true;
            lblValidation.Text    = "Please Enter Either The Name , Booking Dates or Show Dates !!";
            txt_Name.Focus();
        }
        else if (txt_BookingDate.Text != "" && txt_bookingDateTo.Text == "")
        {
            lblValidation.Visible = true;
            lblValidation.Text    = "Please Select the Booking Date To !!";
            txt_bookingDateTo.Focus();
        }
        else if (txt_BookingDate.Text == "" && txt_bookingDateTo.Text != "")
        {
            lblValidation.Visible = true;
            lblValidation.Text    = "Please Select the Booking Date From !!";
            txt_BookingDate.Focus();
        }
        else if (txt_ShowDate.Text == "" && txt_ShowDateTo.Text != "")
        {
            lblValidation.Visible = true;
            lblValidation.Text    = "Please Select the Show Date From !!";
            txt_ShowDate.Focus();
        }
        else if (txt_ShowDate.Text != "" && txt_ShowDateTo.Text == "")
        {
            lblValidation.Visible = true;
            lblValidation.Text    = "Please Select the Show Date To !!";
            txt_ShowDateTo.Focus();
        }
        else
        {
            lblValidation.Visible = false;
            try
            {
                if (Page.IsPostBack)
                {
                    lblMess.Text = "No Records Found!";
                    gv_Report.Dispose();
                    gv_Report.DataBind();
                }

                int     Seats = 0; decimal totamt = 0;
                long    BookingID     = txt_BookingID.Text.Length > 0 ? long.Parse(txt_BookingID.Text) : 0;
                string  ReceiptNo     = txt_ReceiptNo.Text.Length > 0 ? txt_ReceiptNo.Text : "0";
                string  DateOfBooking = txt_BookingDate.Text.Length > 0 ? txt_BookingDate.Text : "0";
                string  Location      = txt_bookingDateTo.Text.Length > 0 ? txt_bookingDateTo.Text : "0";
                string  ShowDate      = txt_ShowDate.Text.Length > 0 ? txt_ShowDate.Text : "0";
                string  MobileNo      = txt_ShowDateTo.Text.Length > 0 ? txt_ShowDateTo.Text : "0";
                string  Name          = txt_Name.Text.Length > 0 ? txt_Name.Text : "0";
                string  AgentCode     = ddlAgent.SelectedValue;
                DataSet ds            = TransactionBOL.Select_Report_SearchFromTransactions_DS(BookingID, ReceiptNo, DateOfBooking, Location, ShowDate, MobileNo, Name, AgentCode);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    Btn_Excel.Enabled    = true;
                    btnPrint.Disabled    = false;
                    gv_Report.DataSource = ds;
                    lblMess.Text         = "";
                }
                else
                {
                    btnPrint.Disabled = true;
                    Btn_Excel.Enabled = false;
                    lblMess.Text      = "No Records Found!";
                }

                gv_Report.DataBind();

                if (gv_Report.Rows.Count > 0)
                {
                    foreach (GridViewRow Gr in gv_Report.Rows)
                    {
                        Seats  = Seats + int.Parse(Gr.Cells[7].Text);
                        totamt = totamt + decimal.Parse(Gr.Cells[8].Text);
                    }
                    gv_Report.FooterRow.Cells[6].Text = "Total";
                    gv_Report.FooterRow.Cells[7].Text = Seats.ToString();
                    gv_Report.FooterRow.Cells[8].Text = totamt.ToString();
                }
            }
            catch (Exception ex)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
            }
        }
    }