public static List<DataBlockID> GetUnparsedDataBlocks(String OrgID) { try { string connectionString = ConfigurationManager.AppSettings["fleetnetbaseConnectionString"]; DataBlock dataBlock = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]); int orgId = Convert.ToInt32(OrgID); List<DataBlockID> dataBlockIDList = new List<DataBlockID>(); DataBlockID dataBlockIDItem; List<int> dataBlockIDs = new List<int>(); int number = 0; dataBlock.OpenConnection(); dataBlockIDs = dataBlock.GetAllUnparsedDataBlockIDs(orgId); foreach (int id in dataBlockIDs) { number++; dataBlockIDItem = new DataBlockID(); dataBlockIDItem.ID = id; dataBlockIDItem.Number = number; dataBlockIDItem.Name = dataBlock.GetDataBlock_FileName(id); dataBlockIDItem.State = dataBlock.GetDataBlockState(id); dataBlockIDItem.ByteSize = Convert.ToInt32(dataBlock.GetDataBlock_BytesCount(id)); dataBlockIDList.Add(dataBlockIDItem); } dataBlock.CloseConnection(); return dataBlockIDList; } catch (Exception ex) { throw ex; //return null; } }
private List<AddStructure> LoadAllLists() { string connectionString = ConfigurationSettings.AppSettings["fleetnetbaseConnectionString"]; DataBlock dataBlock = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]); try { int orgId = Convert.ToInt32(Session["CURRENT_ORG_ID"]); List<AddStructure> addStructureList = new List<AddStructure>(); int i = 0; AddStructure addStructureTemp; List<int> dataBlockIds = new List<int>(); dataBlock.OpenConnection(); dataBlockIds = dataBlock.GetAllUnparsedDataBlockIDs(orgId); foreach (int dataBlockId in dataBlockIds) { i++; addStructureTemp = new AddStructure(); addStructureTemp.dataBlockId = dataBlockId; addStructureTemp.number = i; addStructureTemp.name = dataBlock.GetDataBlock_FileName(dataBlockId); addStructureTemp.state = dataBlock.GetDataBlockState(dataBlockId); addStructureTemp.byteSize = Convert.ToInt32(dataBlock.GetDataBlock_BytesCount(dataBlockId)); addStructureList.Add(addStructureTemp); } if (dataBlockIds.Count == 0) { Parse_Button.Enabled = false; Status.Text = "Нет записей для отображения"; } else { Parse_Button.Enabled = true; Status.Text = ""; } AddGrid.DataSource = CreateDataSource(addStructureList); AddGrid.DataBind(); SetDelColVisible(true); setParseButtonVisible(true); dataBlock.CloseConnection(); return addStructureList; } catch (Exception ex) { dataBlock.CloseConnection(); Status.Text = "Произошла ошибка: " + ex.Message; return null; } finally { StatusUpdatePanel.Update(); } }