//METODOS NUEVOS - 2015
 /// <summary>
 /// Metodo encargado de hacer el pasaje de valores simples de una entidad a otra.
 /// </summary>
 /// <param name="origen">Entidad de origen</param>
 /// <param name="destino">Entidad de destino</param>
 /// <param name="cntxt">Contexto donde se encuentran las entidades</param>
 public void SetearValores(EntidadBase origen, EntidadBase destino, IDbContext cntxt)
 {
     if (destino != null && origen != null)
     {
         cntxt.Entry(destino).CurrentValues.SetValues(origen);
     }
 }
 //METODOS UTILIZADOS EN LOS BORRADORES ESPECIFICOS - MANEJO DE ENTIDADES PARA BORRAR
 /// <summary>
 /// Metodo que agrega una entidad perteneciente al grafo de una entidad que se va a borrar a la lista de entidades para eliminar de listaEntidadesParaBorrar
 /// </summary>
 /// <param name="entidad">Entidad a agregar a listaEntidadesParaBorrar</param>
 public void AgregarAListaParaBorrar(EntidadBase entidad)
 {
     if (entidad != null)
     {
         this.listaEntidadesParaBorrar.Add(entidad);
     }
 }
Exemplo n.º 3
0
        public ActionResult AddEntidadBaseAJuridica(JsonEntidadBase req)
        {
            try
            {
                if (req.entidad.nombreFicticio == null || req.entidad.descripcion == null || req.actividad == null)
                {
                    throw new Exception("Es necesario completar todos los campos para continuar");
                }
                if (req.tipoOrganizacion == "OSC")
                {
                    req.entidad.tipoOrganizacion = new OSC(req.actividad);
                }
                else if (req.tipoOrganizacion == "Empresa")
                {
                    req.entidad.tipoOrganizacion = CategorizadorOrg.categorizar(new Empresa(req.actividad, req.sector, req.promVentas, req.cantPersonal));
                }
                else
                {
                    throw new Exception("Tipo de organizacion no valido");
                }

                EntidadBase nuevaEnt    = (EntidadBase)EntidadDAO.getInstancia().add(req.entidad);
                Usuario     user        = (Usuario)Session["usuario"];
                Usuario     updatedUser = UsuarioDAO.getInstancia().setIdEntidad(nuevaEnt.idEntidad, user.idUsuario);
                Session.Remove("usuario");
                Session.Add("usuario", updatedUser);
                return(Json(Url.Action("PanelAdmin", "User")));
            }
            catch (Exception e)
            {
                ViewBag.entidades   = EntidadDAO.getInstancia().getEntidadesJuridicas();
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(Json(e.Message));
            }
        }
Exemplo n.º 4
0
        public static FavoritosAfiliado getNewFavoritosAfiliado(DataRow dr)
        {
            FavoritosAfiliado favoritosAfiliado = new FavoritosAfiliado()
            {
                AF_ID              = EntidadBase.IsInt(dr, "AF_ID"),
                TipoFavoritoID     = EntidadBase.IsInt(dr, "TipoFavoritoID"),
                NumeroInstrumento  = EntidadBase.IsString(dr, "NumeroInstrumento"),
                TipoCedulaRif      = EntidadBase.IsString(dr, "TipoCedulaRif"),
                CedulaRif          = EntidadBase.IsString(dr, "CedulaRif"),
                BANK_ID            = EntidadBase.IsString(dr, "BANK_ID"),
                Beneficiario       = EntidadBase.IsString(dr, "Beneficiario"),
                Descripcion        = EntidadBase.IsString(dr, "Descripcion"),
                TipoTarjetaCredito = EntidadBase.IsString(dr, "TipoTarjetaCredito"),
                Email              = EntidadBase.IsString(dr, "Email")
            };
            DateTime dateTime = EntidadBase.IsDateTime(dr, "dCompDate");

            favoritosAfiliado.dCompDate       = dateTime.ToString("dd/MM/yyyy");
            favoritosAfiliado.Activo          = EntidadBase.IsString(dr, "Activo");
            favoritosAfiliado.TipoDescripcion = EntidadBase.IsString(dr, "TipoDescripcion");
            int tipoFavoritoID = favoritosAfiliado.TipoFavoritoID;

            favoritosAfiliado.Key = CryptoUtils.EncryptMD5(tipoFavoritoID.ToString());
            return(favoritosAfiliado);
        }
