Пример #1
0
        public int CovertTableLogger()
        {
            int nRows = 0;

            GetDataLoggerTableOlDBAction getDataLoggerTableOlDBAction = new GetDataLoggerTableOlDBAction();

            GetChannelOldDBAction getChannelOldDBAction = new GetChannelOldDBAction();

            List <t_Channel_Configurations> list = getChannelOldDBAction.GetChannelConfiguration();

            InsertDataLoggerTableNewDBAction insertDataLoggerTableNewDBAction = new InsertDataLoggerTableNewDBAction();



            foreach (var item in list)
            {
                List <DataLoggerModel> temp = getDataLoggerTableOlDBAction.GetDataLogger(item.ChannelId);

                nRows += insertDataLoggerTableNewDBAction.Insert(item.ChannelId, temp);
            }

            return(nRows);
        }
        public int ConvertChannel()
        {
            int nRows = 0;

            GetChannelOldDBAction getChannelOldDBAction = new GetChannelOldDBAction();

            List <t_Channel_Configurations> list = getChannelOldDBAction.GetChannelConfiguration();

            InsertChannelNewDBAction insertChannelNewDBAction = new InsertChannelNewDBAction();

            List <t_Devices_ChannelsConfigs> listNew = new List <t_Devices_ChannelsConfigs>();

            List <string> listChannel = new List <string>();

            foreach (var item in list)
            {
                t_Devices_ChannelsConfigs el = new t_Devices_ChannelsConfigs();

                el.Id       = item.ChannelId;
                el.LoggerId = item.LoggerId;
                el.Name     = item.ChannelName;
                el.Unit     = item.Unit;

                listChannel.Add(item.ChannelId);

                listNew.Add(el);
            }

            nRows += insertChannelNewDBAction.Insert(listNew);

            CreateDataLoggerTableAction createDataLoggerTableAction = new CreateDataLoggerTableAction();

            nRows += createDataLoggerTableAction.CreateDataLoggerTable(listChannel);


            return(nRows);
        }