예제 #1
0
        /// <summary>
        /// Gets the profile.
        /// </summary>
        /// <param name="secondLevelProfile">The second level profile.</param>
        /// <param name="firstLevelProfile">The first level profile.</param>
        /// <param name="connectionString">The connection string.</param>
        /// <returns></returns>
        private InterJetProfile GetProfile(string secondLevelProfile, string firstLevelProfile, string connectionString)
        {
            Database  dataBase        = DatabaseFactory.CreateDatabase(connectionString);
            DbCommand dataBaseCommand = dataBase.GetStoredProcCommand("GetInterJetProfile");

            dataBase.AddInParameter(dataBaseCommand, "input", DbType.String, secondLevelProfile);

            using (IDataReader dataReader = dataBase.ExecuteReader(dataBaseCommand))
            {
                int id          = dataReader.GetOrdinal("Id");
                int name        = dataReader.GetOrdinal("Name");
                int lastName    = dataReader.GetOrdinal("LastName");
                int birthtDay   = dataReader.GetOrdinal("Birthday");
                int fristLevel  = dataReader.GetOrdinal("Level1");
                int secondLevel = dataReader.GetOrdinal("Level2");
                int creditCard  = dataReader.GetOrdinal("CreditCar");
                int email       = dataReader.GetOrdinal("Email");
                int phone       = dataReader.GetOrdinal("OfficePhone");
                int creditCard2 = dataReader.GetOrdinal("CreditCard2");
                int creditCard3 = dataReader.GetOrdinal("CreditCard3");
                int creditCard4 = dataReader.GetOrdinal("CreditCard4");
                int creditCard5 = dataReader.GetOrdinal("CreditCard5");
                int creditCard6 = dataReader.GetOrdinal("CreditCard6");
                int creditCard7 = dataReader.GetOrdinal("CreditCard7");
                int creditCard8 = dataReader.GetOrdinal("CreditCard8");
                var profiles    = new List <InterJetProfile>();
                while (dataReader.Read())
                {
                    var profile = new InterJetProfile();
                    profile.Id                 = dataReader.GetInt32(id);
                    profile.Name               = dataReader.GetString(name);
                    profile.Email              = dataReader.GetString(email);
                    profile.Phone              = dataReader.GetString(phone);
                    profile.LastName           = dataReader.GetString(lastName);
                    profile.FirstLevelProfile  = dataReader.GetString(fristLevel);
                    profile.SecondLevelProfile = dataReader.GetString(secondLevel);
                    profile.BirthDay           = this.GetBirthDay(dataReader.GetString(birthtDay));
                    profile.CreditCards        = new InterJetProfileCreditCards();
                    profile.CreditCards.Add(new InterJetProfileCreditCard((dataReader[creditCard] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard), false));
                    profile.CreditCards.Add(new InterJetProfileCreditCard((dataReader[creditCard2] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard2), false));
                    profile.CreditCards.Add(new InterJetProfileCreditCard((dataReader[creditCard3] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard3), false));
                    profile.CreditCards.Add(new InterJetProfileCreditCard((dataReader[creditCard4] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard4), false));
                    profile.CreditCards.Add(new InterJetProfileCreditCard((dataReader[creditCard5] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard5), false));
                    profile.CreditCards.Add(new InterJetProfileCreditCard((dataReader[creditCard6] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard6), false));
                    profile.CreditCards.Add(new InterJetProfileCreditCard((dataReader[creditCard7] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard7), false));
                    profile.CreditCards.Add(new InterJetProfileCreditCard((dataReader[creditCard8] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard8), false));
                    profiles.Add(profile);
                }
                if (profiles.Any())
                {
                    var resultedProfile = profiles.FirstOrDefault(p => p.FirstLevelProfile.Equals(firstLevelProfile)
                                                                  &&
                                                                  p.SecondLevelProfile.Equals(secondLevelProfile));

                    return(resultedProfile);
                }
            }

            return(new InterJetProfile());
        }
