Пример #1
0
        /// <summary>
        /// Get de un reservacion de un cliente especifico
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ReservationData GetReservation(int id)
        {
            ReservationData reservation = new ReservationData();

            using (tecAirlinesEntities entities = new tecAirlinesEntities())
            {
                try
                {
                    if (!this.ExistReservation(id))
                    {
                        reservation = null;
                        return(reservation);
                    }
                    var reserx = entities.Reservas.Find(id);
                    reservation.Codigo   = reserx.Codigo;
                    reservation.Chequeo  = reserx.Chequeo;
                    reservation.Equipaje = reserx.Equipaje;
                    reservation.C_Vuelo  = reserx.C_Vuelo;


                    return(reservation);
                }
                catch (Exception)
                {
                    reservation = null;
                    return(reservation);
                }
            }
        }
Пример #2
0
        /// <summary>
        ///     Adds a location reservation
        /// </summary>
        /// <param name="x">x coordinate</param>
        /// <param name="y">y coordinate</param>
        /// <returns></returns>
        override public ReservationData GetReservationAtPoint(uint x, uint y)
        {
            MySQLSuperManager dbm = GetLockedConnection();

            try
            {
                Dictionary <string, object> param = new Dictionary <string, object>();
                param["?x"] = x.ToString();
                param["?y"] = y.ToString();
                IDbCommand  result = dbm.Manager.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param);
                IDataReader reader = result.ExecuteReader();

                ReservationData row = dbm.Manager.readReservationRow(reader);
                reader.Close();
                result.Dispose();

                return(row);
            }

            catch (Exception e)
            {
                dbm.Manager.Reconnect();
                m_log.Error(e.ToString());
                return(null);
            }

            finally
            {
                dbm.Release();
            }
        }
        public ActionResult Create([Bind(Include = "Id,AdultNumber,ChildernNumberNumber,DateFrom,DateTo")] ReservationData reservationData)
        {
            if (ModelState.IsValid)
            {
                int row = int.Parse(Request.Form["Row"]);
                int col = int.Parse(Request.Form["Col"]);
                if (row <= 0)
                {
                    return(View(reservationData));
                }
                int id = Convert.ToInt32(TempData["PersonId"]);
                reservationData.PersonId = id;
                reservationData.DateFrom = reservationData.DateFrom.AddDays(col - 1);
                ViewBag.row = row;
                ViewBag.col = col;

                var email = db.PersonalDatas.SingleOrDefault(p => p.Id == id).Email;
                //Email.Send(email, "Booking Ticket Flight", "You Booked Ticket -_-");

                db.ReservationDatas.Add(reservationData);
                db.SaveChanges();


                return(View("Finish", reservationData));
            }

            return(View(reservationData));
        }
