public byte[] Get_Local_Current_Download_Files(byte[] parbyteDataSet) { //Stop Make Sure That Interface is Backward Compatible. Create New Function / Procedure if Parameter List Changes //Stop Make Sure That Interface is Backward Compatible. Create New Function / Procedure if Parameter List Changes //Stop Make Sure That Interface is Backward Compatible. Create New Function / Procedure if Parameter List Changes StringBuilder strQry = new StringBuilder(); DataSet ClientDataSet = clsDBConnectionObjects.DeCompress_Array_To_DataSet(parbyteDataSet); DataView ClientDataSetDataview = new DataView(ClientDataSet.Tables["Files"] , "" , "FILE_LAYER_IND,FILE_NAME" , DataViewRowState.CurrentRows); int intFindRow = -1; object[] objFind = new object[2]; DataSet DataSet = new DataSet(); strQry.Append(clsDBConnectionObjects.Get_Local_Client_Download_SQL()); clsDBConnectionObjects.Create_DataTable_Client(strQry.ToString(), DataSet, "Files"); for (int intRow = 0; intRow < DataSet.Tables["Files"].Rows.Count; intRow++) { objFind[0] = DataSet.Tables["Files"].Rows[intRow]["FILE_LAYER_IND"].ToString(); objFind[1] = DataSet.Tables["Files"].Rows[intRow]["FILE_NAME"].ToString(); intFindRow = ClientDataSetDataview.Find(objFind); if (intFindRow == -1) { //DELETE Records on InteractPayrollClient IF Not in Internet Download DataSet strQry.Clear(); strQry.AppendLine(" DELETE FROM InteractPayrollClient.dbo.FILE_CLIENT_DOWNLOAD_CHUNKS"); strQry.AppendLine(" WHERE FILE_LAYER_IND = " + clsDBConnectionObjects.Text2DynamicSQL(DataSet.Tables["Files"].Rows[intRow]["FILE_LAYER_IND"].ToString())); strQry.AppendLine(" AND FILE_NAME = " + clsDBConnectionObjects.Text2DynamicSQL(DataSet.Tables["Files"].Rows[intRow]["FILE_NAME"].ToString())); clsDBConnectionObjects.Execute_SQLCommand_Client(strQry.ToString()); strQry.Clear(); strQry.AppendLine(" DELETE FROM InteractPayrollClient.dbo.FILE_CLIENT_DOWNLOAD_DETAILS"); strQry.AppendLine(" WHERE FILE_LAYER_IND = " + clsDBConnectionObjects.Text2DynamicSQL(DataSet.Tables["Files"].Rows[intRow]["FILE_LAYER_IND"].ToString())); strQry.AppendLine(" AND FILE_NAME = " + clsDBConnectionObjects.Text2DynamicSQL(DataSet.Tables["Files"].Rows[intRow]["FILE_NAME"].ToString())); clsDBConnectionObjects.Execute_SQLCommand_Client(strQry.ToString()); DataSet.Tables["Files"].Rows.RemoveAt(intRow); intRow -= 1; } } DataSet.AcceptChanges(); DataView DataSetDataview = new DataView(DataSet.Tables["Files"] , "" , "FILE_LAYER_IND,FILE_NAME" , DataViewRowState.CurrentRows); //Go Through Internet Download to see If Any Files Must be Downloaded for (int intRow = 0; intRow < ClientDataSet.Tables["Files"].Rows.Count; intRow++) { objFind[0] = ClientDataSet.Tables["Files"].Rows[intRow]["FILE_LAYER_IND"].ToString(); objFind[1] = ClientDataSet.Tables["Files"].Rows[intRow]["FILE_NAME"].ToString(); intFindRow = DataSetDataview.Find(objFind); if (intFindRow > -1) { if (Convert.ToDateTime(ClientDataSet.Tables["Files"].Rows[intRow]["FILE_LAST_UPDATED_DATE"]) == Convert.ToDateTime(DataSetDataview[intFindRow]["FILE_LAST_UPDATED_DATE"])) { ClientDataSet.Tables["Files"].Rows.RemoveAt(intRow); intRow -= 1; } } } ClientDataSet.AcceptChanges(); byte[] bytCompress = clsDBConnectionObjects.Compress_DataSet(ClientDataSet); DataSet.Dispose(); DataSet = null; return(bytCompress); }