示例#1
0
 // Get réservation Aller
 public static RES_GetAller_Result GetResAller(DateTime pDateResRetour, int pCliId, int pVilIdDep, int pViIdRet)
 {
     using (AirlinesEntities oContext = new AirlinesEntities()) {
         List <RES_GetAller_Result> oList  = new List <RES_GetAller_Result>();
         RES_GetAller_Result        oAller = new RES_GetAller_Result();
         oAller = null; //si on ne retourne pas de vol aller...
         int datediff = 0;
         try {
             oList = oContext.RES_GetAller(pDateResRetour, pCliId, pVilIdDep, pViIdRet).ToList();
             if (oList != null)
             {
                 foreach (RES_GetAller_Result oResult in oList)
                 {
                     if (oResult.Column1 > datediff) //Column1=datediff
                     {
                         datediff = oResult.Column1.Value;
                         oAller   = oResult;
                     }
                 }
             }
         }
         catch (Exception Ex) {
             throw Ex;
         }
         return(oAller);
     }
 }
示例#2
0
 // Insertion d'un AR
 public static void ArInsert(int pResIdAller, int pResIdRetour)
 {
     try {
         using (AirlinesEntities oContext = new AirlinesEntities()) {
             oContext.AR_InsertAR(pResIdAller, pResIdRetour);
         }
     }
     catch (Exception Ex) {
         throw Ex;
     }
 }
示例#3
0
 // Get reservations en fonction d'un id client et planning
 public static int GetResId(int pCliId, int pPlaId)
 {
     using (AirlinesEntities oContext = new AirlinesEntities()) {
         int result = 0;
         try {
             result = (Int32)oContext.RES_GetResId(pCliId, pPlaId).FirstOrDefault();
         }
         catch (Exception Ex) {
             throw Ex;
         }
         return(result);
     }
 }
示例#4
0
 // CLIENT (E-F) - Get tous les clients
 public static List <CLI_FetchTousClients_Result> FetchTousClients()
 {
     using (AirlinesEntities context = new AirlinesEntities()) {
         List <CLI_FetchTousClients_Result> listeClients = new List <CLI_FetchTousClients_Result>();
         try {
             listeClients = context.CLI_FetchTousClients().ToList();
         }
         catch (Exception e) {
             throw e;
         }
         return(listeClients);
     }
 }
示例#5
0
 public static List <PLA_GetDateByVolId_Result> GetDatesVol(int pId)
 {
     using (AirlinesEntities oContext = new AirlinesEntities()) {
         List <PLA_GetDateByVolId_Result> oList = new List <PLA_GetDateByVolId_Result>();
         try {
             oList = oContext.PLA_GetDateByVolId(pId).ToList();
         }
         catch (Exception Ex) {
             throw Ex;
         }
         return(oList);
     }
 }
示例#6
0
 // Get reservation client via un ID
 public static List <RES_GetResByClientId_Result> GetResClient(int idClient)
 {
     using (AirlinesEntities oContext = new AirlinesEntities()) {
         List <RES_GetResByClientId_Result> oList = new List <RES_GetResByClientId_Result>();
         try {
             oList = oContext.RES_GetResByClientId(idClient).ToList();
         }
         catch (Exception Ex) {
             throw Ex;
         }
         return(oList);
     }
 }
示例#7
0
        public static List <PLA_GetDatesMemeVolWithPlaId_Result> GetDatesMemeVol(int volId, int plaId)
        {
            List <PLA_GetDatesMemeVolWithPlaId_Result> oListDates = new List <PLA_GetDatesMemeVolWithPlaId_Result>();

            using (AirlinesEntities oContext = new AirlinesEntities()) {
                try {
                    oListDates = oContext.PLA_GetDatesMemeVolWithPlaId(volId, plaId).ToList();
                }
                catch (Exception Ex) {
                    throw Ex;
                }
                return(oListDates);
            }
        }
示例#8
0
        public static int GetNbPlacesRestantesNEW(int volId, int plaId)
        {
            int nbPlacesRestantes;

            using (AirlinesEntities oContext = new AirlinesEntities()) {
                try {
                    nbPlacesRestantes = oContext.VOL_PLA_GetNbPlacesRestantesNEW(volId, plaId).FirstOrDefault().Value;
                }
                catch (Exception Ex) {
                    throw Ex;
                }
                return(nbPlacesRestantes);
            }
        }
