public InstitucionBE ActualizarInstitucion(InstitucionBE entidad) { try { using (IDbConnection db = new OracleConnection(CadenaConexion)) { string sp = sPackage + "USP_UPD_INSTITUCION"; var parametros = new OracleParameter[5]; parametros[0] = new OracleParameter("pID_INSTITUCION", entidad.ID_INSTITUCION); parametros[1] = new OracleParameter("pID_SECTOR_INSTITUCION", entidad.ID_SECTOR_INSTITUCION); parametros[2] = new OracleParameter("pRUC_INSTITUCION", entidad.RUC_INSTITUCION); parametros[3] = new OracleParameter("pNOMBRE_INSTITUCION", entidad.NOMBRE_INSTITUCION); parametros[4] = new OracleParameter("pDIRECCION_INSTITUCION", entidad.DIRECCION_INSTITUCION); OracleHelper.ExecuteNonQuery(CadenaConexion, CommandType.StoredProcedure, sp, parametros); } entidad.OK = true; } catch (Exception ex) { entidad.extra = ex.Message; Log.Error(ex); } return(entidad); }
public JsonResult RegistrarUsuario(UsuarioBE entidad) { ResponseEntity itemRespuesta = new ResponseEntity(); InstitucionBE institucion = new InstitucionBE(entidad.ID_SECTOR_INST, entidad.RUC, entidad.INSTITUCION, entidad.DIRECCION); institucion = InstitucionLN.registrarInstitucion(institucion); if (institucion.ID_INSTITUCION != 0) { entidad.ID_INSTITUCION = institucion.ID_INSTITUCION; entidad = UsuarioLN.RegistraUsuario(entidad); if (!entidad.OK) { itemRespuesta.success = false; itemRespuesta.extra = entidad.extra; } else { EnvioCorreo hilo_correo = new EnvioCorreo(entidad); //.CreacionUsuario(entidad); //Thread hilo = new Thread(new ThreadStart(hilo_correo.CreacionUsuario)); //hilo.Start(); //hilo.Join(); Task tarea = Task.Factory.StartNew(() => hilo_correo.CreacionUsuario()); itemRespuesta.success = true; } } else { itemRespuesta.success = false; itemRespuesta.extra = institucion.extra; } return(Respuesta(itemRespuesta)); }
public List <InstitucionBE> ListaInstitucionPaginado(InstitucionBE entidad) { List <InstitucionBE> Lista = null; try { using (IDbConnection db = new OracleConnection(CadenaConexion)) { string sp = sPackage + "USP_SEL_INSTITUCION"; var p = new OracleDynamicParameters(); p.Add("pBuscar", entidad.buscar); p.Add("pRegistros", entidad.cantidad_registros); p.Add("pPagina", entidad.pagina); p.Add("pSortColumn", entidad.order_by); p.Add("pSortOrder", entidad.order_orden); p.Add("pRefcursor", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output); Lista = db.Query <InstitucionBE>(sp, p, commandType: CommandType.StoredProcedure).ToList(); } } catch (Exception ex) { Log.Error(ex); } return(Lista); }
public InstitucionBE registrarInstitucion(InstitucionBE entidad) { int cod = 0; try { using (IDbConnection db = new OracleConnection(CadenaConexion)) { string sp = sPackage_2 + "USP_INS_INSTITUCION"; var parametros = new OracleParameter[5]; parametros[0] = new OracleParameter("pID_SECTOR_INSTITUCION", entidad.INSTIPO); parametros[1] = new OracleParameter("pRUC_INSTITUCION", entidad.INSRUC); parametros[2] = new OracleParameter("pNOMBRE_INSTITUCION", entidad.INSNOMBRE); parametros[3] = new OracleParameter("pDIRECCION_INSTITUCION", entidad.INSDIRECCION); parametros[4] = new OracleParameter("pIdInstitucion", OracleDbType.Int32, ParameterDirection.Output); OracleHelper.ExecuteNonQuery(CadenaConexion, CommandType.StoredProcedure, sp, parametros); cod = int.Parse(parametros[4].Value.ToString()); entidad.ID_INSTITUCION = cod; entidad.OK = true; } } catch (Exception ex) { entidad.extra = ex.Message; Log.Error(ex); } return(entidad); }
public static List <InstitucionBE> ListarInstitucionExcel(InstitucionBE entidad) { if (string.IsNullOrEmpty(entidad.buscar)) { entidad.buscar = ""; } return(institucionDA.ListarInstitucionExcel(entidad)); }
public InstitucionBE GetInstitucionPorId(InstitucionBE entidad) { try { using (IDbConnection db = new OracleConnection(CadenaConexion)) { string sp = sPackage + "USP_GET_INSTITUCION_ID"; var p = new OracleDynamicParameters(); p.Add("pIdInstitucion", entidad.ID_INSTITUCION); p.Add("pRefcursor", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output); entidad = db.Query <InstitucionBE>(sp, p, commandType: CommandType.StoredProcedure).FirstOrDefault(); } } catch (Exception ex) { Log.Error(ex); } return(entidad); }
public List <InstitucionBE> ListaInstitucion(InstitucionBE entidad) { List <InstitucionBE> Lista = null; try { using (IDbConnection db = new OracleConnection(CadenaConexion)) { string sp = sPackage_2 + "USP_SEL_INSTITUCION"; var p = new OracleDynamicParameters(); p.Add("pRefcursor", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output); Lista = db.Query <InstitucionBE>(sp, p, commandType: CommandType.StoredProcedure).ToList(); } } catch (Exception ex) { Log.Error(ex); } return(Lista); }
public InstitucionBE EliminarInstitucion(InstitucionBE entidad) { try { using (IDbConnection db = new OracleConnection(CadenaConexion)) { string sp = sPackage + "USP_DEL_INSTITUCION"; var parametros = new OracleParameter[1]; parametros[0] = new OracleParameter("pID_INSTITUCION", entidad.ID_INSTITUCION); OracleHelper.ExecuteNonQuery(CadenaConexion, CommandType.StoredProcedure, sp, parametros); } entidad.OK = true; } catch (Exception ex) { entidad.extra = ex.Message; Log.Error(ex); } return(entidad); }
public JsonResult RegistrarUsuario2(HttpPostedFileBase fledeclaracion, FormCollection forms) { UsuarioBE entidad = new UsuarioBE(); entidad.ID_SECTOR_INST = int.Parse(Request.Form["ID_SECTOR_INST"].ToString()); entidad.EMAIL_USUARIO = Request.Form["EMAIL_USUARIO"].ToString(); entidad.NOMBRES_USUARIO = Request.Form["NOMBRES_USUARIO"].ToString(); entidad.APELLIDOS_USUARIO = Request.Form["APELLIDOS_USUARIO"].ToString(); entidad.PASSWORD_USUARIO = Request.Form["PASSWORD_USUARIO"].ToString(); entidad.TELEFONO_USUARIO = Request.Form["TELEFONO_USUARIO"].ToString(); entidad.CELULAR_USUARIO = Request.Form["CELULAR_USUARIO"].ToString(); entidad.ANEXO_USUARIO = Request.Form["ANEXO_USUARIO"].ToString(); entidad.INSTITUCION = Request.Form["INSTITUCION"].ToString(); entidad.RUC = Request.Form["RUC"].ToString(); entidad.DIRECCION = Request.Form["DIRECCION"].ToString(); entidad.ID_ROL = int.Parse(Request.Form["ID_ROL"].ToString()); entidad.ID_ESTADO_USUARIO = int.Parse(Request.Form["ID_ESTADO_USUARIO"].ToString()); entidad.TERMINOS = Char.Parse(Request.Form["TERMINOS"]); if (entidad.ID_SECTOR_INST == 1) { entidad.SECTOR = "Público"; } else if (entidad.ID_SECTOR_INST == 2) { entidad.SECTOR = "Privado"; } ResponseEntity itemRespuesta = new ResponseEntity(); InstitucionBE institucion = new InstitucionBE(entidad.ID_SECTOR_INST, entidad.RUC, entidad.INSTITUCION, entidad.DIRECCION); institucion = InstitucionLN.registrarInstitucion(institucion); if (institucion.ID_INSTITUCION != 0) { string nomArchivoSave = ""; string nomOriginal = ""; if (fledeclaracion != null) { nomOriginal = fledeclaracion.FileName; var content = new byte[fledeclaracion.ContentLength]; fledeclaracion.InputStream.Read(content, 0, fledeclaracion.ContentLength); double tamanio = (fledeclaracion.ContentLength / 1024); nomArchivoSave = Guid.NewGuid() + Path.GetExtension(fledeclaracion.FileName).ToString(); } entidad.ID_INSTITUCION = institucion.ID_INSTITUCION; entidad.ADJUNTO = nomArchivoSave; entidad.ADJUNTO_BASE = nomOriginal; entidad = UsuarioLN.RegistraUsuario(entidad); if (!entidad.OK) { itemRespuesta.success = false; itemRespuesta.extra = entidad.extra; } else { if (fledeclaracion != null) { try { //string nomArchivoSave = ""; //var content = new byte[fledeclaracion.ContentLength]; //fledeclaracion.InputStream.Read(content, 0, fledeclaracion.ContentLength); //double tamanio = (fledeclaracion.ContentLength / 1024); //nomArchivoSave = Guid.NewGuid() + Path.GetExtension(fledeclaracion.FileName).ToString(); var carpeta = WebConfigurationManager.AppSettings.Get("DJ"); var ruta = Path.Combine(carpeta, nomArchivoSave); fledeclaracion.SaveAs(ruta); itemRespuesta.success = true; } catch (Exception e) { itemRespuesta.success = false; itemRespuesta.extra = e.Message; } } EnvioCorreo hilo_correo = new EnvioCorreo(entidad); //.CreacionUsuario(entidad); //Thread hilo = new Thread(new ThreadStart(hilo_correo.CreacionUsuario)); //hilo.Start(); //hilo.Join(); //hilo_correo.CreacionUsuario(); Task tarea = Task.Factory.StartNew(() => hilo_correo.CreacionUsuario()); itemRespuesta.success = true; } } else { itemRespuesta.success = false; itemRespuesta.extra = institucion.extra; } return(Respuesta(itemRespuesta)); }
public static InstitucionBE EliminarInstitucion(InstitucionBE entidad) { return(institucionDA.EliminarInstitucion(entidad)); }
public static InstitucionBE ActualizarInstitucion(InstitucionBE entidad) { return(institucionDA.ActualizarInstitucion(entidad)); }
public static InstitucionBE GetInstitucionPorId(InstitucionBE entidad) { return(institucionDA.GetInstitucionPorId(entidad)); }
public static InstitucionBE registrarInstitucion(InstitucionBE entidad) { return(institucionDA.registrarInstitucion(entidad)); }
public static List <IniciativaBE> ListarInstitucionAcciones(InstitucionBE entidad) { return(iniciativaDA.ListarInstitucionAcciones(entidad)); }