Exemplo n.º 5
0
        public string SendMessage(EntidadBase entidad)
        {
            string result = "";

            if (entidad is TRV_SMS) // Send SMS
            {
                try
                {
                    var s = (TRV_SMS)entidad;

                    result = sendSMSWithPHPService(s);
                    //result = sendSMSwithNativeCsharp(s); CHECK THIS
                }
                catch (TRV_Exception ex)
                {
                    // throw gestor.ControlarExcepcion(new TRV_Exception(TRV_Exception.ExceptionCode.SMSNotSend));
                }
            }
            else // SEND MAIL
            {
                try
                {
                    var c = (TRV_Mail)entidad;

                    result = sendMailwithSmtpClient(c);
                }
                catch (TRV_Exception ex)
                {
                    // Atrapar que el correo sea invalido
                    // throw gestor.ControlarExcepcion(new TRV_Exception(TRV_Exception.ExceptionCode.MailNotSend));
                }
            }

            return(result);
        }
Exemplo n.º 6
0
        public bool RecordarContraseña(EntidadBase datos)
        {
            using (CasillerosCRUD crud = new CasillerosCRUD())
            {
                bool flag = false;
                //PoBox casillero = null;
                int idCasillero = 0;
                if (!string.IsNullOrEmpty(datos.PoBoxNumber))
                {
                    idCasillero = crud.ConsultarCasilleroByPoBoxNumber(datos.PoBoxNumber);

                    if (idCasillero > 0)
                    {
                        CrearEmailHiloRecordar(idCasillero, datos.Language);
                        flag = true;
                    }
                }

                if (!flag && !string.IsNullOrEmpty(datos.Email))
                {
                    idCasillero = crud.ConsultarCasilleroByEmail(datos.Email);
                    if (idCasillero > 0)
                    {
                        //Crea correo
                        CrearEmailHiloRecordar(idCasillero, datos.Language);
                        flag = true;
                    }
                }
                return(flag);
            }
        }
Exemplo n.º 7
0
 public override bool Eliminar(EntidadBase valor)
 {
     if (((DepositoBEL)valor).Activos.Count > 0)
     {
         throw new InvalidOperationException("El deposito tiene activos asignados");
     }
     return(base.Eliminar(valor));
 }
Exemplo n.º 8
0
        public SqlOperation GetCreateStatement(EntidadBase entidad)
        {
            var p         = (Puesto)entidad;
            var operation = new SqlOperation {
                ProcedureName = "CRE_PUESTO_PR"
            };

            operation.AddVarcharParam(DB_COL_NOMBRE, p.Nombre);
            return(operation);
        }
Exemplo n.º 9
0
        public SqlOperation GetDeleteStatement(EntidadBase entidad)
        {
            var p         = (Puesto)entidad;
            var operation = new SqlOperation {
                ProcedureName = "DEL_PUESTO_PR"
            };

            operation.AddIntParam(DB_COL_ID, p.Id);
            return(operation);
        }
Exemplo n.º 10
0
        public SqlOperation GetDeleteStatement(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "DEL_USUARIO_PR"
            };
            var u = (Usuario)entidad;

            operation.AddVarcharParam(DB_COL_CEDULA, u.Cedula);
            return(operation);
        }
Exemplo n.º 11
0
        public SqlOperation RetrievePorAutentificacion(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "RETAUTENTIFICA_USUARIO_PR"
            };
            var u = (Usuario)entidad;

            operation.AddVarcharParam(DB_COL_CORREO, u.Correo);
            return(operation);
        }
Exemplo n.º 12
0
 public void CreateClienteNoFrecuente(EntidadBase entidad)
 {
     try
     {
         _crudFactory.CreateNoFrecuente(entidad);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 13
0
        public SqlOperation GetDeleteStatement(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "DEL_CONVENIO_PR"
            };

            var c = (Convenio)entidad;

            operation.AddIntParam(DB_COL_ID, c.Id);
            return(operation);
        }
Exemplo n.º 14
0
        public SqlOperation GetDeleteStatement(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "DEL_PERMISO_PR"
            };

            var p = (Permiso)entidad;

            operation.AddIntParam(DB_COL_CODIGO, p.Codigo);
            return(operation);
        }
Exemplo n.º 15
0
        public SqlOperation GetCreateStatement(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "CRE_PERMISO_PR"
            };

            var p = (Permiso)entidad;

            operation.AddVarcharParam(DB_COL_DESCRIPCION, p.Descripcion);
            return(operation);
        }
Exemplo n.º 16
0
 public static ErrorIBS getNewErrorIBS(DataRow dr)
 {
     return(new ErrorIBS()
     {
         EIB_ErrorId = EntidadBase.IsLong(dr, "EIB_ErrorId"),
         EIB_Codigo = EntidadBase.IsInt(dr, "EIB_Codigo"),
         EIB_MensajeSistema = EntidadBase.IsString(dr, "EIB_MensajeSistema"),
         EIB_MensajeCliente = EntidadBase.IsString(dr, "EIB_MensajeCliente"),
         SIB_Nemotecnico = EntidadBase.IsString(dr, "SIB_Nemotecnico")
     });
 }
