Exemple #1
0
        //[Authorize(Roles = "Administrador")]
        public ActionResult DeleteItem(int id)
        {
            var deleted = "";

            try
            {
                //Delete Transfer Estimate
                TransferEstimate transferEstimate = db.TransferEstimate.Find(id);
                db.TransferEstimate.Remove(transferEstimate);
                db.SaveChanges();

                //Delete All Send Transfer by Transfer Estimate
                db.TransferSend.Where(p => p.IdTransEst == id)
                .ToList().ForEach(p => db.TransferSend.Remove(p));
                db.SaveChanges();

                //Delete Events by Transfer Estimate
                db.Events.Where(p => p.IdTransEst == id).ToList().ForEach(p => db.Events.Remove(p));
                db.SaveChanges();

                deleted = "true";
            }
            catch (Exception)
            {
                deleted = "false";
                throw;
            }



            return(Json(new { success = true, deleted },
                        JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            TransferEstimate transferEstimate = db.TransferEstimate.Find(id);

            db.TransferEstimate.Remove(transferEstimate);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #3
0
        // GET: TransferEstimate/Details/5
        //[Authorize(Roles = "Administrador")]
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TransferEstimate transferEstimate = db.TransferEstimate.Find(id);

            if (transferEstimate == null)
            {
                return(HttpNotFound());
            }
            return(View(transferEstimate));
        }
Exemple #4
0
 //[Authorize(Roles = "Administrador")]
 public ActionResult Edit([Bind(Include = "IdTransEst,FlightNumber,DateFligh,TimeFligh,TimePiDo,IdMetingPoint,QtyPassenger,QtyPassengerKids,QtyMalaGr,QtyMalaPq,CityFromId,CityToId,TransferAmount,Discount,FinalPrice,DateTransEst,DateAprove,DateRequestEstimate,NamePassenger,Phone,Phone2,Email,TypeVisa,Note,IdAprove,IdTypeDestination,IdDestination,IdSales,IdTypeTransfer,IdTypePayment,IdStatusPayment")] TransferEstimate transferEstimate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(transferEstimate).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdDestination     = new SelectList(db.Destination, "IdDestination", "Name", transferEstimate.IdDestination);
     ViewBag.IdMetingPoint     = new SelectList(db.MetingPoint, "IdMetingPoint", "DescMetingPoint", transferEstimate.IdMetingPoint);
     ViewBag.CityFromId        = new SelectList(db.PriceCities, "IdCity", "City", transferEstimate.CityFromId);
     ViewBag.CityToId          = new SelectList(db.PriceCities, "IdCity", "City", transferEstimate.CityToId);
     ViewBag.IdSales           = new SelectList(db.SalesContact, "IdSalesContact", "Contact", transferEstimate.IdSales);
     ViewBag.IdStatusPayment   = new SelectList(db.StatusPayment, "IdStatusPayment", "DescStatusPayment", transferEstimate.IdStatusPayment);
     ViewBag.IdAprove          = new SelectList(db.TransferAprove, "IdAprove", "DescAprove", transferEstimate.IdAprove);
     ViewBag.IdTypeDestination = new SelectList(db.TypeDestination, "IdTypeDestination", "DescTypeDestination", transferEstimate.IdTypeDestination);
     ViewBag.IdTypePayment     = new SelectList(db.TypePayment, "IdTypePayment", "DescTypePayment", transferEstimate.IdTypePayment);
     ViewBag.IdTypeTransfer    = new SelectList(db.TypeTransfer, "IdTypeTransfer", "DescType", transferEstimate.IdTypeTransfer);
     return(View(transferEstimate));
 }
Exemple #5
0
        // GET: TransferEstimate/Edit/5
        //[Authorize(Roles = "Administrador")]
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TransferEstimate transferEstimate = db.TransferEstimate.Find(id);

            if (transferEstimate == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdDestination     = new SelectList(db.Destination, "IdDestination", "Name", transferEstimate.IdDestination);
            ViewBag.IdMetingPoint     = new SelectList(db.MetingPoint, "IdMetingPoint", "DescMetingPoint", transferEstimate.IdMetingPoint);
            ViewBag.CityFromId        = new SelectList(db.PriceCities, "IdCity", "City", transferEstimate.CityFromId);
            ViewBag.CityToId          = new SelectList(db.PriceCities, "IdCity", "City", transferEstimate.CityToId);
            ViewBag.IdSales           = new SelectList(db.SalesContact, "IdSalesContact", "Contact", transferEstimate.IdSales);
            ViewBag.IdStatusPayment   = new SelectList(db.StatusPayment, "IdStatusPayment", "DescStatusPayment", transferEstimate.IdStatusPayment);
            ViewBag.IdAprove          = new SelectList(db.TransferAprove, "IdAprove", "DescAprove", transferEstimate.IdAprove);
            ViewBag.IdTypeDestination = new SelectList(db.TypeDestination, "IdTypeDestination", "DescTypeDestination", transferEstimate.IdTypeDestination);
            ViewBag.IdTypePayment     = new SelectList(db.TypePayment, "IdTypePayment", "DescTypePayment", transferEstimate.IdTypePayment);
            ViewBag.IdTypeTransfer    = new SelectList(db.TypeTransfer, "IdTypeTransfer", "DescType", transferEstimate.IdTypeTransfer);
            return(View(transferEstimate));
        }
Exemple #6
0
        protected void SaveTranferTestimate()
        {
            atripservicesEntities DBTrip = new atripservicesEntities();
            TransferEstimate      te     = new TransferEstimate();
            Passenger             pa     = new Passenger();
            ReservationRequest    rr     = new ReservationRequest();
            LastIPReservation     ip     = new LastIPReservation();

            DeleteLastIdYesterday();

            if (VerifyLastIP(Request.UserHostAddress.ToString()) == false)
            {
                Library.DisplayAtertSweet(this, "Você já pediu uma reserva!", "Aguarde seu pedido ser processado, logo lhe enviaremos um email.", Library.MessageType.Info);
                return;
            }

            //Transfer Estimate
            te.FlightNumber = txtFlightNumber.Text.ToUpper();
            if (!String.IsNullOrEmpty(txtDateVoo.Text))
            {
                te.DateFligh = Convert.ToDateTime(txtDateVoo.Text);
            }
            else
            {
                te.DateFligh = null;
            }
            if (!String.IsNullOrEmpty(txtTimeVoo.Text))
            {
                te.TimeFligh = txtTimeVoo.Text;
            }
            else
            {
                te.TimeFligh = null;
            }
            if (!String.IsNullOrEmpty(txtTime.Text))
            {
                te.TimePiDo = txtTime.Text;
            }
            else
            {
                te.TimePiDo = null;
            }
            if (!String.IsNullOrEmpty(txtDateEstimate.Text))
            {
                te.DateTransEst = Convert.ToDateTime(txtDateEstimate.Text);
            }
            else
            {
                te.DateTransEst = null;
            }
            te.DateAprove          = null;
            te.DateRequestEstimate = DateTime.Now;
            te.Discount            = 0;
            te.IdMetingPoint       = 1;
            te.QtyPassenger        = Convert.ToInt32(ddlQtyPassenger.SelectedValue);
            te.QtyPassengerKids    = Convert.ToInt32(ddlQtyKids.SelectedValue);
            te.QtyMalaGr           = Convert.ToInt32(ddlQtyLuggage.SelectedValue);

            te.QtyMalaPq      = Convert.ToInt32(ddlQtyCarryon.SelectedValue);
            te.CityFromId     = 1;
            te.CityToId       = Convert.ToInt32(ddlCityTo.SelectedValue);
            te.TransferAmount = 0;
            te.Discount       = null;

            te.FinalPrice = FinalPrice;

            te.NamePassenger = txtNamePassenger.Text;
            te.Phone         = txtPhonePassenger.Text;
            te.Phone2        = "";
            te.Email         = txtEmailPassenger.Text;
            te.TypeVisa      = ddlTypeVisa.SelectedItem.ToString();

            te.Note              = "Reservation Request";
            te.IdAprove          = 0;
            te.IdTypeDestination = Convert.ToInt32(ddlTypeDestination.SelectedValue);
            te.IdDestination     = 1;
            te.IdSales           = 1;
            te.IdTypeTransfer    = Convert.ToInt32(ddlTypeTransfer.SelectedValue);
            te.IdTypePayment     = 0;
            te.IdStatusPayment   = 0;

            DBTrip.TransferEstimate.Add(te);
            DBTrip.SaveChanges();

            var idte = te.IdTransEst;

            //Verify IP
            ip.IP = Request.UserHostAddress.ToString();
            ip.DateReservation = DateTime.Now;

            DBTrip.LastIPReservation.Add(ip);
            DBTrip.SaveChanges();

            //Passenger
            pa.Name       = txtNamePassenger.Text;
            pa.Phone      = txtPhonePassenger.Text;
            pa.Phone2     = "";
            pa.Email      = txtEmailPassenger.Text;
            pa.IdTypeVisa = Convert.ToInt32(ddlTypeVisa.SelectedValue);

            DBTrip.Passenger.Add(pa);
            DBTrip.SaveChanges();

            var idpa = pa.IdPassenger;

            //Reservation Request (Destination)
            rr.NamePD              = txtNameDestination.Text;
            rr.AddressPD           = txtAddress.Text;
            rr.PostalCodePD        = txtPostalCode.Text;
            rr.PhonePD             = txtPhoneContact.Text;
            rr.MobilePD            = "";
            rr.IdCityPD            = Convert.ToInt32(ddlCityTo.SelectedValue);
            rr.IdTypeDestinationPD = Convert.ToInt32(ddlTypeDestination.SelectedValue);
            rr.IdPassenger         = idpa;
            rr.IdTransferEst       = idte;

            DBTrip.ReservationRequest.Add(rr);
            DBTrip.SaveChanges();

            ClearReservation();

            if (lblSend.Text == "Send")
            {
                Library.DisplayAtertSweet(this, "Success!", "Your reservation request was sent successfully! Wait for our contact.", Library.MessageType.Success);
            }

            if (lblSend.Text == "Enviar")
            {
                Library.DisplayAtertSweet(this, "Pedido Enviado!", "Seu pedido de reserva foi enviado com sucesso! Aguarde nosso contato.", Library.MessageType.Success);
            }

            if (lblSend.Text == "Enviar ")
            {
                Library.DisplayAtertSweet(this, "Éxito!", "Su solicitud de reserva fue enviada con éxito! Espera nuestro contacto.", Library.MessageType.Success);
            }
            ClearReservation();
        }