Пример #4
0
 /// <summary>
 /// Actualizar un Reservacion
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public bool UpdateReservation(ReservationData data)
 {
     using (tecAirlinesEntities entities = new tecAirlinesEntities())
     {
         try
         {
             var user = entities.Reservas.Find(data.Codigo);
             //user.Nombre = data.Nombre;
             //user.Apellido1 = data.Apellido1;
             //user.Apellido2 = data.Apellido2;
             user.Chequeo  = data.Chequeo;
             user.Equipaje = data.Equipaje;
             //user.Carne = data.Carne;
             //user.Correo = data.Correo;
             //user.Universidad = data.Universidad;
             //user.Contraseña = data.Contraseña;
             entities.SaveChanges();
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
        public void UpdateReservationData(ReservationData reservationData)
        {
            var userData = reservationData.PlayerData;

            using var mySQLConnector = new MySQLConnector();
            var transaction = mySQLConnector.Database.BeginTransaction();

            var playerID = mySQLConnector.PlayerData
                           .Include(d => d.ClanData)
                           .Where(d => d.ClanData.ServerID == userData.ClanData.ServerID)
                           .Where(d => d.ClanData.ClanRoleID == userData.ClanData.ClanRoleID)
                           .Where(d => d.UserID == userData.UserID)
                           .Select(d => d.PlayerID)
                           .FirstOrDefault();

            if (playerID == 0)
            {
                return;
            }

            var updateData = mySQLConnector.ReservationData
                             .Include(d => d.PlayerData)
                             .Where(d => d.PlayerID == playerID)
                             .Where(d => d.BattleLap == reservationData.BattleLap)
                             .Where(d => d.BossNumber == reservationData.BossNumber)
                             .Where(b => b.DeleteFlag == false)
                             .FirstOrDefault();

            updateData.CommentData = reservationData.CommentData;
            mySQLConnector.SaveChanges();
            transaction.Commit();
        }
Пример #6
0
 public string CheckReservations(RegionProfileData theSim, XmlNode authkeynode)
 {
     foreach (IGridDataPlugin plugin in _plugins)
     {
         try
         {
             //Check reservations
             ReservationData reserveData =
                 plugin.GetReservationAtPoint(theSim.regionLocX, theSim.regionLocY);
             if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) ||
                 (reserveData == null && authkeynode.InnerText != theSim.regionRecvKey))
             {
                 plugin.AddProfile(theSim);
                 m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")");
                 logToDB(theSim.ToString(), "RestSetSimMethod", String.Empty, 5,
                         "Region successfully updated and connected to grid.");
             }
             else
             {
                 m_log.Warn("[grid]: " +
                            "Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");
                 // Wanted: " + reserveData.gridRecvKey + ", Got: " + theSim.regionRecvKey + ".");
                 return("Unable to update region (RestSetSimMethod): Incorrect auth key.");
             }
         }
         catch (Exception e)
         {
             m_log.Warn("[GRID]: GetRegionPlugin Handle " + plugin.Name + " unable to add new sim: " +
                        e.ToString());
         }
     }
     return("OK");
 }
        public void CreateReservationData(ReservationData reservationData)
        {
            var userData = reservationData.PlayerData;

            using var mySQLConnector = new MySQLConnector();
            var transaction = mySQLConnector.Database.BeginTransaction();

            var playerID = mySQLConnector.PlayerData
                           .Include(d => d.ClanData)
                           .Where(d => d.ClanData.ServerID == userData.ClanData.ServerID)
                           .Where(d => d.ClanData.ClanRoleID == userData.ClanData.ClanRoleID)
                           .Where(d => d.UserID == userData.UserID)
                           .Select(d => d.PlayerID)
                           .FirstOrDefault();


            mySQLConnector.ReservationData.Add(
                new ReservationData()
            {
                PlayerID    = playerID,
                BattleLap   = reservationData.BattleLap,
                BossNumber  = reservationData.BossNumber,
                CommentData = reservationData.CommentData
            });

            mySQLConnector.SaveChanges();
            transaction.Commit();
        }
 public UserService(UserData userData, DeskData deskData)
 {
     this.userData = userData;
     this.deskData = deskData;
     // this.reservationData = new ReservationData();
     this.reservationData = reservationData;
 }
Пример #9
0
        private async Task <Attachment> GetReceiptCard(ReservationData reservation)
        {
            var price = await priceService.GetRidePriceEstimate(reservation.Location);

            var pickupTime  = reservation.Time;
            var receiptCard = new ReceiptCard()
            {
                Title = "Ride Sharing Receipt",
                // steps
                Facts = new List <Fact>
                {
                    new Fact("Booking Number", "000345"),
                    new Fact("Customer", "Lance Olson"),
                    new Fact("Payment Method", "VISA 5555-****")
                },
                Items = new List <ReceiptItem>
                {
                    new ReceiptItem(title: reservation.CarType, subtitle: pickupTime, price: price, quantity: "1", image: new CardImage(BotConstants.CarImageUrl))
                },
                Tax     = "$ 5.50",
                Total   = price,
                Buttons = new List <CardAction>
                {
                    new CardAction()
                    {
                        Type  = ActionTypes.OpenUrl,
                        Title = "More information",
                        Image = BotConstants.CompanyLogoUrl,
                        Value = "https://azure.microsoft.com/en-us/pricing/"
                    }
                }
            };

            return(receiptCard.ToAttachment());
        }
        protected void btnReserve_Click(object sender, EventArgs e)
        {
            DateTime startTime = Convert.ToDateTime(txtStartTime.Text);
            DateTime endTime   = Convert.ToDateTime(txtEndTime.Text);
            int      spot_ID   = drpSpot.SelectedIndex;

            spot_ID++;

            // Reading cookies
            HttpCookie userName = Request.Cookies["USER_ID"];
            string     uid      = userName != null?userName.Value.Split('=')[1] : "undefined";


            ReservationData rd    = new ReservationData();
            int             resId = rd.CreateNew(uid, spot_ID, startTime, endTime);

            MessageBox.Show("Your reservation has been sucessful. Reservation ID:" + resId);

            // write cookies
            HttpCookie res_ID_cookie = new HttpCookie("RES_ID");

            res_ID_cookie["RES_ID"] = "" + resId;
            res_ID_cookie.Expires   = DateTime.Now.AddHours(1);
            Response.Cookies.Add(res_ID_cookie);


            Response.Redirect("homePage.aspx");
        }