Exemplo n.º 17
0
        public SqlOperation GetDeleteStatement(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "DEL_TIPO_TIQUETE_PR"
            };

            var c = (TipoTiquete)entidad;

            operation.AddIntParam(DB_COL_ID, c.Id);
            return(operation);
        }
Exemplo n.º 18
0
        public SqlOperation GetDeleteStatement(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "DEL_HORARIO_PR"
            };

            var p = (Horario)entidad;

            operation.AddVarcharParam(DB_COL_ID, p.Id);

            return(operation);
        }
Exemplo n.º 19
0
        public SqlOperation GetDeleteStatement(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "DEL_HISTORIALVIAJES_PR"
            };

            var i = (HistorialViajes)entidad;

            operation.AddIntParam(DB_COL_CODIGO, i.Id);

            return(operation);
        }
Exemplo n.º 20
0
 public override bool Create(EntidadBase entidad)
 {
     try
     {
         SqlDao.ExecuteQueryProcedureBoolean(_mapper.GetCreateStatement(entidad));
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 21
0
        public override bool EsValido(EntidadBase valor)
        {
            if (valor.Estado)
            {
                if (Listar(valor).FindAll(_ => _.Id != valor.Id & _.Estado).Count > 0)
                {
                    throw new InvalidOperationException("Existe otro presupuesto aprobado");
                }
            }

            return(true);
        }
Exemplo n.º 22
0
 public void asignarTrenALinea(EntidadBase entidad)
 {
     try
     {
         SqlDao.ExecuteProcedure(_mapper.asignarTrenALinea(entidad));
     }
     catch (Exception ex)
     {
         AdministrarExcepcion(ex);
         throw ex;
     }
 }
Exemplo n.º 23
0
 public override bool Delete(EntidadBase entidad)
 {
     try
     {
         SqlDao.ExecuteProcedure(_mapper.GetDeleteStatement(entidad));
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 24
0
        public SqlOperation GetDeleteStatement(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "DEL_ESTACION_PR"
            };

            var e = (Estacion)entidad;

            operation.AddVarcharParam(DB_COL_CODIGO, e.Codigo);

            return(operation);
        }
Exemplo n.º 25
0
 public override bool Delete(EntidadBase entidad)
 {
     try
     {
         return(SqlDao.CanExecuteQueryProcedure(_mapper.GetDeleteStatement(entidad)));
     }
     catch (Exception ex)
     {
         AdministrarExcepcion(ex);
         throw ex;
     }
 }
Exemplo n.º 26
0
        public SqlOperation GetUpdateStatement(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "UPD_PERMISO_PR"
            };

            var p = (Permiso)entidad;

            operation.AddIntParam(DB_COL_CODIGO, p.Codigo);
            operation.AddVarcharParam(DB_COL_DESCRIPCION, p.Descripcion);
            return(operation);
        }
Exemplo n.º 27
0
        public SqlOperation GetDeleteStatement(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "DEL_LINEA_PR"
            };

            var l = (Linea)entidad;

            operation.AddVarcharParam(DB_COL_CODIGO, l.Codigo);

            return(operation);
        }
Exemplo n.º 28
0
        public SqlOperation GetDeleteStatement(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "DEL_TREN_PR"
            };

            var t = (Tren)entidad;

            operation.AddVarcharParam(DB_COL_MATRICULA, t.Matricula);

            return(operation);
        }
Exemplo n.º 29
0
        public SqlOperation GetDeleteStatement(EntidadBase entidad)
        {
            var operation = new SqlOperation {
                ProcedureName = "DEL_VAGON_PR"
            };

            var v = (Vagon)entidad;

            operation.AddIntParam(DB_COL_COD_VAGON, v.IdVagon);

            return(operation);
        }
Exemplo n.º 30
0
        public override bool Agregar(EntidadBase valor)
        {
            ActivoBEL _activo = (ActivoBEL)valor;
            var       _lista  = new ActivoDAL().Listar().ConvertAll(x => (ActivoBEL)x);

            if (_lista.Find(x => x.Inventario == _activo.Inventario || x.Serie == _activo.Serie) != null)
            {
                throw new InvalidOperationException("Existe un elemento con el mismo Nro de Inventario o Nro de Serie");
            }

            return(base.Agregar(valor));
        }