private void SetReaderToObject(ref OrganizationType objOrganizationType, ref SqlDataReader result) { if (result.HasRows) { objOrganizationType.OrganizationTypeID = (int)result.GetValue(result.GetOrdinal("OrganizationTypeID")); objOrganizationType.OrganizationTypeName = result.GetValue(result.GetOrdinal("OrganizationTypeName")).ToString(); objOrganizationType.KnowledgeSpeciality = result.GetValue(result.GetOrdinal("KnowledgeSpeciality")).ToString(); } }
/// <summary> /// Clones the specified LST OrganizationType. /// </summary> /// <param name="lstOrganizationType">The LST OrganizationType.</param> /// <returns>List<OrganizationType></returns> static public List <OrganizationType> Clone(List <OrganizationType> lstOrganizationType) { List <OrganizationType> lstCOrganizationType = new List <OrganizationType>(); foreach (OrganizationType objOrganizationType in lstOrganizationType) { lstCOrganizationType.Add(OrganizationType.Clone(objOrganizationType)); } return(lstCOrganizationType); }
private List <OrganizationType> GetOrganizationTypeList(string strSprocName, string strWhere, string strOrderBy) { List <OrganizationType> OrganizationTypes = new List <OrganizationType>(); SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = strSprocName; command.Parameters.Add(dbconn.GenerateParameterObj("@strWhere", SqlDbType.VarChar, strWhere, 1000)); command.Parameters.Add(dbconn.GenerateParameterObj("@strOrderBy", SqlDbType.VarChar, strOrderBy, 1000)); result = command.ExecuteReader(); while (result.Read()) { OrganizationType objOrganizationType = new OrganizationType(); SetReaderToObject(ref objOrganizationType, ref result); OrganizationTypes.Add(objOrganizationType); } } catch { Exception e = new Exception(); throw e; } finally { command.Dispose(); connection.Close(); } return(OrganizationTypes); }
/// <summary> /// Clones the specified object OrganizationType. /// </summary> /// <param name="objOrganizationType">The object OrganizationType.</param> /// <returns>OrganizationType</returns> static public OrganizationType Clone(OrganizationType objOrganizationType) { OrganizationType objCOrganizationType = new OrganizationType(objOrganizationType.OrganizationTypeID); return(objCOrganizationType); }