示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (this.IsPostBack)
         {
         }
         else
         {
             _Alerta_id = Convert.ToInt32(Request.QueryString["Alerta_id"]);
             if (Request.QueryString["reg"] != null)
             {
                 _reg = Request.QueryString["reg"].ToString();
             }
             if (_reg == "ver")
             {
                 btnRegistrar.Visible = false;
             }
             _ALR_AlertasBE    = _ALR_AlertasBL.TraerALR_AlertasById(_Alerta_id);
             lblAlerta_id.Text = _ALR_AlertasBE.Alerta_id.ToString();
             txtFecha.Text     = _ALR_AlertasBE.Fecha_alerta.ToString("dd/MM/yyyy");
             if (_ALR_AlertasBE.Estado == 1)
             {
                 rblEstado.SelectedValue = "2";
             }
             else
             {
                 rblEstado.SelectedValue = _ALR_AlertasBE.Estado.ToString();
             }
             lTTB_GuardiaBE        = _TB_GuardiaBL.ListarTB_GuardiaO_Act();
             Session["Guardias"]   = lTTB_GuardiaBE;
             lTTB_AreaBE           = _TB_AreaBL.ListarTB_AreaO_Act();
             Session["Areas"]      = lTTB_AreaBE;
             lTALR_SistemaqaBE     = _ALR_SistemaqaBL.ListarALR_SistemaqaO_Act();
             Session["SistemasQA"] = lTALR_SistemaqaBE;
             LlenarComboOriginador();
             ddlOriginador.SelectedValue = _ALR_AlertasBE.Originador.ToString();
             LlenarComboDepartamento();
             ddlDepartamento.SelectedValue = _ALR_AlertasBE.Departamento_id.ToString();
             LlenarComboArea();
             ddlArea.SelectedValue = _ALR_AlertasBE.Area_id.ToString();
             LlenarComboGuardia();
             ddlGuardia.SelectedValue = _ALR_AlertasBE.Guardia_id.ToString();
             LlenarComboSistemaQA();
             LlenarComboCriticidad();
             ddlSistemaQA.SelectedValue     = _ALR_AlertasBE.SistemaQA_id.ToString();
             lblSistemaQA_nom.Text          = TraerSistemaQANombre(_ALR_AlertasBE.SistemaQA_id);
             ddlClasificacion.SelectedValue = _ALR_AlertasBE.Clasificacion.ToString();
             txtDescripcion.Text            = _ALR_AlertasBE.Alerta_desc;
             GenerarTablaPlanInmediato(_Alerta_id, txtDescripcion.Text);
             GenerarTablaPlanSistemico(_Alerta_id, txtDescripcion.Text);
         }
     }
     catch (Exception x)
     {
         // Response.Redirect("error.aspx");
     }
 }
