Example #1
0
        ///<remarks>
        ///   <name>BPArchivoExpediente.InsertArchivoHistorial</name>
        ///   <create>12-Junio-2014</create>
        ///   <author>Ruben.Cobos</author>
        ///</remarks>
        ///<summary>Inserta un registro en el historial del archivo</summary>
        ///<param name="oENTArchivoExpediente">Entidad de ArchivoHistorial con los parámetros necesarios para realizar la transacción</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse InsertArchivoHistorial(ENTArchivoExpediente oENTArchivoExpediente)
        {
            DAArchivoExpediente oDAArchivoExpediente = new DAArchivoExpediente();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Transacción en base de datos
                oENTResponse = oDAArchivoExpediente.InsertArchivoHistorial(oENTArchivoExpediente, this.sConnectionApplication, 0);

                // Validación de error en consulta
                if (oENTResponse.GeneratesException) { return oENTResponse; }

                // Validación de mensajes de la BD
                oENTResponse.sMessage = oENTResponse.dsResponse.Tables[0].Rows[0]["sResponse"].ToString();
                if (oENTResponse.sMessage != "") { return oENTResponse; }

            }catch (Exception ex){
                oENTResponse.ExceptionRaised(ex.Message);
            }

            // Resultado
            return oENTResponse;
        }