示例#9
0
        // Get informations pour la combobox du choix des vols
        public static List <VOL_SelectAllListChoix_Result> GetVolsSelectionAll()
        {
            List <VOL_SelectAllListChoix_Result> list = new List <VOL_SelectAllListChoix_Result>();

            using (AirlinesEntities oContext = new AirlinesEntities()) {
                try {
                    list = oContext.VOL_SelectAllListChoix().ToList();
                }
                catch (Exception Ex) {
                    throw Ex;
                }
            }
            return(list);
        }
示例#10
0
 public static VOL_SelectAllListChoixRetour_Result GetVolRetour(int pVolIdDepart, int pVolIdRetour) //pour la combo box de choix de vols
 {
     using (AirlinesEntities oContext = new AirlinesEntities()) {
         List <VOL_SelectAllListChoixRetour_Result> oList = new List <VOL_SelectAllListChoixRetour_Result>();
         VOL_SelectAllListChoixRetour_Result        oVol  = new VOL_SelectAllListChoixRetour_Result();
         try {
             oList = oContext.VOL_SelectAllListChoixRetour(pVolIdDepart, pVolIdRetour).ToList();
             oVol  = oList[0]; //il existe un et un seul vol retour
         }
         catch (Exception Ex) {
             throw Ex;
         }
         return(oVol);
     }
 }
示例#11
0
        // On fait un get des données des voyageurs pour une réservation
        public static List <ACC_GetAccompagnateurChiffreParTete_Result> GetVoyageursAvecPrix(int ResId)
        {
            List <ACC_GetAccompagnateurChiffreParTete_Result> oList = new List <ACC_GetAccompagnateurChiffreParTete_Result>();

            using (AirlinesEntities oContext = new AirlinesEntities()) {
                try {
                    oContext.ACC_GetAccompagnateurChiffreParTete(ResId);
                    oList = oContext.ACC_GetAccompagnateurChiffreParTete(ResId).ToList();
                }
                catch (Exception Ex) {
                    throw Ex;
                }
                return(oList);
            }
        }
示例#12
0
        public static int InsertVoyageur(string pNom, DateTime date, int pResId)
        {
            int res = -1;

            using (AirlinesEntities oContext = new AirlinesEntities()) {
                try {
                    oContext.ACC_InsertNullPrenom(pNom, date, pResId);
                    oContext.RES_UpdateReservationResId(pResId); //activer le trigger pour calculer réservation
                    res = oContext.SaveChanges();                // compte le nombre de row affectés
                }
                catch (Exception Ex) {
                    throw Ex;
                }
                return(res);
            }
        }
示例#13
0
        public void DeleteResId(int ResId) //delete la relation AR si existante puis les voyageurs
        {
            int?ArId = null;

            using (AirlinesEntities context = new AirlinesEntities()) {
                try {
                    ArId = context.AR_GetArId(ResId).FirstOrDefault(); //verifie si relation AR existe
                    if (ArId != null)
                    {
                        context.AR_DeleteARById(ArId); //supprime la relation si existe
                    }
                    context.ACC_DeleteByResId(ResId);  //supprime les voyageurs
                    context.RES_DeleteResId(ResId);    // supprime la réservation
                }
                catch (EntityException efEx) {
                    SqlException sqEx      = (SqlException)efEx.InnerException;
                    int          numErreur = 666;
                    switch (sqEx.Number)
                    {
                    case 2601:
                        numErreur = 3;
                        break;

                    case 51000:
                        numErreur = 4;
                        break;

                    case 52000:
                        numErreur = 7;
                        break;

                    case 53000:
                        numErreur = 3;
                        break;

                    default:
                        numErreur = 666;
                        // sMessage = exSQL.Number + " - " + exSQL.Message;
                        break;
                    }
                    throw new CustomError(numErreur);
                }
                catch (Exception Ex) {
                    throw Ex;
                }
            }
        }
示例#14
0
        // Insertion d'une réservation
        public static int InsertRes(int pCliId, int pPlaId)
        {
            int res = -1;

            using (AirlinesEntities oContext = new AirlinesEntities()) {
                List <RES_GetResByClientId_Result> oList = new List <RES_GetResByClientId_Result>();
                try {
                    oContext.RES_Insert(pCliId, pPlaId);
                    res = oContext.SaveChanges(); // compte le nombre de row affectés
                }
                catch (EntityException efEx) {
                    SqlException sqEx      = (SqlException)efEx.InnerException;
                    int          numErreur = 666;
                    switch (sqEx.Number)
                    {
                    case 2601:
                        numErreur = 3;
                        break;

                    case 51000:
                        numErreur = 4;
                        break;

                    case 52000:
                        numErreur = 7;
                        break;

                    case 53000:
                        numErreur = 3;
                        break;

                    default:
                        numErreur = 666;
                        // sMessage = exSQL.Number + " - " + exSQL.Message;
                        break;
                    }
                    throw new CustomError(numErreur);
                }
                catch (Exception Ex) {
                    throw Ex;
                }
                return(res);
            }
        }