예제 #2
0
        /// <summary>
        /// Enables the options.
        /// </summary>
        /// <param name="profile">The profile.</param>
        public void EnableOptions(InterJetProfile profile)
        {
            var creditCards = profile.CreditCards;

            if (creditCards.GetCards().Any())
            {
                if (creditCards.HasCreditCardsInFristLevel)
                {
                    this.EnableFristLevelOptions(true);
                }
                else
                {
                    this.EnableFristLevelOptions(false);
                }

                if (creditCards.HasCreditCardsInSecondLevel)
                {
                    this.EnableSecondLevelOptions(true);
                }
                else
                {
                    this.EnableSecondLevelOptions(false);
                }
            }
        }
        /// <summary>
        /// Handles the DoWork event of the ProfileWorker control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.ComponentModel.DoWorkEventArgs"/> instance containing the event data.</param>
        void ProfileWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            var profileLevel = (ProfileLevel)e.Argument;

            InterJetProfile profile = ProfileService.GetProfile(profileLevel.SecondLevel, profileLevel.FristLevel);

            e.Result = profile;
        }
        /// <summary>
        /// Handles the DoWork event of the ProfileWorker control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.ComponentModel.DoWorkEventArgs"/> instance containing the event data.</param>
        void ProfileWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            var             profileLevel = (ProfileLevel)e.Argument;
            InterJetProfile profile      = ProfileService.GetProfile(profileLevel.SecondLevel, profileLevel.FristLevel);

            if (VolarisSession.IsVolarisProcess)
            {
                VolarisSession.Profile         = true;
                VolarisSession.InterJetProfile = profile;
            }
            PasajeroSessionPersonal = profile;
            e.Result = profile;
        }
        /// <summary>
        /// Sets the profile.
        /// </summary>
        /// <param name="profile">The profile.</param>
        public void SetProfile(InterJetProfile profile)
        {
            if (profile != null)
            {
                TextBox nameTextBox = this.GetTextBoxByName("Name_");
                nameTextBox.Text = profile.Name;


                TextBox lastNameTextBox = this.GetTextBoxByName("LastName");
                lastNameTextBox.Text = profile.LastName;

                this.CurrentUserControl.DateOfBirth = profile.BirthDay;
            }
        }
        /// <summary>
        /// Sets the profile to passanger.
        /// </summary>
        /// <param name="profile">The profile.</param>
        private void SetProfileToPassanger(InterJetProfile profile)
        {
            var panelsWithGroupBoxes = this.PassangerGroupBox.Controls.OfType <Panel>();
            var panelWithAPassanger  =
                panelsWithGroupBoxes.FirstOrDefault(
                    panel => panel.Controls.OfType <ucInterJetPassangerCapture>().FirstOrDefault() != null);

            var control =
                panelWithAPassanger.Controls.OfType <ucInterJetPassangerCapture>().FirstOrDefault();

            if (control != null)
            {
                control.HasAProfile = true;
                control.Profile     = profile;
            }
        }
예제 #7
0
        /// <summary>
        /// Sets the profile.
        /// </summary>
        /// <param name="profile">The profile.</param>
        public void SetProfile(InterJetProfile profile)
        {
            this.CurrentForm.Text = string.Format("Tarjetas de primer y segundo nivel del perfil :{0}",
                                                  profile.SecondLevelProfile);
            this.Profile = profile;
            var creditCards = profile.CreditCards;

            if (creditCards.GetCards().Any())
            {
                if (creditCards.HasCreditCardsInFristLevel)
                {
                    this.EnableFristLevelOptions(true);
                    this.BindFristLevelCards(profile.CreditCards);
                }
                if (creditCards.HasCreditCardsInSecondLevel)
                {
                    this.EnableSecondLevelOptions(true);
                    this.BindSecondLevelCards(profile.CreditCards);
                }
            }
        }
 /// <summary>
 /// Sets the profile to passanger.
 /// </summary>
 /// <param name="profile">The profile.</param>
 private void SetProfileToPassanger(InterJetProfile profile)
 {
     try
     {
         var panelsWithGroupBoxes = this.PassangerGroupBox.Controls.OfType <Panel>();
         var panelWithAPassanger  =
             panelsWithGroupBoxes.FirstOrDefault(
                 panel => panel.Controls.OfType <ucVolarisPassengerOnly>().FirstOrDefault() != null);
         if (panelWithAPassanger != null)
         {
             var control =
                 panelWithAPassanger.Controls.OfType <ucVolarisPassengerOnly>().FirstOrDefault();
             if (control != null)
             {
                 control.HasAProfile = true;
                 control.Profile     = profile;
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #9
0
 /// <summary>
 /// Enables the options.
 /// </summary>
 /// <param name="profile">The profile.</param>
 public void EnableOptions(InterJetProfile profile)
 {
     this.Handler.EnableOptions(profile);
 }
예제 #10
0
 /// <summary>
 /// Sets the profile.
 /// </summary>
 /// <param name="profile">The profile.</param>
 public void SetProfile(InterJetProfile profile)
 {
     this.Handler.SetProfile(profile);
 }