public AddMemberViewModel()
 {
     Member         = new FamilyMemberModel();
     checkDuplicate = new CheckDuplicate();
     User           = new UserModel();
     API            = new APIHelper();
 }
예제 #2
0
 //Constructor to Add New DB Config Information
 public frmEditDBConfig(CheckDuplicate check, SetDBInfo set_db_info, SetDBSerial set_serial, GateWayManager gwm, int index)
 {
     InitializeComponent();
     this.isEdit             = false;
     this.gateway_mgr        = gwm;;
     this.serial_index       = index;
     this.delgCheckDuplicate = check;
     this.delgSetDBInfo      = set_db_info;
     this.delgSetDBSerial    = set_serial;
 }
 public SignUpViewModel()
 {
     checkDuplicate = new CheckDuplicate();
     User           = new UserModel();
     API            = new APIHelper();
 }
        public PriceScreenRecordDto GetCreatePriceScreenRecord(int cruiseId)
        {
            _unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant);
            int workingYear = DateTime.Now.Year;

            try
            {
                IEnumerable <ISettingValue> listSettings = SettingManager.GetAllSettingValuesForUserAsync(AbpSession.ToUserIdentifier()).Result;
                if (listSettings != null)
                {
                    if (listSettings.Where(o => o.Name == AppSettings.UserManagement.WorkingYear).SingleOrDefault() != null)
                    {
                        workingYear = Convert.ToInt32(listSettings.Where(o => o.Name == AppSettings.UserManagement.WorkingYear).SingleOrDefault().Value);
                    }
                }
            }
            catch (Exception)
            {
            }

            PriceScreenRecordDto priceScreenRecordDto = new PriceScreenRecordDto();

            try
            {
                string defaultCurrency = SettingManager.GetSettingValueForApplicationAsync(AppSettings.DefaultCurrency).Result;

                //var fares = _lookup_cruiseFaresRepository.GetAll().Where(x => x.Id == fareId).FirstOrDefault();
                var seasonGroups = _lookup_cruiseDeparturesRepository.GetAll().Where(x => x.CruisesId == cruiseId && x.DepartureYear == workingYear).
                                   Select(m => new { m.SeasonGroup }).Distinct();
                var cruises = _cruisesRepository.GetAll().Where(x => x.Id == cruiseId).FirstOrDefault();
                var deckIds = _lookup_cruiseShipCabinsRepository.GetAll().Where(x => x.CruiseShipsId == cruises.CruiseShipsId)
                              .Select(m => new { m.CruiseShipDecksId, m.Id, m.CabinTypeID }).Distinct();

                var _lookupCruiseServices = _cruiseServicesRepository.FirstOrDefault((int)cruises.CruiseServicesId);
                var serviceUnit           = _cruiseServiceUnitsRepository.FirstOrDefault((int)_lookupCruiseServices.CruiseServiceUnitsId);
                var masterAmenities       = _cruiseMasterAmenitiesRepository.GetAll().Where(x => x.Id == serviceUnit.ServiceUnit.Value).FirstOrDefault();


                // var distinctgroupSubscriptions = deckIds.GroupBy(m => new { m.CruiseShipDecksId, m.Id, m.CabinTypeID })
                //                                .Select(group => group.First()).ToList();
                List <CheckDuplicate> checkDuplicatesDecks = new List <CheckDuplicate>();
                foreach (var deckId in deckIds)
                {
                    var match = checkDuplicatesDecks.FirstOrDefault(x => x.CabinTypeID == deckId.CabinTypeID && x.CruiseShipDecksId == deckId.CruiseShipDecksId);
                    if (match == null)
                    {
                        CheckDuplicate checkDuplicatevalues = new CheckDuplicate();
                        checkDuplicatevalues.CruiseShipDecksId = deckId.CruiseShipDecksId.Value;
                        checkDuplicatevalues.Id          = deckId.Id;
                        checkDuplicatevalues.CabinTypeID = deckId.CabinTypeID;
                        checkDuplicatesDecks.Add(checkDuplicatevalues);
                    }
                }
                priceScreenRecordDto.FareId         = 0;
                priceScreenRecordDto.CruiseId       = cruiseId;
                priceScreenRecordDto.CruiseShipsId  = cruises.CruiseShipsId.Value;
                priceScreenRecordDto.DefaultCurency = defaultCurrency;
                priceScreenRecordDto.ServiceUnit    = masterAmenities.DisplayName.ToString();

                priceScreenRecordDto.SeasonGroup = new List <SeasonGroups>();
                foreach (var item in seasonGroups)
                {
                    SeasonGroups objSeasonGroup = new SeasonGroups();
                    objSeasonGroup.SeasonGroupName = item.SeasonGroup;
                    priceScreenRecordDto.SeasonGroup.Add(objSeasonGroup);
                }
                priceScreenRecordDto.ShipCabinDetail = new List <ShipCabinDetails>();
                foreach (var deckId in checkDuplicatesDecks)
                {
                    ShipCabinDetails objShipCabinDetails = new ShipCabinDetails();

                    //var ShipDecks = _cruiseShipDecksRepository.GetAll().Where(x => x.Id == deckId.CruiseShipDecksId).FirstOrDefault();
                    var deckName  = _cruiseMasterAmenitiesRepository.GetAll().Where(x => x.Id == deckId.CruiseShipDecksId).Select(m => new { m.DisplayName }).FirstOrDefault();
                    var cabinType = _cruiseMasterAmenitiesRepository.GetAll().Where(x => x.Id == deckId.CabinTypeID).Select(m => new { m.DisplayName }).FirstOrDefault();

                    objShipCabinDetails.CruiseShipDecksId = deckId.CruiseShipDecksId;
                    objShipCabinDetails.Id          = deckId.Id;
                    objShipCabinDetails.CabinTypeID = deckId.CabinTypeID;
                    objShipCabinDetails.DeckName    = deckName.DisplayName;
                    objShipCabinDetails.CabinType   = cabinType.DisplayName;

                    priceScreenRecordDto.ShipCabinDetail.Add(objShipCabinDetails);
                }
            }
            catch (Exception ex)
            {
            }
            return(priceScreenRecordDto);
        }