Beispiel #1
0
        public ServiceResponse Edit(FlightInquiryModel model)
        {
            try
            {
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    var result = _ent.B2CFlightInquiry.Where(x => x.FlightInquiryId == model.PId).FirstOrDefault();
                    if (result != null)
                    {
                        result.Status = model.Status;

                        _ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
                        _ent.SaveChanges();
                    }
                    ts.Complete();
                    _response = new ServiceResponse("Record successfully updated!!", MessageType.Success, true, "Edit");
                }
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Edit");
            }
            return(_response);
        }
Beispiel #2
0
        public ActionResult ActionSaveUpdate(FlightInquiryModel model, string tranMode)
        {
            int    id       = model.PId;
            string saveMode = string.Empty;

            GetViewModel(id, tranMode, true);

            string viewPagePath = string.Empty;
            string vucPagePath  = "VUC_Add";

            if (ModelState.IsValid)
            {
                try
                {
                    _response = _provider.ActionSaveUpdate(model, tranMode);
                }
                catch (Exception ex)
                {
                    _response = new ServiceResponse(ex.Message, MessageType.Exception, false);
                }
            }
            else
            {
                _response = new ServiceResponse("Invalid Fields. Please fill mandatory fields!!", MessageType.Error, false);
            }
            TempData["ActionResponse"] = _response;
            if (Request.IsAjaxRequest())
            {
                return(PartialView(vucPagePath, _modObj));
            }
            else
            {
                return(View(viewPagePath, _modObj));
            }
        }
Beispiel #3
0
        public IEnumerable <FlightInquiryModel> GetList()
        {
            List <FlightInquiryModel> model = new List <FlightInquiryModel>();
            var result = _ent.B2CFlightInquiry;//.OrderBy(x => x.);

            foreach (var item in result)
            {
                FlightInquiryModel obj = new FlightInquiryModel
                {
                    PId         = item.FlightInquiryId,
                    FlightType  = item.FlightType,
                    JourneyType = item.JourneyType,

                    HddnOriginCityId    = item.OriginCity,
                    HddnDepartureCityId = item.DepartureCity,
                    DepartureDate       = item.DepartureDate,
                    ReturnDate          = item.ReturnDate,
                    NoOfAdult           = item.NoOfAdult,
                    NoOfChildren        = item.NoOfChildren,
                    NoOfInfant          = item.NoOfInfant,
                    PassengerNumber     = item.PassengerNumber,
                    CabinClass          = item.CabinClass,
                    Nationality         = item.Nationality,
                    AirlinePreference   = item.AirlinePreference,
                    Status = item.Status,
                };
                model.Add(obj);
            }

            return(model.AsEnumerable());
        }
Beispiel #4
0
        private FlightInquiryModel GetViewModel(int id, string tranMode, bool isPost = false)
        {
            ///tranMode = "N" , "U", "L", "V"

            if (id != 0 && isPost == false)
            {
                _modObj = _provider.GetDetails(id);
            }

            SetUpFormParams(tranMode);
            return(_modObj);
        }
Beispiel #5
0
 public ActionResult Add(FlightInquiryModel model)
 {
     //return ActionSaveUpdate(model, "N");
     ActionSaveUpdate(model, "N");
     if (_response.ResponseStatus == true)
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View("Add", _modObj));
     }
 }
Beispiel #6
0
        public FlightInquiryModel GetDetails(int PId)
        {
            var result             = _ent.B2CFlightInquiry.Where(x => x.FlightInquiryId == PId).FirstOrDefault();
            FlightInquiryModel obj = new FlightInquiryModel
            {
                PId                 = result.FlightInquiryId,
                FlightType          = result.FlightType,
                JourneyType         = result.JourneyType,
                HddnOriginCityId    = result.OriginCity,
                HddnDepartureCityId = result.DepartureCity,
                //OriginCity = result.OriginCity.
                DepartureDate     = result.DepartureDate,
                ReturnDate        = result.ReturnDate,
                NoOfAdult         = result.NoOfAdult,
                NoOfChildren      = result.NoOfChildren,
                NoOfInfant        = result.NoOfInfant,
                PassengerNumber   = result.PassengerNumber,
                CabinClass        = result.CabinClass,
                Nationality       = result.Nationality,
                AirlinePreference = result.AirlinePreference,
                Status            = result.Status,
                ContactName       = result.ContactName,
                ContactNumber     = result.ContactNumber,
                EmailAddress      = result.EmailAddress,
                CompanyAgentName  = result.CompanyAgentName,

                FlightInquiryPax = (from a in _ent.B2CFlightInquiryPax
                                    where a.FlightInquiryId == PId
                                    select new FlightInquiryPaxModel {
                    FlightInquiryPaxId = a.FlightInquiryPaxId,
                    FlightInquiryId = a.FlightInquiryId,
                    Title = a.Title,
                    FirstName = a.FirstName,
                    MiddleName = a.MiddleName,
                    LastName = a.LastName,
                    Gender = a.Gender,
                    PassengerType = a.PassengerType,
                    ContactNumber = a.ContactNumber,
                    EmailAddress = a.EmailAddress,
                }).OrderBy(x => x.PassengerType).ToList(),
            };

            return(obj);
        }
Beispiel #7
0
        public ServiceResponse ActionSaveUpdate(FlightInquiryModel model, string tranMode)
        {
            try
            {
                if (tranMode == "N")
                {
                }
                else if (tranMode == "U")
                {
                    return(Edit(model));
                }
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false);
            }

            return(_response);
        }
Beispiel #8
0
 public ActionResult Edit(int id, FlightInquiryModel model)
 {
     model.PId = id;
     return(ActionSaveUpdate(model, "U"));
 }
Beispiel #9
0
 public ActionResult Page(int?page, string extraParams)
 {
     _modObj = GetViewModelList(page);
     return(View("Index", _modObj));
 }