Exemplo 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);
        }
    }
Exemplo 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
        {
            //Defining the Values to the Object
            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 = txt_BookingDate.Text.Length > 0 ? txt_BookingDate.Text : "0";
            //location == bookingDate to
            tr.Location  = txt_bookingDateTo.Text.Length > 0 ? txt_bookingDateTo.Text : "0";
            tr.ShowDate  = txt_ShowDate.Text.Length > 0 ? txt_ShowDate.Text : "0";
            tr.MobileNo  = txt_ShowDateTo.Text.Length > 0 ? txt_ShowDateTo.Text : "0";
            tr.Name      = txt_Name.Text.Length > 0 ? txt_Name.Text : "0";
            tr.AgentCode = ddlAgent.SelectedValue;
            if (tr.BookingID != null || tr.BookingID.ToString() != "")
            {
                DataTable chkID1 = TransactionBOL.Select_MarchPromotionTransactionCounter_CounterIDWise(Convert.ToInt64(tr.BookingID.ToString()));
                if (chkID1 != null && chkID1.Rows.Count > 0)
                {
                    tr.BookingID = long.Parse(chkID1.Rows[0][1].ToString());
                }
            }

            DataSet ds = TransactionBOL.Select_Report_SearchFromTransactionsTemp_DS(tr);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                btnPrint.Disabled = false;
                Btn_Excel.Enabled = true;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataTable chkID = TransactionBOL.Select_MarchPromotionTransactionCounter_IDWise(Convert.ToInt64(ds.Tables[0].Rows[i][1]));
                    if (chkID.Rows.Count > 0)
                    {
                        if (chkID.Rows[0][0].ToString().Substring(0, 2) == "31")
                        {
                            ds.Tables[0].Rows[i][1] = long.Parse(chkID.Rows[0][0].ToString());
                        }
                    }
                    if (ds.Tables[0].Rows[i][10].ToString() == "")
                    {
                        dis = Decimal.Parse(ds.Tables[0].Rows[i][8].ToString());
                        ds.Tables[0].Rows[i][10] = dis;
                        ds.Tables[0].Rows[i][9]  = "0.00";
                    }
                }
                gv_Report.DataSource = ds;
                lblMess.Text         = "";
            }
            else
            {
                btnPrint.Disabled = true;
                Btn_Excel.Enabled = false;
                lblMess.Text      = "No records Found!";
            }
            gv_Report.DataBind();
        }
    }