Example #2
0
        ///<remarks>
        ///   <name>DAArchivoExpediente.InsertArchivoComentario</name>
        ///   <create>11-Junio-2014</create>
        ///   <author>Ruben.Cobos</author>
        ///</remarks>
        ///<summary>Inserta un comentario al Expediente en el módulo de Archivo</summary>
        ///<param name="oENTArchivoExpediente">Entidad de ArchivoExpediente con los parámetros necesarios para crear el comentario</param>
        ///<param name="sConnection">Cadena de conexión a la base de datos</param>
        ///<param name="iAlternateDBTimeout">Valor en milisegundos del Timeout en la consulta a la base de datos. 0 si se desea el Timeout por default</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse InsertArchivoComentario(ENTArchivoExpediente oENTArchivoExpediente, String sConnection, Int32 iAlternateDBTimeout)
        {
            SqlConnection sqlCnn = new SqlConnection(sConnection);
            SqlCommand sqlCom;
            SqlParameter sqlPar;
            SqlDataAdapter sqlDA;

            ENTResponse oENTResponse = new ENTResponse();

            // Configuración de objetos
            sqlCom = new SqlCommand("uspArchivoComentario_Ins", sqlCnn);
            sqlCom.CommandType = CommandType.StoredProcedure;

            // Timeout alternativo en caso de ser solicitado
            if (iAlternateDBTimeout > 0) { sqlCom.CommandTimeout = iAlternateDBTimeout; }

            // Parametros
            sqlPar = new SqlParameter("ArchivoId", SqlDbType.Int);
            sqlPar.Value = oENTArchivoExpediente.ArchivoId;
            sqlCom.Parameters.Add(sqlPar);

            sqlPar = new SqlParameter("UsuarioId", SqlDbType.Int);
            sqlPar.Value = oENTArchivoExpediente.idUsuario;
            sqlCom.Parameters.Add(sqlPar);

            sqlPar = new SqlParameter("Comentario", SqlDbType.VarChar);
            sqlPar.Value = oENTArchivoExpediente.Comentario;
            sqlCom.Parameters.Add(sqlPar);

            // Inicializaciones
            oENTResponse.dsResponse = new DataSet();
            sqlDA = new SqlDataAdapter(sqlCom);

            // Transacción
            try{
                sqlCnn.Open();
                sqlDA.Fill(oENTResponse.dsResponse);
                sqlCnn.Close();
            }catch (SqlException sqlEx){
                oENTResponse.ExceptionRaised(sqlEx.Message);
            }catch (Exception ex){
                oENTResponse.ExceptionRaised(ex.Message);
            }finally{
                if (sqlCnn.State == ConnectionState.Open) { sqlCnn.Close(); }
                sqlCnn.Dispose();
            }

            // Resultado
            return oENTResponse;
        }
        void UpdateArchivo_Recibir()
        {
            BPArchivoExpediente oBPArchivoExpediente = new BPArchivoExpediente();

            ENTArchivoExpediente oENTArchivoExpediente = new ENTArchivoExpediente();
            ENTResponse oENTResponse = new ENTResponse();
            ENTSession SessionEntity = new ENTSession();

            try
            {

                // Obtener sesión
                SessionEntity = (ENTSession)Session["oENTSession"];

                // Formulario
                oENTArchivoExpediente.ArchivoId = Int32.Parse(this.hddArchivoId.Value);
                oENTArchivoExpediente.idUsuario_Recibe = SessionEntity.idUsuario;

                // Transacción
                oENTResponse = oBPArchivoExpediente.UpdateArchivo_Recibir(oENTArchivoExpediente);

                // Errores y Warnings
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

            }catch (Exception ex){
                throw (ex);
            }
        }
        void UpdateArchivo_Liberar()
        {
            BPArchivoExpediente oBPArchivoExpediente = new BPArchivoExpediente();

            ENTArchivoExpediente oENTArchivoExpediente = new ENTArchivoExpediente();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Formulario
                oENTArchivoExpediente.ArchivoId = Int32.Parse(this.hddArchivoId.Value);

                // Transacción
                oENTResponse = oBPArchivoExpediente.UpdateArchivo_Liberar(oENTArchivoExpediente);

                // Errores y Warnings
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

            }catch (Exception ex){
                throw (ex);
            }
        }
        void SelectArchivo()
        {
            BPArchivoExpediente oBPArchivoExpediente = new BPArchivoExpediente();

            ENTArchivoExpediente oENTArchivoExpediente = new ENTArchivoExpediente();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Formulario
                oENTArchivoExpediente.ArchivoId = Int32.Parse(this.hddArchivoId.Value);

                // Transacción
                oENTResponse = oBPArchivoExpediente.SelectArchivo_Detalle(oENTArchivoExpediente);

                // Errores y Warnings
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

                // Campos ocultos
                this.hddUbicacionExpedienteId.Value = oENTResponse.dsResponse.Tables[1].Rows[0]["UbicacionExpedienteId"].ToString();

                // Formulario
                this.ExpedienteNumeroLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["ExpedienteNumero"].ToString();
                this.SolicitudNumeroLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["SolicitudNumero"].ToString();
                this.AreaNombreLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["AreaNombre"].ToString();
                this.CalificacionLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["CalificacionNombre"].ToString();
                this.UbicacionLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["UbicacionExpedienteNombre"].ToString();

                this.FechaRecepcionLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["FechaRecepcion"].ToString();
                this.EstatusLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["EstatusArchivo"].ToString();

                // Grid
                this.gvHistorial.DataSource = oENTResponse.dsResponse.Tables[2];
                this.gvHistorial.DataBind();

                // Comentarios
                if (oENTResponse.dsResponse.Tables[3].Rows.Count == 0){

                    this.SinComentariosLabel.Text = "<br /><br />No hay comentarios relacionados al Archivo";
                }else{

                    this.SinComentariosLabel.Text = "";
                    this.repComentarios.DataSource = oENTResponse.dsResponse.Tables[3];
                    this.repComentarios.DataBind();
                    this.ComentarioTituloLabel.Text = oENTResponse.dsResponse.Tables[3].Rows.Count.ToString() + " comentarios";
                }

            }catch (Exception ex){
                throw (ex);
            }
        }
        // Rutinas del programador
        void InsertArchivoComentario()
        {
            BPArchivoExpediente oBPArchivoExpediente = new BPArchivoExpediente();

            ENTArchivoExpediente oENTArchivoExpediente = new ENTArchivoExpediente();
            ENTResponse oENTResponse = new ENTResponse();
            ENTSession SessionEntity = new ENTSession();

            try
            {

                // Validaciones
                if (this.ckeComentario.Text.Trim() == "") { throw (new Exception("Es necesario ingresar un comentario")); }

                // Obtener sesión
                SessionEntity = (ENTSession)Session["oENTSession"];

                // Formulario
                oENTArchivoExpediente.ArchivoId = Int32.Parse(this.hddArchivoId.Value);
                oENTArchivoExpediente.idUsuario = SessionEntity.idUsuario;
                oENTArchivoExpediente.Comentario = this.ckeComentario.Text.Trim();

                // Transacción
                oENTResponse = oBPArchivoExpediente.InsertArchivoComentario(oENTArchivoExpediente);

                // Errores y Warnings
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

            }catch (Exception ex){
                throw (ex);
            }
        }
        // Rutinas del programador
        private void SelectArchivo()
        {
            BPArchivoExpediente oBPArchivoExpediente = new BPArchivoExpediente();
            ENTArchivoExpediente oENTArchivoExpediente = new ENTArchivoExpediente();
            ENTResponse oENTResponse = new ENTResponse();

            ENTSession oSession = (ENTSession)Session["oENTSession"];

            try
            {

                // Transacción
                oENTResponse = oBPArchivoExpediente.SelectArchivo(oENTArchivoExpediente);

                // Errores
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }

                // Warnings
                if (oENTResponse.sMessage != "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('" + oENTResponse.sMessage + "');", true); }

                // Llenado de control
                this.gvArchivo.DataSource = oENTResponse.dsResponse.Tables[1];
                this.gvArchivo.DataBind();

            }catch (Exception ex){
                throw (ex);
            }
        }
        void SelectArchivo()
        {
            BPArchivoExpediente oBPArchivoExpediente = new BPArchivoExpediente();

            ENTArchivoExpediente oENTArchivoExpediente = new ENTArchivoExpediente();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Formulario
                oENTArchivoExpediente.ArchivoId = Int32.Parse(this.hddArchivoId.Value);

                // Transacción
                oENTResponse = oBPArchivoExpediente.SelectArchivo_Detalle(oENTArchivoExpediente);

                // Errores y Warnings
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

                // Formulario
                this.ExpedienteNumeroLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["ExpedienteNumero"].ToString();
                this.SolicitudNumeroLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["SolicitudNumero"].ToString();
                this.AreaNombreLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["AreaNombre"].ToString();
                this.CalificacionLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["CalificacionNombre"].ToString();
                this.UbicacionLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["UbicacionExpedienteNombre"].ToString();

                this.FechaRecepcionLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["FechaRecepcion"].ToString();
                this.EstatusLabel.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["EstatusArchivo"].ToString();

            }catch (Exception ex){
                throw (ex);
            }
        }
        // Rutinas del programador
        void InsertArchivoHistorial()
        {
            BPArchivoExpediente oBPArchivoExpediente = new BPArchivoExpediente();

            ENTArchivoExpediente oENTArchivoExpediente = new ENTArchivoExpediente();
            ENTResponse oENTResponse = new ENTResponse();
            ENTSession SessionEntity = new ENTSession();

            try
            {

                // Validaciones
                if (this.ddlUsuario_Recibe.SelectedItem.Value == "0") { throw (new Exception("Es necesario seleccionar un Usuario para asignarle el Expediente")); }

                // Obtener sesión
                SessionEntity = (ENTSession)Session["oENTSession"];

                // Formulario
                oENTArchivoExpediente.ArchivoId = Int32.Parse(this.hddArchivoId.Value);
                oENTArchivoExpediente.UbicacionExpedienteId = 4; // Prestado
                oENTArchivoExpediente.idUsuario_Presta = SessionEntity.idUsuario;
                oENTArchivoExpediente.idUsuario_Recibe = Int32.Parse(this.ddlUsuario_Recibe.SelectedItem.Value);
                oENTArchivoExpediente.Comentario = this.ckeComentarios.Text.Trim();

                // Transacción
                oENTResponse = oBPArchivoExpediente.InsertArchivoHistorial(oENTArchivoExpediente);

                // Errores y Warnings
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

            }catch (Exception ex){
                throw (ex);
            }
        }
