Пример #1
0
 /// <summary>
 /// Bind the SQL Result to a Language object
 /// </summary>
 /// <param name="result">The result of a SQL query</param>
 /// <returns>a new instance of Language with the values of the SQL Result</returns>
 private static Language BindLanguage(SqlResult result)
 {
     return new Language
     {
         Name = result["name"].ToString()
     };
 }
Пример #2
0
 /// <summary>
 /// Bind the SQL Result to a Continent object
 /// </summary>
 /// <param name="result">The result of a SQL query</param>
 /// <returns>a new instance of Continent with the values of the SQL Result</returns>
 private static Continent BindContinent(SqlResult result)
 {
     return new Continent
     {
         Name = result["name"].ToString()
     };
 }
Пример #3
0
 /// <summary>
 /// Bind the SQL Result to a Country object
 /// </summary>
 /// <param name="result">The result of a SQL query</param>
 /// <returns>a new instance of Country with the values of the SQL Result</returns>
 private static Country BindCountry(SqlResult result)
 {
     return new Country
     {
         Name = result["name"].ToString()
     };
 }
Пример #4
0
 /// <summary>
 /// Bind a SQLResult to a Contract
 /// </summary>
 /// <param name="reader">Result of SQL request</param>
 /// <returns>A new contract </returns>
 private static Contract BindContract(SqlResult reader)
 {
     return new Contract
     {
         Id = (int) reader["id"],
         Title = (string) reader["title"],
         Start = (DateTime) reader["start"],
         End = (DateTime) reader["end"],
         XmlContent = (string) reader["xmlContent"],
         User = (string) reader["userLogin"],
         Type = (string) reader["typeContractName"],
         Archived = (bool) reader["archived"],
         fileId = (int) reader["fileId"]
     };
 }
Пример #5
0
        /// <summary>
        /// Bind the SQL Result to a Person object
        /// </summary>
        /// <param name="result">The result of a SQL query</param>
        /// <returns>a new instance of Person with the values of the SQL Result</returns>
        private static Person BindPerson(SqlResult result)
        {
            var department = new Department
            {
                Id = (int) result["departmentId"],
                Name = (string) result["departmentName"],
                InstitutionName = (string) result["institutionName"],
                InstitutionId = (int) result["institutionId"]
            };

            var person = new Person
            {
                Id = (int) result["id"],
                Name = (string) result["name"],
                FirstName = (string) result["firstname"],
                Email = (string) result["email"],
                Phone = (string) result["phone"],
                Archived = (bool) result["archived"],
                Department = department
            };

            return person;
        }
Пример #6
0
 /// <summary>
 /// Creates an institution having the departments list and the continent attributes not instanciated yet.
 /// </summary>
 /// <param name="institutionReader">An SqlResult instance used by the function to query the database.</param>
 /// <returns>The institution</returns>
 private static Institution GetInstitutionWithoutDepartmentsAndContinent(SqlResult institutionReader)
 {
     //Instantiate institution
     return new Institution( (int) institutionReader["id"],
                             (string) institutionReader["name"],
                             (string) institutionReader["description"],
                             (string) institutionReader["city"],
                             (string) institutionReader["Interest"],
                             new Language { Name = (string) institutionReader["languageName"] },
                             new Country { Name = (string)institutionReader["countryName"] },
                             null,
                             (bool) institutionReader["archived"]);
 }
Пример #7
0
 /// <summary>
 /// Utility function used to initialize a type with its data stored in database.
 /// </summary>
 /// <param name="reader">The SqlResult object used to read data from the database.</param>
 /// <returns>The initialized TypeContract object.</returns>
 private static TypeContract BindType(SqlResult reader)
 {
     return new TypeContract {Name = reader["name"].ToString()};
 }