Пример #11
0
        /// <summary>
        /// Reads a reservation row from a database reader
        /// </summary>
        /// <param name="reader">An active database reader</param>
        /// <returns>A reservation data object</returns>
        public ReservationData readReservationRow(IDataReader reader)
        {
            ReservationData retval = new ReservationData();

            if (reader.Read())
            {
                retval.gridRecvKey        = (string)reader["gridRecvKey"];
                retval.gridSendKey        = (string)reader["gridSendKey"];
                retval.reservationCompany = (string)reader["resCompany"];
                retval.reservationMaxX    = Convert.ToInt32(reader["resXMax"].ToString());
                retval.reservationMaxY    = Convert.ToInt32(reader["resYMax"].ToString());
                retval.reservationMinX    = Convert.ToInt32(reader["resXMin"].ToString());
                retval.reservationMinY    = Convert.ToInt32(reader["resYMin"].ToString());
                retval.reservationName    = (string)reader["resName"];
                retval.status             = Convert.ToInt32(reader["status"].ToString()) == 1;
                UUID tmp;
                UUID.TryParse(Convert.ToString(reader["userUUID"]), out tmp);
                retval.userUUID = tmp;
            }
            else
            {
                return(null);
            }
            return(retval);
        }
Пример #12
0
        public void CanInsertFacilityDownTime()
        {
            int resourceId = 80010; //Zygo NewView 5000
            int rid        = 0;
            int fdtid      = 0;

            using (ContextManager.StartRequest(1600))
            {
                // Create a reservation that starts at 10 am tomorrow.

                var data = new ReservationData()
                {
                    ClientID            = 1600,
                    ResourceID          = resourceId,
                    ActivityID          = 6,
                    AccountID           = 67,
                    Notes               = "Test Reservation",
                    AutoEnd             = true,
                    KeepAlive           = true,
                    ReservationDuration = new ReservationDuration(DateTime.Now.Date.AddDays(1).AddHours(10), TimeSpan.FromMinutes(5))
                };

                var rsv = ReservationUtility.Create(data);
                rid = rsv.ReservationID;
            }

            using (ContextManager.StartRequest(155))
            {
                int clientId = HttpContext.Current.CurrentUser().ClientID;

                DateTime sd = DateTime.Now.Date.AddDays(1).AddHours(9);
                DateTime ed = sd.AddHours(4);

                ReservationGroup group = FacilityDownTimeUtility.CreateFacilityDownTimeGroup(clientId, sd, ed);

                var result = FacilityDownTimeUtility.InsertFacilityDownTime(
                    resourceId: 80010,
                    groupId: group.GroupID,
                    clientId: clientId,
                    beginDateTime: sd,
                    endDateTime: ed,
                    notes: "EECS building fire drill"
                    );

                Assert.AreEqual(1, result.Existing.Count());
                Assert.AreEqual(rid, result.Existing.ElementAt(0).ReservationID);

                fdtid = result.ReservationID;

                var rsv = DA.Current.Single <Reservation>(fdtid);
                Assert.IsTrue(rsv.Activity.IsFacilityDownTime);
            }

            using (ContextManager.StartRequest(1301))
            {
                // clean up
                PurgeReservations(new[] { rid, fdtid });
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ReservationData reservationData = db.ReservationDatas.Find(id);

            db.ReservationDatas.Remove(reservationData);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public void Add(ReservationData reservationData)
 {
     Datas.Add(reservationData);
     if (reservationData.SenderUid == Uid)
     {
         OwnCount++;
     }
 }
Пример #15
0
 private void OnDeleteReservationCommand()
 {
     if (ReservationData.Contains(this.Reservation))
     {
         ReservationData.Remove(this.Reservation);
         this.Reservation = null;
     }
 }
 public ReservationController(ILogger <ReservationController> logger, [FromServices] EnvReader envReader, [FromServices] ReservationData reservationData, [FromServices] EmailService emailService, ZhaoContext context, UserManager <IdentityUser> userManager)
 {
     _logger          = logger;
     _envReader       = envReader;
     _reservationData = reservationData;
     _emailService    = emailService;
     _context         = context;
     _userManager     = userManager;
 }
 public ActionResult Edit([Bind(Include = "Id,AdultNumber,ChildernNumberNumber,DateFrom,DateTo")] ReservationData reservationData)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reservationData).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(reservationData));
 }