Example #10
0
        void SelectUbicacionExpediente()
        {
            BPArchivoExpediente oBPArchivoExpediente = new BPArchivoExpediente();

            ENTArchivoExpediente oENTArchivoExpediente = new ENTArchivoExpediente();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Formulario
                oENTArchivoExpediente.UbicacionExpedienteId = 0;
                oENTArchivoExpediente.Nombre = "";
                oENTArchivoExpediente.Ubicacion = 1; // Sólo ubicaciones

                // Transacción
                oENTResponse = oBPArchivoExpediente.SelectUbicacionExpediente(oENTArchivoExpediente);

                // Errores y Warnings
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
                if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }

                // Llenado de combo
                this.ddlUbicacionExpediente.DataTextField = "Nombre";
                this.ddlUbicacionExpediente.DataValueField = "UbicacionExpedienteId";
                this.ddlUbicacionExpediente.DataSource = oENTResponse.dsResponse.Tables[1];
                this.ddlUbicacionExpediente.DataBind();

                // Agregar Item de selección
                this.ddlUbicacionExpediente.Items.Insert(0, new ListItem("[Seleccione]", "0"));

            }catch (Exception ex){
                throw (ex);
            }
        }
        // Rutinas del programador
        void SelectArchivo()
        {
            BPArchivoExpediente oBPArchivoExpediente = new BPArchivoExpediente();

            ENTArchivoExpediente oENTArchivoExpediente = new ENTArchivoExpediente();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Formulario
                oENTArchivoExpediente.SolicitudNumero = this.txtSolicitudNumero.Text.Trim();
                oENTArchivoExpediente.ExpedienteNumero = this.txtExpedienteNumero.Text.Trim();
                oENTArchivoExpediente.idUsuario = Int32.Parse(this.ddlUsuario.SelectedItem.Value);
                oENTArchivoExpediente.UbicacionExpedienteId = Int32.Parse(this.ddlUbicacionExpediente.SelectedItem.Value);
                oENTArchivoExpediente.FechaDesde = this.wucBeginDate.BeginDate;
                oENTArchivoExpediente.FechaHasta = this.wucEndDate.EndDate;

                // Transacción
                oENTResponse = oBPArchivoExpediente.SelectArchivo_Filtro(oENTArchivoExpediente);

                // Errores
                if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }

                // Warnings
                if (oENTResponse.sMessage != "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('" + oENTResponse.sMessage + "');", true); }

                // Llenado de control
                this.gvArchivo.DataSource = oENTResponse.dsResponse.Tables[1];
                this.gvArchivo.DataBind();

            }catch (Exception ex){
                throw (ex);
            }
        }
