public ActionResult ActionSaveUpdate(AirPackageCustomizeInquiryModel 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));
            }
        }
Esempio n. 2
0
        public IEnumerable <AirPackageCustomizeInquiryModel> GetList()
        {
            int sno = 0;
            List <AirPackageCustomizeInquiryModel> model = new List <AirPackageCustomizeInquiryModel>();
            var result = _ent.Core_PackagesCustomizeInquiries;

            foreach (var item in result)
            {
                sno++;
                AirPackageCustomizeInquiryModel obj = new AirPackageCustomizeInquiryModel
                {
                    SNO             = sno,
                    PId             = item.InquiryId,
                    AgentId         = item.AgentId,
                    TravelDateStart = item.TravelDateStart,
                    TravelDateEnd   = item.TravelDateEnd,
                    Name            = item.Name,
                    EmailAddress    = item.EmailAddress,
                    NoOfAdult       = item.NoOfAdult,
                    NoOfChild       = item.NoOfChild,
                    ContactNo       = item.ContactNo,
                    Remark          = item.Remark,
                    Status          = item.Status,
                };
                model.Add(obj);
            }

            return(model.AsEnumerable());
        }
        private AirPackageCustomizeInquiryModel 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);
        }
 public ActionResult Add(AirPackageCustomizeInquiryModel model)
 {
     //return ActionSaveUpdate(model, "N");
     ActionSaveUpdate(model, "N");
     if (_response.ResponseStatus == true)
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View("Add", _modObj));
     }
 }
Esempio n. 5
0
        public AirPackageCustomizeInquiryModel GetDetails(int PId)
        {
            var result = _ent.Core_PackagesCustomizeInquiries.Where(x => x.InquiryId == PId).FirstOrDefault();
            AirPackageCustomizeInquiryModel obj = new AirPackageCustomizeInquiryModel
            {
                PId             = result.InquiryId,
                AgentId         = result.AgentId,
                TravelDateStart = result.TravelDateStart,
                TravelDateEnd   = result.TravelDateEnd,
                Name            = result.Name,
                EmailAddress    = result.EmailAddress,
                NoOfAdult       = result.NoOfAdult,
                NoOfChild       = result.NoOfChild,
                ContactNo       = result.ContactNo,
                Remark          = result.Remark,
                Status          = result.Status,
            };

            return(obj);
        }
Esempio n. 6
0
        public ServiceResponse Edit(AirPackageCustomizeInquiryModel model)
        {
            try
            {
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    var result = _ent.Core_PackagesCustomizeInquiries.Where(x => x.InquiryId == model.PId).FirstOrDefault();
                    if (result != null)
                    {
                        result.AgentId         = model.AgentId;
                        result.TravelDateStart = model.TravelDateStart;
                        result.TravelDateEnd   = model.TravelDateEnd;
                        result.Name            = model.Name;
                        result.EmailAddress    = model.EmailAddress;
                        result.NoOfAdult       = model.NoOfAdult;
                        result.NoOfChild       = model.NoOfChild;
                        result.ContactNo       = model.ContactNo;
                        result.Remark          = model.Remark;
                        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);
        }
Esempio n. 7
0
 public ServiceResponse Save(AirPackageCustomizeInquiryModel model)
 {
     try
     {
         using (var ts = new TransactionScope(TransactionScopeOption.Required))
         {
             Core_PackagesCustomizeInquiries obj = new Core_PackagesCustomizeInquiries
             {
                 AgentId         = model.AgentId,
                 TravelDateStart = model.TravelDateStart,
                 TravelDateEnd   = model.TravelDateEnd,
                 Name            = model.Name,
                 EmailAddress    = model.EmailAddress,
                 NoOfAdult       = model.NoOfAdult,
                 NoOfChild       = model.NoOfChild,
                 ContactNo       = model.ContactNo,
                 Remark          = model.Remark,
                 Status          = model.Status,
             };
             _ent.AddToCore_PackagesCustomizeInquiries(obj);
             _ent.SaveChanges();
             ts.Complete();
             _response = new ServiceResponse("Record successfully created!!", MessageType.Success, true, "Edit");
             return(_response);
         }
     }
     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);
 }
Esempio n. 8
0
        public ServiceResponse ActionSaveUpdate(AirPackageCustomizeInquiryModel model, string tranMode)
        {
            try
            {
                if (tranMode == "N")
                {
                    return(Save(model));
                }
                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);
        }
 public ActionResult Edit(int id, AirPackageCustomizeInquiryModel model)
 {
     model.PId = id;
     return(ActionSaveUpdate(model, "U"));
 }
 public ActionResult Page(int?page, string extraParams)
 {
     _modObj = GetViewModelList(page);
     return(View("Index", _modObj));
 }