Exemplo n.º 1
0
        public List <Budget_BookingOffline> SelectAll()
        {
            List <Budget_BookingOffline> BookingList = null;

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

                DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    BookingList = new List <Budget_BookingOffline>();
                    Budget_BookingOffline booking = new Budget_BookingOffline();
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        booking                = new Budget_BookingOffline();
                        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.CarTypeOID     = new Guid(ds.Tables[0].Rows[i]["CarTypeOID"].ToString());
                        booking.RateOID        = new Guid(ds.Tables[0].Rows[i]["RateOID"].ToString());
                        booking.Price          = Convert.ToDouble(ds.Tables[0].Rows[i]["Price"].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.GroupCode      = ds.Tables[0].Rows[i]["GroupCode"].ToString();
                        booking.SIPPCode       = ds.Tables[0].Rows[i]["SIPPCode"].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);
        }
Exemplo n.º 2
0
        public Budget_BookingOffline SelectByConfirmationIDAndLastname(string ConfirmationID, string LastName)
        {
            Budget_BookingOffline booking = null;

            try
            {
                string         sSQL     = @"SELECT * FROM BookingOffline 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_BookingOffline();

                    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.CarTypeOID     = new Guid(ds.Tables[0].Rows[0]["CarTypeOID"].ToString());
                    booking.RateOID        = new Guid(ds.Tables[0].Rows[0]["RateOID"].ToString());
                    booking.Price          = Convert.ToDouble(ds.Tables[0].Rows[0]["Price"].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.GroupCode      = ds.Tables[0].Rows[0]["GroupCode"].ToString();
                    booking.SIPPCode       = ds.Tables[0].Rows[0]["SIPPCode"].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);
        }