Пример #18
0
 public void SetData(ReservationAllData allData)
 {
     this.allData = allData;
     data         = new ReservationData()
     {
         ReservationId    = allData.ReservationId,
         SenderName       = allData.SenderName,
         SenderUid        = allData.SenderUid,
         StartUTCTimeTick = allData.StartUTCTimeTick,
     };
 }
Пример #19
0
        public Reservation(ReservationData reservationData)
        {
            this.ReservationData = reservationData;
            Seats = new List <string>();
            InitializeComponent();
            KinectRegion.SetKinectRegion(this, kinectRegion);
            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;
            this.kinectRegion.KinectSensor = KinectSensor.GetDefault();
            LoadData();
        }
        public IActionResult GetReservationJson(int id)
        {
            var reservation = _reservationManager.Get(id);
            var model       = new ReservationData();

            model.title     = reservation.Name;
            model.start     = reservation.StartDate;
            model.end       = reservation.EndDate;
            model.className = "colorTheme";

            return(Ok(model));
        }
        // GET: ReservationDatas/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ReservationData reservationData = db.ReservationDatas.Find(id);

            if (reservationData == null)
            {
                return(HttpNotFound());
            }
            return(View(reservationData));
        }
Пример #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Reading cookies
            HttpCookie resID = Request.Cookies["RES_ID"];

            res_id = resID != null?resID.Value.Split('=')[1] : "undefined";

            HttpCookie u_id   = Request.Cookies["USER_ID"];
            string     userID = u_id != null?u_id.Value.Split('=')[1] : "undefined";

            ReservationData rd = Facade.ShowExistingReservation(userID);

            lblUserReservation.Text = rd.locationDesc;
        }
