public Reservation(DTO.Reservation reservationDTO, DTO.Client clientDTO)
 {
     Id           = reservationDTO.Id;
     Name         = clientDTO.Name;
     Surname      = clientDTO.Surname;
     Email        = clientDTO.Email;
     Phone        = clientDTO.Phone;
     DeviceId     = reservationDTO.DeviceId;
     Date         = reservationDTO.Date;
     Duration     = reservationDTO.Duration;
     EndDate      = Date + Duration;
     GuestsNumber = reservationDTO.GuestsNumber;
     TableId      = reservationDTO.TableId;
     Discount     = reservationDTO.Discount;
     Comment      = reservationDTO.Comment;
 }
Exemple #2
0
        //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        //%%%%%%%%%%%%%%%%%%       PRIVATES METHODS        %%%%%%%%%%%%%%%%%%%%%%%
        //%%%%%%%%%%%%%%%%%%       CLASS BEHAVIOUR         %%%%%%%%%%%%%%%%%%%%%%%
        //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        private static List<DTO.Client> toClientsList(MySqlDataReader dataReader)
        {
            List<DTO.Client> clientsList = new List<DTO.Client>();
            DTO.Client client;
            try
            {
                while (dataReader.Read())
                {
                    //Construct client object
                    client = new DTO.Client();
                    client.id_client = Int32.Parse(dataReader["id_client"].ToString());
                    client.civ_cli = dataReader["civ_cli"].ToString();
                    client.nom_cli = dataReader["nom_cli"].ToString();
                    client.prenom_cli = dataReader["prenom_cli"].ToString();
                    client.mobile_cli = dataReader["mobile_cli"].ToString();
                    client.fixe_cli = dataReader["fixe_cli"].ToString();
                    client.email_cli = dataReader["email_cli"].ToString();
                    client.connu_cli = dataReader["connu_cli"].ToString();
                    client.remarques_cli = dataReader["remarques_cli"].ToString();
                    client.quartier_cli = dataReader["quartier_cli"].ToString();
                    client.adresse_cli = dataReader["adresse_cli"].ToString();
                    client.date_inscription_cli = dataReader["date_inscription_cli"].ToString();
                    client.login_cli = dataReader["login_cli"].ToString();
                    client.password_cli = dataReader["password_cli"].ToString();
                    client.actif_cli = dataReader["actif_cli"].ToString();
                    client.ville_cli = dataReader["ville_cli"].ToString();
                    //Add it to the list
                    clientsList.Add(client);
                }
            }
            catch (Exception)
            {
                //log
            }
            return clientsList;
        }