Exemplo n.º 1
0
        public static T_Climatizacion InsertarClimatizaciones(int i)
        {
            var _worksheet = ImportarExcel.GetWorkSheetByName("BaseDatos");

            var _tratamiento  = _worksheet.GetSingleCellValue(i, 22);
            var _equipamiento = _worksheet.GetSingleCellValue(i, 23);
            var _criterioM    = _worksheet.GetSingleCellValue(i, 24);
            var _aireFrescoM  = _worksheet.GetSingleCellValue(i, 26);
            var _aireFrescoP  = _worksheet.GetSingleCellValue(i, 27);
            var _renovaciones = _worksheet.GetSingleCellValue(i, 28);
            var _wAire        = _worksheet.GetSingleCellValue(i, 29);


            using (var db = new DB_PLANTILLA())
            {
                var _afM = db.GetSingleRecord <T_AF_Metro_Cuadrado>(x => x.Value == _aireFrescoM).Id;
                var _afP = db.GetSingleRecord <T_AF_Persona>(x => x.Value == _aireFrescoP).Id;

                var _af = db.GetSingleRecord <T_Aire_Fresco>(x => x.Metro_Cuadrado == _afM && x.Persona == _afP).Id;

                T_Climatizacion _clima = new T_Climatizacion()
                {
                    Tratamiento  = db.GetSingleRecord <T_Tratamiento>(x => x.Value == _tratamiento).Id,
                    Equipamiento = db.GetSingleRecord <T_Equipamiento>(x => x.Value == _equipamiento).Id,
                    Criterio     = db.GetSingleRecord <T_Criterio>(x => x.Value == _criterioM).Id,
                    Aire_Fresco  = _af,
                    Renovaciones = db.GetSingleRecord <T_Renovaciones>(x => x.Value == _renovaciones).Id,
                    W_Aire       = db.GetSingleRecord <T_W_Aire>(x => x.Value == _wAire).Id
                };

                var _record = db.GetSingleRecord <T_Climatizacion>(x => x.Tratamiento == _clima.Tratamiento &&
                                                                   x.Equipamiento == _clima.Equipamiento &&
                                                                   x.Criterio == _clima.Criterio &&
                                                                   x.Aire_Fresco == _clima.Aire_Fresco &&
                                                                   x.Renovaciones == _clima.Renovaciones &&
                                                                   x.W_Aire == _clima.W_Aire);

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

                return(_clima);
            }
        }
Exemplo n.º 2
0
        public static Climatizacion ToProject(this T_Climatizacion t_climatizacion)
        {
            var _tratamiento  = new DB_PLANTILLA().GetSingleRecord <T_Tratamiento>(x => x.Id == t_climatizacion.Tratamiento).Convert <Tratamiento>();
            var _equipamiento = new DB_PLANTILLA().GetSingleRecord <T_Equipamiento>(x => x.Id == t_climatizacion.Equipamiento).Convert <Equipamiento>();
            var _criterio     = new DB_PLANTILLA().GetSingleRecord <T_Criterio>(x => x.Id == t_climatizacion.Criterio).Convert <Criterio>();
            var _aireFresco   = new DB_PLANTILLA().GetSingleRecord <T_Aire_Fresco>(x => x.Id == t_climatizacion.Aire_Fresco).ToProject();
            var _renovaciones = new DB_PLANTILLA().GetSingleRecord <T_Renovaciones>(x => x.Id == t_climatizacion.Renovaciones).Convert <Renovaciones>();
            var _wAire        = new DB_PLANTILLA().GetSingleRecord <T_W_Aire>(x => x.Id == t_climatizacion.W_Aire).Convert <W_Aire>();

            Climatizacion _clima = new Climatizacion()
            {
                Tratamiento1  = _tratamiento,
                Equipamiento1 = _equipamiento,
                Criterio1     = _criterio,
                Aire_Fresco1  = _aireFresco,
                Renovaciones1 = _renovaciones,
                W_Aire1       = _wAire
            };

            return(_clima);
        }