示例#15
0
        // Get le prix total de la réservation
        public Nullable <decimal> GetResPrixTotal(int pResId)
        {
            decimal?res;

            using (AirlinesEntities oContext = new AirlinesEntities()) {
                List <RES_GetResByClientId_Result> oList = new List <RES_GetResByClientId_Result>();
                try {
                    res = (decimal?)oContext.RES_GetPrixTotal(pResId).FirstOrDefault();
                }
                catch (EntityException efEx) {
                    SqlException sqEx      = (SqlException)efEx.InnerException;
                    int          numErreur = 666;
                    switch (sqEx.Number)
                    {
                    case 2601:
                        numErreur = 3;
                        break;

                    case 51000:
                        numErreur = 4;
                        break;

                    case 52000:
                        numErreur = 7;
                        break;

                    case 53000:
                        numErreur = 3;
                        break;

                    default:
                        numErreur = 666;
                        // sMessage = exSQL.Number + " - " + exSQL.Message;
                        break;
                    }
                    throw new CustomError(numErreur);
                }
                catch (Exception Ex) {
                    throw Ex;
                }
                return(res);
            }
        }
示例#16
0
        // CLIENT (E-F) - Get
        public static List <CLI_GetClientMoneyInfo_Result> GetClientMoneyInfo(int idClient, int idReservation)
        {
            List <CLI_GetClientMoneyInfo_Result> oList = new List <CLI_GetClientMoneyInfo_Result>();

            using (AirlinesEntities oContext = new AirlinesEntities()) {
                try {
                    oList = oContext.CLI_GetClientMoneyInfo(idClient, idReservation).ToList();
                }
                catch (System.Data.Entity.Core.EntityException efEx) {
                    SqlException sqEx      = (SqlException)efEx.InnerException;
                    int          numErreur = 666;
                    switch (sqEx.Number)
                    {
                    case 2601:
                        numErreur = 3;
                        break;

                    case 51000:
                        numErreur = 4;
                        break;

                    case 52000:
                        numErreur = 7;
                        break;

                    case 53000:
                        numErreur = 3;
                        break;

                    default:
                        numErreur = 666;
                        break;
                    }
                    throw new CustomError(numErreur);
                }
                catch (Exception Ex) {
                    throw Ex;
                }
                return(oList);
            }
        }
示例#17
0
        // Suppression d'un AR
        public static void DeleteAr(int pArId)
        {
            try {
                using (AirlinesEntities oContext = new AirlinesEntities()) {
                    oContext.AR_DeleteARById(pArId);
                }
            }

            catch (EntityException efEx) {
                SqlException sqEx      = (SqlException)efEx.InnerException;
                int          numErreur = 666;
                switch (sqEx.Number)
                {
                case 2601:
                    numErreur = 3;
                    break;

                case 51000:
                    numErreur = 4;
                    break;

                case 52000:
                    numErreur = 7;
                    break;

                case 53000:
                    numErreur = 3;
                    break;

                default:
                    numErreur = 666;
                    // sMessage = exSQL.Number + " - " + exSQL.Message;
                    break;
                }
                throw new CustomError(numErreur);
            }
            catch (Exception Ex) {
                throw new CustomError(666);;
            }
        }
示例#18
0
        public static DataView GetVoyageursAvecPrixData(int ResId)
        {
            DataTable oDataTable = new DataTable();

            oDataTable.Columns.Add("ACC_ID", typeof(Int32));
            oDataTable.Columns.Add("ACC_NOM", typeof(string));
            oDataTable.Columns.Add("ACC_PRENOM", typeof(string));
            oDataTable.Columns.Add("ACC_DATE_NAISSANCE", typeof(DateTime));
            oDataTable.Columns.Add("TRA_PRIX", typeof(decimal));
            using (AirlinesEntities oContext = new AirlinesEntities()) {
                try {
                    oContext.ACC_GetAccompagnateurChiffreParTete(ResId).ToList();
                    foreach (ACC_GetAccompagnateurChiffreParTete_Result oRow in oContext.ACC_GetAccompagnateurChiffreParTete(ResId))
                    {
                        oDataTable.Rows.Add(oRow.ACC_ID, oRow.ACC_NOM, oRow.ACC_PRENOM, oRow.ACC_DATE_NAISSANCE, oRow.TRA_PRIX);
                    }
                }
                catch (Exception Ex) {
                    throw Ex;
                }
                return(oDataTable.DefaultView);
            }
        }