Beispiel #1
0
        public Budget_BookingOnline SelectByConfirmationIDAndLastname(string ConfirmationID, string LastName)
        {
            Budget_BookingOnline booking = null;

            try
            {
                string         sSQL     = @"SELECT * FROM BookingOnline WHERE ConfirmationID=@ConfirmationID AND LastName=@LastName";
                SqlParameter[] sqlParam = new SqlParameter[2];
                sqlParam[0]       = new SqlParameter("@ConfirmationID", SqlDbType.NVarChar);
                sqlParam[0].Value = ConfirmationID;
                sqlParam[1]       = new SqlParameter("@LastName", SqlDbType.NVarChar);
                sqlParam[1].Value = LastName;
                DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL, sqlParam);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    booking = new Budget_BookingOnline();

                    booking.BookingOID     = new Guid(ds.Tables[0].Rows[0]["BookingOID"].ToString());
                    booking.FirstName      = ds.Tables[0].Rows[0]["FirstName"].ToString();
                    booking.LastName       = ds.Tables[0].Rows[0]["LastName"].ToString();
                    booking.Contact        = ds.Tables[0].Rows[0]["Contact"].ToString();
                    booking.Flight         = ds.Tables[0].Rows[0]["Flight"].ToString();
                    booking.Email          = ds.Tables[0].Rows[0]["Email"].ToString();
                    booking.ConfirmationID = ds.Tables[0].Rows[0]["ConfirmationID"].ToString();
                    booking.Price          = Convert.ToDouble(ds.Tables[0].Rows[0]["Price"].ToString());
                    booking.GroupType      = ds.Tables[0].Rows[0]["GroupType"].ToString();
                    booking.GroupValue     = ds.Tables[0].Rows[0]["GroupValue"].ToString();
                    booking.RateQualifier  = (ds.Tables[0].Rows[0]["RateQualifier"].Equals(DBNull.Value) == false) ? ds.Tables[0].Rows[0]["RateQualifier"].ToString() : "";
                    booking.CurrencyCode   = ds.Tables[0].Rows[0]["CurrencyCode"].ToString();
                    booking.PickupLocation = (ds.Tables[0].Rows[0]["PickupLocation"].Equals(DBNull.Value) == false) ? ds.Tables[0].Rows[0]["PickupLocation"].ToString() : "";
                    if (ds.Tables[0].Rows[0]["PickupDateTime"].Equals(DBNull.Value) == false)
                    {
                        booking.PickupDateTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["PickupDateTime"].ToString());
                    }
                    booking.ReturnLocation = (ds.Tables[0].Rows[0]["ReturnLocation"].Equals(DBNull.Value) == false) ? ds.Tables[0].Rows[0]["ReturnLocation"].ToString() : "";
                    if (ds.Tables[0].Rows[0]["ReturnDateTime"].Equals(DBNull.Value) == false)
                    {
                        booking.ReturnDateTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["ReturnDateTime"].ToString());
                    }
                    booking.CarName        = ds.Tables[0].Rows[0]["CarName"].ToString();
                    booking.Citizen        = ds.Tables[0].Rows[0]["Citizen"].ToString();
                    booking.VehType        = ds.Tables[0].Rows[0]["VehType"].ToString();
                    booking.VehClass       = ds.Tables[0].Rows[0]["VehClass"].ToString();
                    booking.ChildSeatQty   = int.Parse(ds.Tables[0].Rows[0]["ChildSeatQty"].ToString());
                    booking.ChildSeatPrice = (ds.Tables[0].Rows[0]["ChildSeatPrice"].Equals(DBNull.Value) == false) ? Convert.ToDouble(ds.Tables[0].Rows[0]["ChildSeatPrice"].ToString()) : 0;
                    booking.BookingStatus  = (ds.Tables[0].Rows[0]["BookingStatus"].Equals(DBNull.Value) == false) ? ds.Tables[0].Rows[0]["BookingStatus"].ToString() : "";
                    if (ds.Tables[0].Rows[0]["BookingDateTime"].Equals(DBNull.Value) == false)
                    {
                        booking.BookingDateTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["BookingDateTime"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["ModifyDateTime"].Equals(DBNull.Value) == false)
                    {
                        booking.ModifyDateTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["ModifyDateTime"].ToString());
                    }
                }
            }
            catch (Exception ex) { }

            return(booking);
        }
