Exemplo n.º 1
0
        ///<remarks>
        ///   <name>DARecomendacion.DeleteRecomendacion</name>
        ///   <create>31/Ago/2014</create>
        ///   <author>Ruben.Cobos</author>
        ///</remarks>
        ///<summary>Elimina una Recomendacion para un Expediente</summary>
        ///<param name="oENTRecomendacion">Entidad de Tipo de Recomendación con los parámetros necesarios para la transacción</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse DeleteRecomendacion(ENTRecomendacion oENTRecomendacion, string ConnectionString, int iAlternativeTimeOut)
        {
            SqlConnection Connection = new SqlConnection(ConnectionString);
            SqlCommand Command;
            SqlDataAdapter DataAdapter;
            SqlParameter Parameter;

            ENTResponse oENTResponse = new ENTResponse();

            Command = new SqlCommand("uspRecomendacion_Del", Connection);
            Command.CommandType = CommandType.StoredProcedure;

            if (iAlternativeTimeOut > 0) { Command.CommandTimeout = iAlternativeTimeOut; }

            Parameter = new SqlParameter("RecomendacionId", SqlDbType.Int);
            Parameter.Value = oENTRecomendacion.RecomendacionId;
            Command.Parameters.Add(Parameter);

            Parameter = new SqlParameter("ExpedienteId", SqlDbType.Int);
            Parameter.Value = oENTRecomendacion.ExpedienteId;
            Command.Parameters.Add(Parameter);

            Parameter = new SqlParameter("ModuloId", SqlDbType.Int);
            Parameter.Value = oENTRecomendacion.ModuloId;
            Command.Parameters.Add(Parameter);

            oENTResponse.dsResponse = new DataSet();
            DataAdapter = new SqlDataAdapter(Command);

            try
            {

                Connection.Open();
                DataAdapter.Fill(oENTResponse.dsResponse);
                Connection.Close();

            }catch (SqlException ex) {

                oENTResponse.ExceptionRaised(ex.Message);

            }catch (Exception ex) {

                oENTResponse.ExceptionRaised(ex.Message);

            }finally{

                if (Connection.State == ConnectionState.Open) { Connection.Close(); }
            }

            return oENTResponse;
        }
