public ActionResult AddNewFlight(Add_New_FlightViewModel model)
 {
     int i = new Bal().AddFlight(model.txtfcompany, model.txtfno, model.txtsource, model.txtdestination, model.txtarrdate, model.txtArrivTime, model.txtdepdate, model.txtdeptime, model.txtamt, model.txtnoofseats);
     if (i > 0)
         TempData["message"] = "Flight Details Inserted Successfully";
     return View(@"~\Views\Admin\Add_New_Flight.cshtml", model);
 }
        public ActionResult UpdateFlight(string FlightNum, string userype, string isDelete, string isEdit, string source, string dest, string arrdt, string arrti, string depdt, string depti, string amt, string seats)
        {
            if (isDelete == "True")
            {
                new Bal().deleteFlightDetails(FlightNum);
            }
            else
            {

                new Bal().updateFlightDetails(source, dest, arrdt, arrti, depdt, depti, amt, seats, FlightNum);
            }
            var model = new List<Add_New_FlightViewModel>();

            DataTable dt = new Bal().getFlightDetails().Tables[0];


            foreach (DataRow row in dt.Rows)
            {
                Add_New_FlightViewModel addFlight = new Add_New_FlightViewModel();
                addFlight.txtfcompany = Convert.ToString(row["FlightCompany"]);
                addFlight.txtfno = Convert.ToString(row["FlightNumber"]);
                addFlight.txtsource = Convert.ToString(row["Source"]);
                addFlight.txtdestination = Convert.ToString(row["Destination"]);
                addFlight.txtarrdate = Convert.ToString(row["ArrivalDate"]);
                addFlight.txtArrivTime = Convert.ToString(row["Arrivaltime"]);
                addFlight.txtdepdate = Convert.ToString(row["DepatureDate"]);
                addFlight.txtdeptime = Convert.ToString(row["Deptime"]);
                addFlight.txtamt = Convert.ToString(row["PerSeatAmount"]);
                addFlight.txtnoofseats = Convert.ToString(row["NumberOfSeats"]);

                model.Add(addFlight);
            }
            return View(@"~\Views\Admin\View_Flight_Details.cshtml", model);
        }
        public ActionResult FlighDetails()
        {
            var model = new List<Add_New_FlightViewModel>();

            DataTable dt = new Bal().getFlightDetails().Tables[0];


            foreach (DataRow row in dt.Rows)
            {
                Add_New_FlightViewModel addFlight = new Add_New_FlightViewModel();
                addFlight.txtfcompany = Convert.ToString(row["FlightCompany"]);
                addFlight.txtfno = Convert.ToString(row["FlightNumber"]);
                addFlight.txtsource = Convert.ToString(row["Source"]);
                addFlight.txtdestination = Convert.ToString(row["Destination"]);
                addFlight.txtarrdate = Convert.ToString(row["ArrivalDate"]);
                addFlight.txtArrivTime = Convert.ToString(row["Arrivaltime"]);
                addFlight.txtdepdate = Convert.ToString(row["DepatureDate"]);
                addFlight.txtdeptime = Convert.ToString(row["Deptime"]);
                addFlight.txtamt = Convert.ToString(row["PerSeatAmount"]);
                addFlight.txtnoofseats = Convert.ToString(row["NumberOfSeats"]);

                model.Add(addFlight);
            }

            return View(@"~\Views\Admin\View_Flight_Details.cshtml", model);
        }
