예제 #1
0
        public override int CreateBagage(BagageDefinition bag)
        {
            using (SqlConnection cnx = new SqlConnection(strcnx))
            {
                // @dateCreation, @origineCreation, @origineSafir, @enTransfert
                SqlCommand cmd = new SqlCommand(commandInsertBagage, cnx);
                cmd.Parameters.AddWithValue("@codeIata", bag.CodeIata);
                cmd.Parameters.AddWithValue("@compagnie", bag.Compagnie.ToCharArray(0, 3));
                cmd.Parameters.AddWithValue("@ligne", bag.Ligne);
                cmd.Parameters.AddWithValue("@classe", bag.ClasseBagage.ToCharArray(0, 1));
                cmd.Parameters.AddWithValue("@itineraire", bag.Itineraire.ToCharArray(0, 3));
                cmd.Parameters.AddWithValue("@continuation", bag.Continuation);
                cmd.Parameters.AddWithValue("@rush", bag.Rush);
                cmd.Parameters.AddWithValue("@jourExploit", bag.JourExploitation);
                cmd.Parameters.AddWithValue("@dateCreation", DateTime.Now);
                cmd.Parameters.AddWithValue("@origineCreation", "D");
                cmd.Parameters.AddWithValue("@origineSafir", false);
                cmd.Parameters.AddWithValue("@enTransfert", false);

                cnx.Open();

                var nbLignes = cmd.ExecuteNonQuery();
                cnx.Close();
                return nbLignes;
            }
        }
예제 #2
0
        public override List<BagageDefinition> GetBagage(string codeIATA)
        {
            using (SqlConnection cnx = new SqlConnection(strcnx))
            {
                List<BagageDefinition> res_bag = new List<BagageDefinition>();
                SqlCommand cmd = new SqlCommand(commandGetBagage, cnx);
                cmd.Parameters.AddWithValue("@code", codeIATA);
                cnx.Open();
                cmd.CommandTimeout = 600;
                #region reader
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    //Au moins un bagage a été trouvé
                    while (reader.Read())
                    {
                        BagageDefinition bag = new BagageDefinition();
                        bag.IdBagage = reader.GetFieldValue<int>(reader.GetOrdinal("ID_BAGAGE"));
                        bag.Compagnie = reader.GetFieldValue<string>(reader.GetOrdinal("COMPAGNIE"));
                        bag.Ligne = reader.GetFieldValue<string>(reader.GetOrdinal("LIGNE"));
                        bag.Itineraire = reader.GetFieldValue<string>(reader.GetOrdinal("DESTINATION"));
                        bag.ClasseBagage = reader.GetFieldValue<string>(reader.GetOrdinal("CLASSE"));
                        if (bag.ClasseBagage == null)
                            bag.ClasseBagage = "Y";
                        bag.CodeIata = reader.GetFieldValue<string>(reader.GetOrdinal("CODE_IATA"));
                        bag.Continuation = reader.GetFieldValue<bool>(reader.GetOrdinal("EN_CONTINUATION"));
                        bag.Rush = reader.GetFieldValue<bool>(reader.GetOrdinal("PRIORITAIRE"));
                        bag.JourExploitation = reader.GetFieldValue<short>(reader.GetOrdinal("JOUR_EXPLOITATION"));

                        res_bag.Add(bag);
                    }
                }
                #endregion
                cnx.Close();
                return res_bag;
            }
        }
 public abstract int CreateBagage(BagageDefinition bag);
 public int CreateBagage(BagageDefinition bagage)
 {
     return Factory.Model.CreateBagage(bagage);
 }