示例#2
0
        public ALR_AlertasBE TraerALR_AlertasById(int _Alerta_id)
        {
            ALR_AlertasBE _AlertasBE = new ALR_AlertasBE();
            DataSet       dts        = new DataSet();

            try
            {
                cnx.ConnectionString = MiConexion.GetCnx();
                cmd.Connection       = cnx;
                cmd.CommandType      = CommandType.StoredProcedure;
                cmd.CommandText      = "sp_TraerALR_AlertasById";
                cmd.Parameters.Add(new SqlParameter("@Alerta_id", SqlDbType.Int));
                cmd.Parameters["@Alerta_id"].Value = _Alerta_id;
                cnx.Open();
                dtr = cmd.ExecuteReader();
                if (dtr.HasRows == true)
                {
                    dtr.Read();
                    var _with1 = _AlertasBE;
                    _with1.Alerta_id        = Convert.ToInt32(dtr.GetValue(dtr.GetOrdinal("Alerta_id")));
                    _with1.Alerta_desc      = dtr.GetValue(dtr.GetOrdinal("Alerta_desc")).ToString();
                    _with1.Clasificacion    = Convert.ToInt16(dtr.GetValue(dtr.GetOrdinal("Clasificacion")));
                    _with1.Departamento_id  = Convert.ToInt16(dtr.GetValue(dtr.GetOrdinal("Departamento_id")));
                    _with1.Area_id          = Convert.ToInt16(dtr.GetValue(dtr.GetOrdinal("Area_id")));
                    _with1.Guardia_id       = Convert.ToInt16(dtr.GetValue(dtr.GetOrdinal("guardia_id")));
                    _with1.ElementoClave_id = Convert.ToInt16(dtr.GetValue(dtr.GetOrdinal("ElementoClave_id")));
                    _with1.SistemaQA_id     = Convert.ToInt16(dtr.GetValue(dtr.GetOrdinal("SistemaQA_id")));
                    _with1.Originador       = Convert.ToInt16(dtr.GetValue(dtr.GetOrdinal("Originador")));
                    _with1.Estado           = Convert.ToInt16(dtr.GetValue(dtr.GetOrdinal("estado")));
                    _with1.Fecha_alerta     = Convert.ToDateTime(dtr.GetValue(dtr.GetOrdinal("Fecha_alerta")));
                    _with1.Fecha_registro   = Convert.ToDateTime(dtr.GetValue(dtr.GetOrdinal("Fecha_registro")));
                    _with1.Registrador      = Convert.ToInt16(dtr.GetValue(dtr.GetOrdinal("Registrador")));
                    _with1.activo           = Convert.ToBoolean(dtr.GetValue(dtr.GetOrdinal("activo")));
                }
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                if (cnx.State == ConnectionState.Open)
                {
                    cnx.Close();
                }
                cmd.Parameters.Clear();
            }
            return(_AlertasBE);
        }
示例#3
0
 public bool ActualizarALR_Alertas(ALR_AlertasBE _inseBE)
 {
     return(_ALR_AlertasADO.ActualizarALR_Alertas(_inseBE));
 }
示例#4
0
 public int InsertarALR_Alertas(ALR_AlertasBE _inseBE)
 {
     return(_ALR_AlertasADO.InsertarALR_Alertas(_inseBE));
 }
示例#5
0
        public bool ActualizarALR_Alertas(ALR_AlertasBE _AlertasBE)
        {
            cnx.ConnectionString = MiConexion.GetCnx();
            cmd.Connection       = cnx;
            cmd.CommandType      = CommandType.StoredProcedure;
            cmd.CommandText      = "sp_ActualizarALR_Alertas";
            SqlParameter par1;

            try
            {
                par1           = cmd.Parameters.Add(new SqlParameter("@Alerta_id", SqlDbType.Int));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Alerta_id"].Value = _AlertasBE.Alerta_id;
                par1           = cmd.Parameters.Add(new SqlParameter("@Alerta_desc", SqlDbType.VarChar, 800));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Alerta_desc"].Value = _AlertasBE.Alerta_desc;
                par1           = cmd.Parameters.Add(new SqlParameter("@Departamento_id", SqlDbType.Int));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Departamento_id"].Value = _AlertasBE.Departamento_id;
                par1           = cmd.Parameters.Add(new SqlParameter("@Area_id", SqlDbType.SmallInt));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Area_id"].Value = _AlertasBE.Area_id;
                par1           = cmd.Parameters.Add(new SqlParameter("@Guardia_id", SqlDbType.Int));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Guardia_id"].Value = _AlertasBE.Guardia_id;
                par1           = cmd.Parameters.Add(new SqlParameter("@SistemaQA_id", SqlDbType.SmallInt));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@SistemaQA_id"].Value = _AlertasBE.SistemaQA_id;
                par1           = cmd.Parameters.Add(new SqlParameter("@ElementoClave_id", SqlDbType.SmallInt));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@ElementoClave_id"].Value = _AlertasBE.ElementoClave_id;
                par1           = cmd.Parameters.Add(new SqlParameter("@Originador", SqlDbType.Int));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Originador"].Value = _AlertasBE.Originador;
                par1           = cmd.Parameters.Add(new SqlParameter("@Clasificacion", SqlDbType.Int));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Clasificacion"].Value = _AlertasBE.Clasificacion;
                par1           = cmd.Parameters.Add(new SqlParameter("@Estado", SqlDbType.SmallInt));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Estado"].Value = _AlertasBE.Estado;
                par1           = cmd.Parameters.Add(new SqlParameter("@Fecha_alerta", SqlDbType.DateTime));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Fecha_alerta"].Value = _AlertasBE.Fecha_alerta;
                par1           = cmd.Parameters.Add(new SqlParameter("@Registrador", SqlDbType.Int));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Registrador"].Value = _AlertasBE.Registrador;
                cnx.Open();
                cmd.ExecuteNonQuery();
                _vcod = true;
            }
            catch (SqlException x)
            {
                _vcod = false;
            }
            catch (Exception x)
            {
                _vcod = false;
            }
            finally
            {
                if (cnx.State == ConnectionState.Open)
                {
                    cnx.Close();
                }
                cmd.Parameters.Clear();
            }

            return(_vcod);
        }