Exemplo n.º 2
0
        ///<remarks>
        ///   <name>BPRecomendacion.InsertRecomendacion</name>
        ///   <create>31-Agosto-2014</create>
        ///   <author>Ruben.Cobos</author>
        ///</remarks>
        ///<summary>Crea una Recomendacion para un Expediente</summary>
        ///<param name="oENTRecomendacion">Entidad de Tipo de Recomendación con los parámetros necesarios para la transacción</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse InsertRecomendacion(ENTRecomendacion oENTRecomendacion)
        {
            DARecomendacion oDARecomendacion = new DARecomendacion();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {
                oENTResponse = oDARecomendacion.InsertRecomendacion(oENTRecomendacion, sConnectionApplication, 0);

                if (oENTResponse.GeneratesException) { return oENTResponse; }

                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;
        }
Exemplo n.º 3
0
        ///<remarks>
        ///   <name>DARecomendacion.InsertRecomendacion</name>
        ///   <create>31/Ago/2014</create>
        ///   <author>Ruben.Cobos</author>
        ///</remarks>
        ///<summary>Crea una Recomendacion para un Expediente</summary>
        ///<param name="oENTRecomendacion">Entidad de Tipo de Recomendación con los parámetros necesarios para la transacción</param>
        ///<returns>Una entidad de respuesta</returns>
        public ENTResponse InsertRecomendacion(ENTRecomendacion oENTRecomendacion, string ConnectionString, int iAlternativeTimeOut)
        {
            SqlConnection Connection = new SqlConnection(ConnectionString);
            SqlCommand Command;
            SqlDataAdapter DataAdapter;
            SqlParameter Parameter;

            ENTResponse oENTResponse = new ENTResponse();

            Command = new SqlCommand("uspRecomendacion_Ins", Connection);
            Command.CommandType = CommandType.StoredProcedure;

            if (iAlternativeTimeOut > 0) { Command.CommandTimeout = iAlternativeTimeOut; }

            Parameter = new SqlParameter("AutoridadId", SqlDbType.Int);
            Parameter.Value = oENTRecomendacion.AutoridadId;
            Command.Parameters.Add(Parameter);

            Parameter = new SqlParameter("EstatusId", SqlDbType.Int);
            Parameter.Value = oENTRecomendacion.EstatusId;
            Command.Parameters.Add(Parameter);

            Parameter = new SqlParameter("ExpedienteId", SqlDbType.Int);
            Parameter.Value = oENTRecomendacion.ExpedienteId;
            Command.Parameters.Add(Parameter);

            Parameter = new SqlParameter("ModuloId", SqlDbType.Int);
            Parameter.Value = oENTRecomendacion.ModuloId;
            Command.Parameters.Add(Parameter);

            Parameter = new SqlParameter("VisitadorId", SqlDbType.Int);
            Parameter.Value = oENTRecomendacion.FuncionarioId;
            Command.Parameters.Add(Parameter);

            Parameter = new SqlParameter("AcuerdoNoResponsabilidad", SqlDbType.TinyInt);
            Parameter.Value = oENTRecomendacion.AcuerdoNoResponsabilidad;
            Command.Parameters.Add(Parameter);

            Parameter = new SqlParameter("tblRecomendacionDetalle", SqlDbType.Structured);
            Parameter.Value = oENTRecomendacion.tblRecomendacionDetalle;
            Command.Parameters.Add(Parameter);

            oENTResponse.dsResponse = new DataSet();
            DataAdapter = new SqlDataAdapter(Command);

            try
            {

                Connection.Open();
                DataAdapter.Fill(oENTResponse.dsResponse);
                Connection.Close();

            }catch (SqlException ex) {

                oENTResponse.ExceptionRaised(ex.Message);

            }catch (Exception ex) {

                oENTResponse.ExceptionRaised(ex.Message);

            }finally{

                if (Connection.State == ConnectionState.Open) { Connection.Close(); }
            }

            return oENTResponse;
        }
Exemplo n.º 4
0
        void SelectRecomendacion_Detalle(ref GridView grdDetalle, Int32 RecomendacionId)
        {
            BPRecomendacion oBPRecomendacion = new BPRecomendacion();
            ENTRecomendacion oENTRecomendacion = new ENTRecomendacion();
            ENTResponse oENTResponse = new ENTResponse();

            try
            {

                // Formulario
                oENTRecomendacion.RecomendacionId = RecomendacionId;

                // Transacción
                oENTResponse = oBPRecomendacion.SelectRecomendacion_ByID(oENTRecomendacion);

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

                // Llenado de control
                grdDetalle.DataSource = oENTResponse.dsResponse.Tables[2];
                grdDetalle.DataBind();

            }catch (Exception ex){
                throw (ex);
            }
        }
        void UpdateAcuerdo()
        {
            BPRecomendacion oBPRecomendacion = new BPRecomendacion();

            ENTResponse oENTResponse = new ENTResponse();
            ENTRecomendacion oENTRecomendacion = new ENTRecomendacion();
            ENTSession oENTSession;

            String AutoridadId = "";
            RadioButton oRadioButton;

            DataTable tblCommon = null;
            DataRow rowCommon;

            try
            {

               // Obtener Sesion
                oENTSession = (ENTSession)this.Session["oENTSession"];

                // Validaciones de sesión
                if (oENTSession.FuncionarioId == 0) { throw new Exception("No cuenta con permisos para crear Acuerdos debido a que usted no es un funcionario"); }

                // Obtener la autoridad seleccionada
                foreach (GridViewRow gvRow in this.gvAutoridad.Rows) {

                    oRadioButton = (RadioButton)this.gvAutoridad.Rows[gvRow.RowIndex].FindControl("RowSelector");
                    if (oRadioButton.Checked) {
                        AutoridadId = this.gvAutoridad.DataKeys[gvRow.RowIndex]["AutoridadId"].ToString();
                    }
                }

                //Formulario
                oENTRecomendacion.RecomendacionId = Int32.Parse(this.hddRecomendacionId.Value);
                oENTRecomendacion.AutoridadId = Convert.ToInt32(AutoridadId);
                oENTRecomendacion.EstatusId = 9; // Por asignar a defensor de Seguimientos
                oENTRecomendacion.ExpedienteId = Convert.ToInt32(this.hddExpedienteId.Value);
                oENTRecomendacion.ModuloId = 3; // Visitadurías
                oENTRecomendacion.FuncionarioId = oENTSession.FuncionarioId;

                tblCommon = gcParse.GridViewToDataTable(this.gvAutoridadDetalle, false);
                oENTRecomendacion.tblRecomendacionDetalle = new DataTable("tblAcuerdoDetalle");
                oENTRecomendacion.tblRecomendacionDetalle.Columns.Add("Detalle", typeof(String));
                foreach (DataRow oDataRow in tblCommon.Rows){

                    rowCommon = oENTRecomendacion.tblRecomendacionDetalle.NewRow();
                    rowCommon["Detalle"] = oDataRow["Apartado"];
                    oENTRecomendacion.tblRecomendacionDetalle.Rows.Add(rowCommon);
                }

                //Transacción
                oENTResponse = oBPRecomendacion.UpdateRecomendacion(oENTRecomendacion);

                //Validación
                if (oENTResponse.GeneratesException) { throw new Exception(oENTResponse.sErrorMessage); }
                if (oENTResponse.sMessage != "") { throw new Exception(oENTResponse.sMessage); }

                // Actualizar grid
                SelectExpediente();

            }catch (Exception ex){
                throw (ex);
            }
        }
        void SelectAcuerdo_ForEdit(String RecomendacionId)
        {
            ENTRecomendacion oENTRecomendacion = new ENTRecomendacion();
            ENTResponse oENTResponse = new ENTResponse();
            BPRecomendacion oBPRecomendacion = new BPRecomendacion();

            RadioButton oRadioButton;

            try
            {
                // Formulario
                oENTRecomendacion.RecomendacionId = Int32.Parse(RecomendacionId);

                // Transacción
                oENTResponse = oBPRecomendacion.SelectRecomendacion_ByID(oENTRecomendacion);

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

                // Mensaje de la BD
                if (oENTResponse.sMessage != "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('" + gcJavascript.ClearText(oENTResponse.sMessage) + "');", true); }

                // Llenado de formulario
                foreach (GridViewRow gvRow in this.gvAutoridad.Rows){

                    oRadioButton = (RadioButton)this.gvAutoridad.Rows[gvRow.RowIndex].FindControl("RowSelector");
                    if (oENTResponse.dsResponse.Tables[1].Rows[0]["AutoridadId"].ToString() == this.gvAutoridad.DataKeys[gvRow.RowIndex]["AutoridadId"].ToString()) { oRadioButton.Checked = true; }
                }

                this.gvAutoridadDetalle.DataSource = oENTResponse.dsResponse.Tables[2];
                this.gvAutoridadDetalle.DataBind();

                // Id a trabajar
                this.hddRecomendacionId.Value = RecomendacionId.ToString();

                // Estado del formulario
                this.btnAction.Text = "Modificar acuerdo";
                this.lblActionTitle.Text = "Modificar acuerdo";
                this.pnlAction.Visible = true;

                // Foco
                this.ckeApartado.Focus();

            }catch (Exception ex){
                throw (ex);
            }
        }
        // Funciones el programador
        void DeleteAcuerdo(String RecomendacionId)
        {
            ENTResponse oENTResponse = new ENTResponse();
            ENTRecomendacion oENTRecomendacion = new ENTRecomendacion();
            BPRecomendacion oBPRecomendacion = new BPRecomendacion();

            try
            {
                oENTRecomendacion.RecomendacionId = Int32.Parse( RecomendacionId);
                oENTRecomendacion.ExpedienteId = Convert.ToInt32(this.hddExpedienteId.Value);
                oENTRecomendacion.ModuloId = 3; // Visitadurías

                oENTResponse = oBPRecomendacion.DeleteRecomendacion(oENTRecomendacion);

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

                SelectExpediente();

            }catch (Exception ex){
                throw (ex);
            }
        }