Пример #1
0
        public static Comunicaciones_Tv ToProject(this T_Comunicaciones_Tv t_Comunicaciones)
        {
            var _tf     = new DB_PLANTILLA().GetSingleRecord <T_TF>(x => x.Id == t_Comunicaciones.Tf).Convert <TF>();
            var _td     = new DB_PLANTILLA().GetSingleRecord <T_TD>(x => x.Id == t_Comunicaciones.Td).Convert <TD>();
            var _td_pos = new DB_PLANTILLA().GetSingleRecord <T_TD_Pos>(x => x.Id == t_Comunicaciones.TD_Pos).Convert <TD_Pos>();
            var _upsc   = new DB_PLANTILLA().GetSingleRecord <T_UPSC>(x => x.Id == t_Comunicaciones.UPSC).Convert <UPSC>();
            var _ttTv   = new DB_PLANTILLA().GetSingleRecord <T_TT_TV>(x => x.Id == t_Comunicaciones.TT_TV).Convert <TT_TV>();
            var _di     = new DB_PLANTILLA().GetSingleRecord <T_DI>(x => x.Id == t_Comunicaciones.Di).Convert <DI>();
            var _altv   = new DB_PLANTILLA().GetSingleRecord <T_ALTV>(x => x.Id == t_Comunicaciones.Altv).Convert <ALTV>();
            var _upsi   = new DB_PLANTILLA().GetSingleRecord <T_UPSI>(x => x.Id == t_Comunicaciones.UPSI).Convert <UPSI>();

            Comunicaciones_Tv _comm = new Comunicaciones_Tv()
            {
                TF1     = _tf,
                TD1     = _td,
                TD_Pos1 = _td_pos,
                UPSC1   = _upsc,
                TT_TV1  = _ttTv,
                DI1     = _di,
                ALTV1   = _altv,
                UPSI1   = _upsi
            };

            return(_comm);
        }
Пример #2
0
        public static T_Comunicaciones_Tv InsertarComunicacionesTV(int i)
        {
            var _worksheet = ImportarExcel.GetWorkSheetByName("BaseDatos");

            var _tf    = _worksheet.GetSingleCellValue(i, 30);
            var _td    = _worksheet.GetSingleCellValue(i, 31);
            var _tdPos = _worksheet.GetSingleCellValue(i, 32);
            var _upsc  = _worksheet.GetSingleCellValue(i, 33);
            var _upsi  = _worksheet.GetSingleCellValue(i, 34);
            var _tttv  = _worksheet.GetSingleCellValue(i, 35);
            var _di    = _worksheet.GetSingleCellValue(i, 36);
            var _altv  = _worksheet.GetSingleCellValue(i, 37);

            using (var db = new DB_PLANTILLA())
            {
                T_Comunicaciones_Tv _comm = new T_Comunicaciones_Tv()
                {
                    Tf     = db.GetSingleRecord <T_TF>(x => x.Value == _tf).Id,
                    Td     = db.GetSingleRecord <T_TD>(x => x.Value == _td).Id,
                    TD_Pos = db.GetSingleRecord <T_TD_Pos>(x => x.Value == _tdPos).Id,
                    UPSC   = db.GetSingleRecord <T_UPSC>(x => x.Value == _upsc).Id,
                    UPSI   = db.GetSingleRecord <T_UPSI>(x => x.Value == _upsi).Id,
                    TT_TV  = db.GetSingleRecord <T_TT_TV>(x => x.Value == _tttv).Id,
                    Di     = db.GetSingleRecord <T_DI>(x => x.Value == _di).Id,
                    Altv   = db.GetSingleRecord <T_ALTV>(x => x.Value == _altv).Id
                };

                var _record = db.GetSingleRecord <T_Comunicaciones_Tv>(x => x.Tf == _comm.Tf &&
                                                                       x.Td == _comm.Td &&
                                                                       x.TD_Pos == _comm.TD_Pos &&
                                                                       x.UPSC == _comm.UPSC &&
                                                                       x.UPSI == _comm.UPSI &&
                                                                       x.TT_TV == _comm.TT_TV &&
                                                                       x.Di == _comm.Di &&
                                                                       x.Altv == _comm.Altv);

                if (_record == null)
                {
                    db.AddElemento(_comm.GetType(), _comm);
                }
                else
                {
                    _comm = _record;
                }

                return(_comm);
            }
        }