Exemplo n.º 1
0
 /// <summary>
 /// This method loads the information from the sqlreader into the Employee object
 /// </summary>
 /// <param name="reader"></param>
 /// <param name="employee"></param>
 private static void LoadObject(MySqlDataReader reader, ClientOtherInfo clientOther)
 {
     clientOther.UID            = Convert.ToInt32(reader[FieldName.UID].ToString());
     clientOther.FKClientUID    = Convert.ToInt32(reader[FieldName.FKClientUID]);
     clientOther.RCFieldCode    = reader[FieldName.RCFieldCode].ToString();
     clientOther.FieldValueText = reader[FieldName.FieldValueText].ToString();
 }
Exemplo n.º 2
0
        /// <summary>
        /// List employees
        /// </summary>
        /// <param name="clientID"></param>
        public static List <ClientOtherInfo> List(int clientID)
        {
            var clientOtherList = new List <ClientOtherInfo>();

            using (var connection = new MySqlConnection(ConnString.ConnectionString))
            {
                var commandString = string.Format(
                    " SELECT           " +
                    " UID,             " +
                    " FKClientUID,     " +
                    " RCFieldCode,     " +
                    " FieldValueText   " +
                    "   FROM ClientOtherInfo " +
                    "   WHERE  FKClientUID = {0}",
                    clientID);

                using (var command = new MySqlCommand(
                           commandString, connection))
                {
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var clientOther = new ClientOtherInfo();
                            LoadObject(reader, clientOther);

                            clientOtherList.Add(clientOther);
                        }
                    }
                }
            }

            return(clientOtherList);
        }