Example #12
0
        ///<remarks>
        ///   <name>DAArchivoExpediente.SelectArchivo</name>
        ///   <create>11-Junio-2014</create>
        ///   <author>Ruben.Cobos</author>
        ///</remarks>
        ///<summary>Obtiene el listado de Archivos listos para ser recibidos por el modulo de Archivo</summary>
        ///<param name="oENTArchivoExpediente">Entidad de ArchivoExpediente con los parámetros necesarios para consultar la información</param>
        ///<param name="sConnection">Cadena de conexión a la base de datos</param>
        ///<param name="iAlternateDBTimeout">Valor en milisegundos del Timeout en la consulta a la base de datos. 0 si se desea el Timeout por default</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse SelectArchivo(ENTArchivoExpediente oENTArchivoExpediente, String sConnection, Int32 iAlternateDBTimeout)
        {
            SqlConnection sqlCnn = new SqlConnection(sConnection);
            SqlCommand sqlCom;
            SqlDataAdapter sqlDA;

            ENTResponse oENTResponse = new ENTResponse();

            // Configuración de objetos
            sqlCom = new SqlCommand("uspArchivo_Sel", sqlCnn);
            sqlCom.CommandType = CommandType.StoredProcedure;

            // Timeout alternativo en caso de ser solicitado
            if (iAlternateDBTimeout > 0) { sqlCom.CommandTimeout = iAlternateDBTimeout; }

            // Inicializaciones
            oENTResponse.dsResponse = new DataSet();
            sqlDA = new SqlDataAdapter(sqlCom);

            // Transacción
            try{
                sqlCnn.Open();
                sqlDA.Fill(oENTResponse.dsResponse);
                sqlCnn.Close();
            }catch (SqlException sqlEx){
                oENTResponse.ExceptionRaised(sqlEx.Message);
            }catch (Exception ex){
                oENTResponse.ExceptionRaised(ex.Message);
            }finally{
                if (sqlCnn.State == ConnectionState.Open) { sqlCnn.Close(); }
                sqlCnn.Dispose();
            }

            // Resultado
            return oENTResponse;
        }