示例#4
0
        public ActionResult Search()
        {
            //now its working  mama don't do any changes
            var model = new List<Add_New_FlightViewModel>();
            if (Session["txtsource"] != null)
            {
                string from = Convert.ToString(Session["txtsource"]);
                string to = Convert.ToString(Session["txtdestination"]);
                DataTable dt = new Bal().SearchFlightDetails(from, to).Tables[0];
                foreach (DataRow row in dt.Rows)
                {
                    Add_New_FlightViewModel Flight = new Add_New_FlightViewModel();
                    Flight.txtfcompany = Convert.ToString(row["FlightCompany"]);
                    Flight.txtfno = Convert.ToString(row["FlightNumber"]);
                    Flight.txtsource = Convert.ToString(row["Source"]);
                    Flight.txtdestination = Convert.ToString(row["Destination"]);
                    Flight.txtarrdate = Convert.ToString(row["ArrivalDate"]);
                    Flight.txtArrivTime = Convert.ToString(row["Arrivaltime"]);
                    Flight.txtdepdate = Convert.ToString(row["DepatureDate"]);
                    Flight.txtdeptime = Convert.ToString(row["Deptime"]);
                    Flight.txtamt = Convert.ToString(row["PerSeatAmount"]);
                    Flight.txtnoofseats = Convert.ToString(row["AvailableSeats"]);

                    model.Add(Flight);
                }
            }

            else
            {
                DataTable dt = new Bal().getFlightDetails().Tables[0];
                foreach (DataRow row in dt.Rows)
                {
                    Add_New_FlightViewModel addFlight = new Add_New_FlightViewModel();
                    addFlight.txtfcompany = Convert.ToString(row["FlightCompany"]);
                    addFlight.txtfno = Convert.ToString(row["FlightNumber"]);
                    addFlight.txtsource = Convert.ToString(row["Source"]);
                    addFlight.txtdestination = Convert.ToString(row["Destination"]);
                    addFlight.txtarrdate = Convert.ToString(row["ArrivalDate"]);
                    addFlight.txtArrivTime = Convert.ToString(row["Arrivaltime"]);
                    addFlight.txtdepdate = Convert.ToString(row["DepatureDate"]);
                    addFlight.txtdeptime = Convert.ToString(row["Deptime"]);
                    addFlight.txtamt = Convert.ToString(row["PerSeatAmount"]);
                    addFlight.txtnoofseats = Convert.ToString(row["AvailableSeats"]);

                    model.Add(addFlight);
                }
            }
            return View(@"~\Views\Customer\SearchFlight.cshtml", model);
        }
示例#5
0
        public ActionResult Search2(Add_New_FlightViewModel s)
        {
            string fromstring = string.Empty;
            string tostring = string.Empty;

            string from=Request["txtsource"];
            string to=Request["txtdestination"];
           
            if (from!= ""&&from!=null)
            {
                Session["txtsource"] = from;
                
                fromstring = Session["txtsource"].ToString();
            }
            if (to != "" && to != null)
            {
                Session["txtdestination"] = to;
                tostring = Session["txtdestination"].ToString();
            }
            var model = new List<Add_New_FlightViewModel>();
            if (fromstring != null && tostring != null)
            {
                DataTable dt = new Bal().SearchFlightDetails(s.txtsource, s.txtdestination).Tables[0];
                foreach (DataRow row in dt.Rows)
                {
                    Add_New_FlightViewModel Flight = new Add_New_FlightViewModel();
                    Flight.txtfcompany = Convert.ToString(row["FlightCompany"]);
                    Flight.txtfno = Convert.ToString(row["FlightNumber"]);
                    Flight.txtsource = Convert.ToString(row["Source"]);
                    Flight.txtdestination = Convert.ToString(row["Destination"]);
                    Flight.txtarrdate = Convert.ToString(row["ArrivalDate"]);
                    Flight.txtArrivTime = Convert.ToString(row["Arrivaltime"]);
                    Flight.txtdepdate = Convert.ToString(row["DepatureDate"]);
                    Flight.txtdeptime = Convert.ToString(row["Deptime"]);
                    Flight.txtamt = Convert.ToString(row["PerSeatAmount"]);
                    Flight.txtnoofseats = Convert.ToString(row["NumberOfSeats"]);
                    Flight.txtavailseats = Convert.ToString(row["AvailableSeats"]);

                    model.Add(Flight);
                }
            }
            ViewBag.source = from;
            ViewBag.destination = to;
            //return View(@"~\Views\Customer\SearchFlight.cshtml", model);
            return RedirectToAction("Search");
        }
        //
        // GET: /Admin/

        public ActionResult EditFlight(string FlightNum, string userype)
        {

            DataTable sdr = new Bal().getFlightDetails(FlightNum).Tables[0];
            var flighDetails = new Add_New_FlightViewModel();

            foreach (DataRow row in sdr.Rows)
            {
                if (FlightNum == row["FlightNumber"].ToString())
                {
                    flighDetails.txtfcompany = row["FlightCompany"].ToString();
                    flighDetails.txtsource = row["Source"].ToString();
                    flighDetails.txtdestination = row["Destination"].ToString();
                    flighDetails.txtarrdate = row["ArrivalDate"].ToString();
                    flighDetails.txtArrivTime = row["Arrivaltime"].ToString();
                    flighDetails.txtdepdate = row["DepatureDate"].ToString();
                    flighDetails.txtdeptime = row["Deptime"].ToString();
                    flighDetails.txtnoofseats = row["NumberOfSeats"].ToString();
                    flighDetails.txtamt = row["PerSeatAmount"].ToString();
                    flighDetails.txtfno = row["FlightNumber"].ToString();
                }
            }
            return View(@"~\Views\Admin\Edit_New_Flight.cshtml", flighDetails);
        }