Ejemplo n.º 1
0
    private List<DeleteStructure> LoadAllDeleteLists()
    {
        try
        {
            int userId = 0;
            List<DeleteStructure> deleteStructureList = new List<DeleteStructure>();
            int i = 0;
            string connectionString = ConfigurationSettings.AppSettings["fleetnetbaseConnectionString"];
            DataBlock dataBlock = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]);
            DeleteStructure deleteStructureTemp;
            List<int> dataBlockIds = new List<int>();
            dataBlock.OpenConnection();
            dataBlockIds = dataBlock.GetAllParsedDataBlockIDs(userId);
            foreach (int dataBlockId in dataBlockIds)
            {
                i++;
                deleteStructureTemp = new DeleteStructure();
                deleteStructureTemp.dataBlockId = dataBlockId;
                deleteStructureTemp.number = i;
                deleteStructureTemp.name = dataBlock.GetDriversNameOrVehiclesNumberByBlockId(dataBlockId);
                deleteStructureTemp.cardTypeName = dataBlock.GetCardTypeName(dataBlockId);
                deleteStructureTemp.recordsCount = dataBlock.GetDataBlock_RecorsCount(dataBlockId);
                deleteStructureTemp.createTime = dataBlock.GetDataBlock_EDate(dataBlockId);
                deleteStructureTemp.dataBlockState = dataBlock.GetDataBlockState(dataBlockId);

                deleteStructureList.Add(deleteStructureTemp);
            }
            if (dataBlockIds.Count == 0)
                Status.Text = "Нет записей для отображения";

            AddGrid.DataSource = CreateDeleteDataSource(deleteStructureList);
            AddGrid.DataBind();
            dataBlock.CloseConnection();
            return deleteStructureList;
        }
        catch (Exception ex)
        {
            Status.Text = "Произошла ошибка: " + ex.Message + " Возможо просто нету данных в БД. Исправление в след. версии";
            return null;
        }
        finally
        {
        }
    }