Beispiel #2
0
        public List <Budget_BookingOnline> SelectAll()
        {
            List <Budget_BookingOnline> BookingList = null;

            try
            {
                string sSQL = @"SELECT * FROM BookingOnline";

                DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    BookingList = new List <Budget_BookingOnline>();
                    Budget_BookingOnline booking = new Budget_BookingOnline();
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        booking                = new Budget_BookingOnline();
                        booking.BookingOID     = new Guid(ds.Tables[0].Rows[i]["BookingOID"].ToString());
                        booking.FirstName      = ds.Tables[0].Rows[i]["FirstName"].ToString();
                        booking.LastName       = ds.Tables[0].Rows[i]["LastName"].ToString();
                        booking.Contact        = ds.Tables[0].Rows[i]["Contact"].ToString();
                        booking.Flight         = ds.Tables[0].Rows[i]["Flight"].ToString();
                        booking.Email          = ds.Tables[0].Rows[i]["Email"].ToString();
                        booking.ConfirmationID = ds.Tables[0].Rows[i]["ConfirmationID"].ToString();
                        booking.Price          = Convert.ToDouble(ds.Tables[0].Rows[i]["Price"].ToString());
                        booking.GroupType      = ds.Tables[0].Rows[i]["GroupType"].ToString();
                        booking.GroupValue     = ds.Tables[0].Rows[i]["GroupValue"].ToString();
                        booking.RateQualifier  = (ds.Tables[0].Rows[i]["RateQualifier"].Equals(DBNull.Value) == false) ? ds.Tables[0].Rows[i]["RateQualifier"].ToString() : "";
                        booking.CurrencyCode   = ds.Tables[0].Rows[i]["CurrencyCode"].ToString();
                        booking.PickupLocation = (ds.Tables[0].Rows[i]["PickupLocation"].Equals(DBNull.Value) == false) ? ds.Tables[0].Rows[i]["PickupLocation"].ToString() : "";
                        if (ds.Tables[0].Rows[i]["PickupDateTime"].Equals(DBNull.Value) == false)
                        {
                            booking.PickupDateTime = Convert.ToDateTime(ds.Tables[0].Rows[i]["PickupDateTime"].ToString());
                        }
                        booking.ReturnLocation = (ds.Tables[0].Rows[i]["ReturnLocation"].Equals(DBNull.Value) == false) ? ds.Tables[0].Rows[i]["ReturnLocation"].ToString() : "";
                        if (ds.Tables[0].Rows[i]["ReturnDateTime"].Equals(DBNull.Value) == false)
                        {
                            booking.ReturnDateTime = Convert.ToDateTime(ds.Tables[0].Rows[i]["ReturnDateTime"].ToString());
                        }
                        booking.CarName        = ds.Tables[0].Rows[i]["CarName"].ToString();
                        booking.Citizen        = ds.Tables[0].Rows[i]["Citizen"].ToString();
                        booking.VehType        = ds.Tables[0].Rows[i]["VehType"].ToString();
                        booking.VehClass       = ds.Tables[0].Rows[i]["VehClass"].ToString();
                        booking.ChildSeatQty   = int.Parse(ds.Tables[0].Rows[i]["ChildSeatQty"].ToString());
                        booking.ChildSeatPrice = (ds.Tables[0].Rows[i]["ChildSeatPrice"].Equals(DBNull.Value) == false) ? Convert.ToDouble(ds.Tables[0].Rows[i]["ChildSeatPrice"].ToString()) : 0;
                        booking.BookingStatus  = (ds.Tables[0].Rows[i]["BookingStatus"].Equals(DBNull.Value) == false) ? ds.Tables[0].Rows[i]["BookingStatus"].ToString() : "";
                        if (ds.Tables[0].Rows[i]["BookingDateTime"].Equals(DBNull.Value) == false)
                        {
                            booking.BookingDateTime = Convert.ToDateTime(ds.Tables[0].Rows[i]["BookingDateTime"].ToString());
                        }
                        if (ds.Tables[0].Rows[i]["ModifyDateTime"].Equals(DBNull.Value) == false)
                        {
                            booking.ModifyDateTime = Convert.ToDateTime(ds.Tables[0].Rows[i]["ModifyDateTime"].ToString());
                        }
                        BookingList.Add(booking);
                    }
                }
            }
            catch (Exception ex) { }

            return(BookingList);
        }