Пример #23
0
 /// <summary>
 /// Actualizar un Reservacion
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public bool UpdateReservation(ReservationData data)
 {
     using (tecAirlinesEntities entities = new tecAirlinesEntities())
     {
         try
         {
             int entity = entities.udsp_up_reserva(data.Codigo, data.Equipaje);
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
Пример #24
0
        private void ButtonReserve_OnClick(object sender, RoutedEventArgs e)
        {
            var btn             = sender as Button;
            var now             = DateTime.Now;
            var houre           = int.Parse(btn.CommandParameter.ToString());
            var time            = new DateTime(now.Year, now.Month, now.Day, houre + 12, 0, 0);
            var reservationData = new ReservationData
            {
                MovieId         = this.MovieId,
                ReservationTime = time
            };
            var reservation = new Reservation(reservationData);

            reservation.Show();
            this.Hide();
        }
Пример #25
0
        protected void btnNavigate_Click(object sender, EventArgs e)
        {
            HttpCookie u_id   = Request.Cookies["USER_ID"];
            string     userID = u_id != null?u_id.Value.Split('=')[1] : "undefined";

            ReservationData rd = Facade.ShowExistingReservation(userID);

            int space_ID = rd.space_Id;

            //MessageBox.Show(""+space_ID);



            var url = Facade.NavigateToSpace(space_ID);

            Response.Redirect(url);
        }
Пример #26
0
 public IHttpActionResult AddReservation([FromBody] ReservationData data)
 {
     if (data == null)
     {
         //Bad request code 400
         return(BadRequest());
     }
     if (reservationLogic.AddReservation(data))
     {
         //petición correcta y se ha creado un nuevo recurso code 201
         return(StatusCode(HttpStatusCode.Created));
     }
     else
     {
         //No se pudo crear el recurso por un error interno code 500
         return(InternalServerError());
     }
 }
Пример #27
0
        private bool DeleteUserReservationData(ReservationData reservationData)
        {
            var mySQLReservationController = new MySQLReservationController();
            var allSqlReservationData      = mySQLReservationController.LoadReservationData(reservationData.PlayerData);

            var sqlReservationData = allSqlReservationData
                                     .Where(x => x.BossNumber == reservationData.BossNumber && x.BattleLap == reservationData.BattleLap)
                                     .ToList();

            if (sqlReservationData.Count == 0)
            {
                return(false);
            }

            mySQLReservationController.DeleteReservationData(sqlReservationData);

            return(true);
        }
Пример #28
0
        private void RegisterReservationData(ReservationData reservationData)
        {
            var mySQLReservationController = new MySQLReservationController();

            var allSqlReservationData = mySQLReservationController
                                        .LoadReservationData(reservationData.PlayerData);

            var doesExistReservationData = allSqlReservationData
                                           .Any(x => x.BossNumber == reservationData.BossNumber && x.BattleLap == reservationData.BattleLap);

            if (!doesExistReservationData)
            {
                mySQLReservationController.CreateReservationData(reservationData);
            }
            else
            {
                mySQLReservationController.UpdateReservationData(reservationData);
            }
        }
Пример #29
0
        private ReservationData GetReservationData(int resourceId, int clientId, int accountId, int activityId, bool autoEnd, bool keepAlive, string notes, DateTime selectedDate, int startTimeHour, int startTimeMinute, int duration)
        {
            var beginDateTime = selectedDate.AddHours(startTimeHour).AddMinutes(startTimeMinute);
            var rd            = ReservationDuration.FromMinutes(beginDateTime, duration);

            var result = new ReservationData()
            {
                ResourceID          = resourceId,
                ClientID            = clientId,
                AccountID           = accountId,
                ActivityID          = activityId,
                AutoEnd             = autoEnd,
                KeepAlive           = keepAlive,
                Notes               = notes,
                ReservationDuration = rd
            };

            return(result);
        }
Пример #30
0
        public IHttpActionResult GetReservation(int id)
        {
            if (!reservationLogic.ExistReservation(id))
            {
                //No se encontró el recurso code 404
                return(NotFound());
            }
            ReservationData user = reservationLogic.GetReservation(id);

            if (user != null)
            {
                // ok code 200
                return(Ok(user));
            }
            else
            {
                //No se pudo crear el recurso por un error interno code 500
                return(InternalServerError());
            }
        }
Пример #31
0
 /// <summary>
 /// Reads a reservation row from a database reader
 /// </summary>
 /// <param name="reader">An active database reader</param>
 /// <returns>A reservation data object</returns>
 public ReservationData readReservationRow(IDataReader reader)
 {
     ReservationData retval = new ReservationData();
     if (reader.Read())
     {
         retval.gridRecvKey = (string)reader["gridRecvKey"];
         retval.gridSendKey = (string)reader["gridSendKey"];
         retval.reservationCompany = (string)reader["resCompany"];
         retval.reservationMaxX = Convert.ToInt32(reader["resXMax"].ToString());
         retval.reservationMaxY = Convert.ToInt32(reader["resYMax"].ToString());
         retval.reservationMinX = Convert.ToInt32(reader["resXMin"].ToString());
         retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString());
         retval.reservationName = (string)reader["resName"];
         retval.status = Convert.ToInt32(reader["status"].ToString()) == 1;
         UUID tmp;
         UUID.TryParse(Convert.ToString(reader["userUUID"]), out tmp);
         retval.userUUID = tmp;
     }
     else
     {
         return null;
     }
     return retval;
 }
Пример #32
0
 public ReservationBusiness()
 {
     reservationData = new ReservationData();
 }