예제 #1
0
        public void TestFlightIDFound()
        {
            //create an instance of the class
            clsBooking ABooking = new clsBooking();
            //boolean variable to store the result of the search
            Boolean Found = false;
            ////boolean variable to record if data is ok
            Boolean OK = true;
            //create some test data to use with the method
            Int32 BookingID = 31;

            //imvoke the method
            Found = ABooking.Find(BookingID);
            //check the booking id
            if (ABooking.FlightID != 1)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
예제 #2
0
        public void UpdateBookingMethodOK()
        {
            // create an instance of the booking collection class
            clsBookingCollection Bookings = new clsBookingCollection();
            // create item of test data
            clsBooking TestItem = new clsBooking();
            // var to store primary key
            Int32 PrimaryKey = 0;

            // set the properties
            TestItem.TotalPrice      = 198;
            TestItem.BookingApproved = false;
            TestItem.DestinationID   = 1;
            TestItem.BookingDate     = DateTime.Now.Date;
            TestItem.CarParkID       = 151;
            TestItem.CustomerNo      = 1;
            // set ThisBooking to the test data
            Bookings.ThisBooking = TestItem;
            // add the record
            PrimaryKey = Bookings.Add();
            // set the primary key of the test data
            TestItem.BookingID = PrimaryKey;
            // modify the test data
            TestItem.TotalPrice      = 1500;
            TestItem.BookingApproved = true;
            TestItem.DestinationID   = 12;
            TestItem.BookingDate     = DateTime.Now.Date;
            TestItem.CarParkID       = 154;
            TestItem.CustomerNo      = 5;
            // set the record based on the new test data
            Bookings.ThisBooking = TestItem;
            // update the record
            Bookings.Update();
            // find the record
            Bookings.ThisBooking.Find(PrimaryKey);
            // test to see ThisBooking matches the test data
            Assert.AreEqual(Bookings.ThisBooking, TestItem);
        }
예제 #3
0
        public void UpdateMethod()
        {
            //create an instance of a class
            clsBookingCollection AllBooking = new clsBookingCollection();
            //create the item of test data
            clsBooking TestItem = new clsBooking();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.CustomerID      = 2;
            TestItem.StaffID         = 2;
            TestItem.FlightID        = 2;
            TestItem.BookingName     = "Tom";
            TestItem.BookingDate     = DateTime.Now.Date;
            TestItem.BookingValidity = 30;
            //set thisBooking to the test data
            AllBooking.ThisBooking = TestItem;
            //add the record
            PrimaryKey = AllBooking.Add();
            //set the primary key of the test data
            TestItem.BookingID = PrimaryKey;
            //modify the test data
            TestItem.CustomerID      = 3;
            TestItem.StaffID         = 3;
            TestItem.FlightID        = 3;
            TestItem.BookingName     = "John";
            TestItem.BookingDate     = DateTime.Now.Date;
            TestItem.BookingValidity = 40;
            //set the record based on the new test data
            AllBooking.ThisBooking = TestItem;
            //update the record
            AllBooking.Update();
            //find the record
            AllBooking.ThisBooking.Find(PrimaryKey);
            //test to see thisbooking matches the test data
            Assert.AreEqual(AllBooking.ThisBooking, TestItem);
        }
예제 #4
0
        public void ListAndCountOK()
        {
            // create an instance of the class we want to create
            clsBookingCollection AllBookings = new clsBookingCollection();
            // create test data to assign to the property
            List <clsBooking> TestList = new List <clsBooking>();
            // create the item of test data
            clsBooking TestItem = new clsBooking();

            // set its properties
            TestItem.BookingID       = 1;
            TestItem.TotalPrice      = 198;
            TestItem.BookingApproved = false;
            TestItem.DestinationID   = 1;
            TestItem.BookingDate     = DateTime.Now.Date;
            TestItem.CarParkID       = 151;
            TestItem.CustomerNo      = 1;
            // add the item to the test list
            TestList.Add(TestItem);
            // assign the data to the property
            AllBookings.BookingList = TestList;
            // test to see that the two values are the same
            Assert.AreEqual(AllBookings.Count, TestList.Count);
        }
예제 #5
0
        public void ListAndCountOK()
        {
            //create an instance of the class we want to create
            clsBookingCollection AllBookings = new clsBookingCollection();
            //create some test data to assign to the property
            //in this sceanario it needs to be a lists of objects
            List <clsBooking> TestList = new List <clsBooking>();
            //add an item to the list
            //create the item of test data
            clsBooking TestItem = new clsBooking();

            //set its properties
            TestItem.useremail    = "*****@*****.**";
            TestItem.DateBooked   = DateTime.Now.Date;
            TestItem.TimeBooked   = DateTime.Now.Date.ToString();
            TestItem.GuestsBooked = "10";
            TestItem.DiningBooked = "Dinner";
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllBookings.BookingsList = TestList;
            //test to see that it exists
            Assert.AreEqual(AllBookings.Count, TestList.Count);
        }
예제 #6
0
        public void UpdateMethodOK()
        {
            //create an instance of the class we want to create
            clsBookingCollection AllBookings = new clsBookingCollection("Fbloggs");
            //create an instance of test data
            clsBooking TestItem = new clsBooking();
            //var to store primary key
            Int32 PK = 0;

            //set the properties
            TestItem.useremail    = "*****@*****.**";
            TestItem.DateBooked   = DateTime.Now.Date;
            TestItem.TimeBooked   = DateTime.Now.Date.ToString();
            TestItem.GuestsBooked = "10";
            TestItem.DiningBooked = "Dinner";
            //set ThisCustomer to validate test data
            AllBookings.ThisBookings = TestItem;
            //add the record
            PK = AllBookings.Add();
            //set primary key of test data
            TestItem.BookRef = PK;
            //modify the record
            TestItem.useremail    = "*****@*****.**";
            TestItem.DateBooked   = DateTime.Now.Date;
            TestItem.TimeBooked   = DateTime.Now.Date.ToString();
            TestItem.GuestsBooked = "10";
            TestItem.DiningBooked = "Dinner";
            //set the record based on the new record
            AllBookings.ThisBookings = TestItem;
            //update the record
            AllBookings.Update();
            //find the record
            AllBookings.ThisBookings.Find(PK);
            //test to see that it exists
            Assert.AreEqual(AllBookings.ThisBookings, TestItem);
        }
예제 #7
0
        public static void SendPaymentLink(int bookingId, string encodedBookingId)
        {
            try
            {
                HttpContext context     = HttpContext.Current;
                string      baseUrl     = context.Request.Url.Scheme + "://" + context.Request.Url.Authority + context.Request.ApplicationPath.TrimEnd('/') + '/';
                string      pageurl     = baseUrl + "BookingPayment.aspx?id=" + encodedBookingId;
                string      paymentLink = "<a href='" + pageurl + "'>Click Here</a>";

                clsBooking booking   = mgtBooking.GetBookingById(bookingId);
                clsUser    user      = mgtUSer.GetUserByUserId(booking.UserID);
                string     emailBody = "<h2>Hello " + user.FullName + ".</h2>" +
                                       "<h3>Your booking #" + booking.BookingNo +
                                       " is completed successfully</h3></br></br>";
                emailBody = emailBody + "<p>Please " + paymentLink + " to proceed the payment.</p></br></br>";
                emailBody = emailBody + "<p>Thank You, <br>Team AutoCare </p>";


                EmailSender.Send("Booking completed successfully!", emailBody, user.Email);
            }
            catch (Exception ex)
            {
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        objbooking   = new clsBooking();
        objcarmaster = new clsCarMaster();
        objcustomer  = new clsCustomer();
        objdriver    = new clsDriver();
        sCOM         = new Common();

        //txtbdate.Text = .ToDateTime.now();

        //To fill Dropdownlist



        /* uname = (String)Session["uname"];
         * if (uname != null)
         * {
         *   txtdname.Text = uname;
         * }
         * else
         * {
         *   txtdname.Text = "travelagent";
         * }*/
        if (!Page.IsPostBack)
        {
            sSQL = objcarmaster.DispDataAll();
            sCOM.setDropDownList(drpcarcode, sSQL, "CarName", "CarCode");
            sSQL = objcustomer.DispDataAll();
            sCOM.setDropDownList(drpcustcode, sSQL, "CustName", "CustCode");

            sSQL = objdriver.DispDataAll();
            sCOM.setDropDownList(drpdrcode, sSQL, "DriverName", "Dcode");
            if (Request.QueryString["action"] == "add")
            {
                txtbdate.Text = DateTime.Now.Date.ToString();
                txtbcode.Text = sCOM.setAutoID("Booking", "BookingCode").ToString();
            }
            else if (Request.QueryString["action"] == "edit")
            {
                if (Request.QueryString["ec"] != null)
                {
                    string ec = (Request.QueryString["ec"].ToString());
                    txtbcode.Text = ec;
                    objbooking    = objbooking.GetData(ec);

                    /*if (chkStatus.Checked == true)
                     * {
                     *  objdriver.Status = "Active";
                     * }
                     * else
                     * {
                     *  objdriver.Status = "Inactive";
                     * }*/

                    txtpckdate.Text    = objbooking.PickupDate.ToString();
                    txtdrpdate.Text    = objbooking.DropDate.ToString();
                    drpcustcode.Text   = objbooking.CustCode.ToString();
                    drpcarcode.Text    = objbooking.CarCode.ToString();
                    drpdrcode.Text     = objbooking.DriverCode.ToString();
                    drppassengers.Text = objbooking.Passengers.ToString();
                    txtpckaddress.Text = objbooking.PickupAddress;
                    txtdraddress.Text  = objbooking.DropAddress;
                    txtremark.Text     = objbooking.Remark;
                    txtbdate.Text      = objbooking.BookingDate.ToString();
                    txtfare.Text       = objbooking.Fare.ToString();
                    drpstatus.Text     = objbooking.Status;
                }
            }
            else
            {
                //Error Page
            }
        }
    }