示例#6
0
        public int InsertarALR_Alertas(ALR_AlertasBE _AlertasBE)
        {
            cnx.ConnectionString = MiConexion.GetCnx();
            cmd.Connection       = cnx;
            cmd.CommandType      = CommandType.StoredProcedure;
            cmd.CommandText      = "sp_InsertarALR_Alertas";
            SqlParameter par1;

            try
            {
                //SqlParameter par4 = cmd.Parameters.Add("@@identity", SqlDbType.Int);
                //par4.Direction = ParameterDirection.ReturnValue;
                par1           = cmd.Parameters.Add(new SqlParameter("@Alerta_desc", SqlDbType.VarChar, 800));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Alerta_desc"].Value = _AlertasBE.Alerta_desc;
                par1           = cmd.Parameters.Add(new SqlParameter("@Departamento_id", SqlDbType.Int));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Departamento_id"].Value = _AlertasBE.Departamento_id;
                par1           = cmd.Parameters.Add(new SqlParameter("@Area_id", SqlDbType.SmallInt));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Area_id"].Value = _AlertasBE.Area_id;
                par1           = cmd.Parameters.Add(new SqlParameter("@Guardia_id", SqlDbType.Int));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Guardia_id"].Value = _AlertasBE.Guardia_id;
                par1           = cmd.Parameters.Add(new SqlParameter("@SistemaQA_id", SqlDbType.SmallInt));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@SistemaQA_id"].Value = _AlertasBE.SistemaQA_id;
                par1           = cmd.Parameters.Add(new SqlParameter("@ElementoClave_id", SqlDbType.SmallInt));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@ElementoClave_id"].Value = _AlertasBE.ElementoClave_id;
                par1           = cmd.Parameters.Add(new SqlParameter("@Clasificacion", SqlDbType.SmallInt));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Clasificacion"].Value = _AlertasBE.Clasificacion;
                par1           = cmd.Parameters.Add(new SqlParameter("@Originador", SqlDbType.Int));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Originador"].Value = _AlertasBE.Originador;
                par1           = cmd.Parameters.Add(new SqlParameter("@Estado", SqlDbType.SmallInt));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Estado"].Value = _AlertasBE.Estado;
                par1           = cmd.Parameters.Add(new SqlParameter("@Fecha_alerta", SqlDbType.DateTime));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Fecha_alerta"].Value = _AlertasBE.Fecha_alerta;
                par1           = cmd.Parameters.Add(new SqlParameter("@Registrador", SqlDbType.Int));
                par1.Direction = ParameterDirection.Input;
                cmd.Parameters["@Registrador"].Value = _AlertasBE.Registrador;
                cnx.Open();
                dtr = cmd.ExecuteReader();
                dtr.Read();
                _id_Alerta = Convert.ToInt32(dtr.GetValue(dtr.GetOrdinal("Alerta_ID")));
            }
            catch (SqlException x)
            {
                _id_Alerta = 0;
            }
            catch (Exception x)
            {
                _id_Alerta = 0;
            }
            finally
            {
                if (cnx.State == ConnectionState.Open)
                {
                    cnx.Close();
                }
                cmd.Parameters.Clear();
            }
            return(_id_Alerta);
        }