示例#1
0
 public void SetProfile(VolarisProfile profile)
 {
     if (profile != null)
     {
         _profile = profile;
         SetCards();
     }
 }
示例#2
0
        public void SetProfile(VolarisProfile profile)
        {
            if (profile != null)
            {
                View.PaxName     = profile.Name;
                View.LastName    = profile.LastName;
                View.DateOfBirth = profile.BirthDay;

                HasProfile = true;
            }
        }
示例#3
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 VolarisProfile GetProfile(string secondLevelProfile, string firstLevelProfile, string connectionString)
        {
            Database  dataBase        = DatabaseFactory.CreateDatabase(connectionString);
            DbCommand dataBaseCommand = dataBase.GetStoredProcCommand("GetVolarisProfile");

            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 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 <VolarisProfile>();
                while (dataReader.Read())
                {
                    var profile = new VolarisProfile();
                    profile.Id                 = dataReader.GetInt32(id);
                    profile.Name               = dataReader.GetString(name);
                    profile.LastName           = dataReader.GetString(lastName);
                    profile.FirstLevelProfile  = dataReader.GetString(fristLevel);
                    profile.SecondLevelProfile = dataReader.GetString(secondLevel);
                    profile.BirthDay           = this.GetBirthDay(dataReader.GetString(birthtDay));
                    profile.CreditCards.Add(new VolarisProfileCreditCard((dataReader[creditCard] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard), false));
                    profile.CreditCards.Add(new VolarisProfileCreditCard((dataReader[creditCard2] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard2), false));
                    profile.CreditCards.Add(new VolarisProfileCreditCard((dataReader[creditCard3] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard3), false));
                    profile.CreditCards.Add(new VolarisProfileCreditCard((dataReader[creditCard4] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard4), false));
                    profile.CreditCards.Add(new VolarisProfileCreditCard((dataReader[creditCard5] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard5), false));
                    profile.CreditCards.Add(new VolarisProfileCreditCard((dataReader[creditCard6] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard6), false));
                    profile.CreditCards.Add(new VolarisProfileCreditCard((dataReader[creditCard7] == DBNull.Value) ? Types.StringNullValue : dataReader.GetString(creditCard7), false));
                    profile.CreditCards.Add(new VolarisProfileCreditCard((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));

                    if (resultedProfile != null)
                    {
                        resultedProfile.CreditCards.Add(GetCardsFromFristLevel(resultedProfile.FirstLevelProfile));
                    }
                    return(resultedProfile);
                }
            }

            return(null);
        }
 public void SetProfile(VolarisProfile profile)
 {
     _presenter.SetProfile(profile);
     profileAsignedPanel.Visible = true;
 }