/// <summary> /// Retrieves list of LocalizeResource objects from SqlCommand, after database query /// number of rows retrieved and returned depends upon the rows field value /// </summary> /// <param name="cmd">The command object to use for query</param> /// <param name="rows">Number of rows to process</param> /// <returns>A list of LocalizeResource objects</returns> private LocalizeResourceList GetList(SqlCommand cmd, long rows) { // Select multiple records SqlDataReader reader; long result = SelectRecords(cmd, out reader); //LocalizeResource list LocalizeResourceList list = new LocalizeResourceList(); using ( reader ) { // Read rows until end of result or number of rows specified is reached while (reader.Read() && rows-- != 0) { LocalizeResource localizeResourceObject = new LocalizeResource(); FillObject(localizeResourceObject, reader); list.Add(localizeResourceObject); } // Close the reader in order to receive output parameters // Output parameters are not available until reader is closed. reader.Close(); } return(list); }
/// <summary> /// Retrieves all LocalizeResource objects by PageRequest /// </summary> /// <returns>A list of LocalizeResource objects</returns> public LocalizeResourceList GetPaged(PagedRequest request) { using (SqlCommand cmd = GetSPCommand(GETPAGEDLOCALIZERESOURCE)) { AddParameter(cmd, pInt32Out("TotalRows")); AddParameter(cmd, pInt32("PageIndex", request.PageIndex)); AddParameter(cmd, pInt32("RowPerPage", request.RowPerPage)); AddParameter(cmd, pNVarChar("WhereClause", 4000, request.WhereClause)); AddParameter(cmd, pNVarChar("SortColumn", 128, request.SortColumn)); AddParameter(cmd, pNVarChar("SortOrder", 4, request.SortOrder)); LocalizeResourceList _LocalizeResourceList = GetList(cmd, ALL_AVAILABLE_RECORDS); request.TotalRows = Convert.ToInt32(GetOutParameter(cmd, "TotalRows")); return(_LocalizeResourceList); } }
/// <summary> /// Retrieve list of LocalizeResource. /// </summary> /// <param name="fillChild"></param> /// <returns>List of LocalizeResource</returns> public LocalizeResourceList GetAll(bool fillChild) { LocalizeResourceList localizeResourceList = new LocalizeResourceList(); using (LocalizeResourceDataAccess data = new LocalizeResourceDataAccess(ClientContext)) { localizeResourceList = data.GetAll(); } if (fillChild) { foreach (LocalizeResource localizeResourceObject in localizeResourceList) { FillLocalizeResourceWithChilds(localizeResourceObject, fillChild); } } return(localizeResourceList); }