private void RegistrarPlan(DateTime _Fecha, int _Registro_id, string _PlanAccion_desc, int _Responsable_id)
        {
            TB_PlanAccionBL _TB_PlanAccionBL = new TB_PlanAccionBL();
            TB_PlanAccionBE _TB_PlanAccionBE = new TB_PlanAccionBE();

            string _Asignado = ((Fnc_FuncionariosBE)Session["Fnc_Funcionarios"]).Funcionario_Nome.ToString();

            _TB_PlanAccionBE.Fecha           = DateTime.ParseExact(txtFecha.Text, "dd/MM/yyyy", null);
            _TB_PlanAccionBE.Registro_id     = _Registro_id;
            _TB_PlanAccionBE.PlanAccion_desc = _PlanAccion_desc;
            _TB_PlanAccionBE.Responsable     = _Responsable_id;
            _TB_PlanAccionBE.tipoPlan        = 1;
            _TB_PlanAccionBE.Estado          = false;
            _TB_PlanAccionBE.Sistema_id      = 5;

            if (_TB_PlanAccionBL.InsertarTB_PlanAccion(_TB_PlanAccionBE))
            {
                enviarEmail(_TB_PlanAccionBE.Registro_id, _PlanAccion_desc, 1, _TB_PlanAccionBE.Fecha.ToString(), _TB_PlanAccionBE.PlanAccion_desc, _Asignado);
                ClientScript.RegisterStartupScript(this.GetType(), "myScript", "ActualizoExito();cerrarYActualizar();", true);
            }
            else
            {
                Response.Write("<script language=javascript>alert('ERROR');</script>");
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         _PlanAccion_id = Convert.ToInt32(Request.QueryString["PlanAccion_id"]);
         _Registro_id   = Convert.ToInt32(Request.QueryString["Registro_id"]);
         _Sistema_id    = Convert.ToInt16(Request.QueryString["Sistema_id"]);
         if (!this.IsPostBack)
         {
             _Fnc_FuncionariosBE = ((Fnc_FuncionariosBE)Session["Fnc_Funcionarios"]);
             TB_AccesosBE _TB_AccesosBE = _TB_AccesosBL.TraerTB_Accesos(_Fnc_FuncionariosBE.Funcionario_Id, _Sistema_id);
             DateTime     Hoy           = DateTime.Today;
             if (_TB_AccesosBE.Permiso == 1)
             {
                 txtFecha.Enabled    = true;
                 btnEliminar.Visible = true;
             }
             _TB_PlanAccionBE = _TB_PlanAccionBL.TraerTB_PlanAccionById(_PlanAccion_id);
             LlenarComboResponsable(_TB_PlanAccionBE.Responsable);
             txtFecha.Text       = _TB_PlanAccionBE.Fecha.ToString("dd/MM/yyyy");
             txtPlan.Text        = _TB_PlanAccionBE.PlanAccion_desc;
             chbCumplido.Checked = _TB_PlanAccionBE.Estado;
             _Registro_id        = _TB_PlanAccionBE.Registro_id;
         }
     }
     catch (Exception x)
     {
         // Response.Redirect("error.aspx");
     }
 }
Exemple #3
0
        public List <TB_PlanAccionBE> ListarTB_PlanAccionO_Act()
        {
            string conexion = MiConexion.GetCnx();
            List <TB_PlanAccionBE> lTB_PlanAccionBE = null;
            SqlConnection          con = new SqlConnection(conexion);

            con.Open();
            SqlCommand cmd = new SqlCommand("sp_ListarTB_PlanAccion_Act", con);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader drd = cmd.ExecuteReader(CommandBehavior.SingleResult);

            if (drd != null)
            {
                lTB_PlanAccionBE = new List <TB_PlanAccionBE>();
                int             posPlanAccion_id   = drd.GetOrdinal("PlanAccion_id");
                int             posPlanAccion_desc = drd.GetOrdinal("PlanAccion_desc");
                int             posEstado          = drd.GetOrdinal("Estado");
                TB_PlanAccionBE obePlanAccionBE    = null;
                while (drd.Read())
                {
                    obePlanAccionBE = new TB_PlanAccionBE();
                    obePlanAccionBE.PlanAccion_id   = drd.GetInt32(posPlanAccion_id);
                    obePlanAccionBE.PlanAccion_desc = drd.GetString(posPlanAccion_desc);
                    obePlanAccionBE.Estado          = drd.GetBoolean(posEstado);
                    lTB_PlanAccionBE.Add(obePlanAccionBE);
                }
                drd.Close();
            }
            con.Close();
            return(lTB_PlanAccionBE);
        }
Exemple #4
0
        private void CrearPlanInmediato(int _Registro_id)
        {
            TB_PlanAccionBE _TB_PlanAccionBE = new TB_PlanAccionBE();
            TB_PlanAccionBL _TB_PlanAccionBL = new TB_PlanAccionBL();
            int             _Responsable     = ((Fnc_FuncionariosBE)Session["Fnc_Funcionarios"]).Funcionario_Id;
            string          _Titulo          = "Realizar análisis de condiciones básicas";

            _TB_PlanAccionBE.Fecha           = DateTime.Today.AddDays(7);
            _TB_PlanAccionBE.Registro_id     = _Registro_id;
            _TB_PlanAccionBE.PlanAccion_desc = "Realizar análisis de condiciones básicas de esta Alerta Crítica";
            _TB_PlanAccionBE.Responsable     = _Responsable;
            _TB_PlanAccionBE.tipoPlan        = 1;
            _TB_PlanAccionBE.Estado          = false;
            _TB_PlanAccionBE.Sistema_id      = 2;

            if (_TB_PlanAccionBL.InsertarTB_PlanAccion(_TB_PlanAccionBE))
            {
                enviarEmail(_TB_PlanAccionBE.Registro_id, _Titulo, _TB_PlanAccionBE.tipoPlan, txtFecha.Text, "Realizar análisis de condiciones básicas de esta Alerta Crítica", ((Fnc_FuncionariosBE)Session["Fnc_Funcionarios"]).Funcionario_Nome);
                ClientScript.RegisterStartupScript(this.GetType(), "myScript", "ActualizoExito();cerrarYActualizar();", true);
            }
            else
            {
                Response.Write("<script language=javascript>alert('ERROR');</script>");
            }
        }
Exemple #5
0
        public List <TB_PlanAccionBE> BuscarTB_PlanAccionByIncidente(int _Id_Incidente, Int16 _tipoPlan)
        {
            string conexion = MiConexion.GetCnx();
            List <TB_PlanAccionBE> lTB_PlanAccionBE = null;
            SqlConnection          con = new SqlConnection(conexion);

            con.Open();
            try
            {
                SqlCommand cmd = new SqlCommand("sp_BuscarTB_PlanAccionByIncidente", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Registro_id", SqlDbType.Int));
                cmd.Parameters["@Registro_id"].Value = _Id_Incidente;
                cmd.Parameters.Add(new SqlParameter("@tipoPlan", SqlDbType.Int));
                cmd.Parameters["@tipoPlan"].Value = _tipoPlan;
                SqlDataReader drd = cmd.ExecuteReader();
                if (drd != null)
                {
                    lTB_PlanAccionBE = new List <TB_PlanAccionBE>();
                    int             posPlanAccion_id   = drd.GetOrdinal("PlanAccion_id");
                    int             posPlanAccion_desc = drd.GetOrdinal("PlanAccion_desc");
                    int             posResponsable     = drd.GetOrdinal("Responsable");
                    int             postipoPlan        = drd.GetOrdinal("tipoPlan");
                    int             posEstado          = drd.GetOrdinal("Estado");
                    int             posFecha           = drd.GetOrdinal("Fecha");
                    int             posRegistro_id     = drd.GetOrdinal("Registro_id");
                    TB_PlanAccionBE obePlanAccionBE    = null;
                    while (drd.Read())
                    {
                        obePlanAccionBE = new TB_PlanAccionBE();
                        obePlanAccionBE.PlanAccion_id   = drd.GetInt32(posPlanAccion_id);
                        obePlanAccionBE.PlanAccion_desc = drd.GetString(posPlanAccion_desc);
                        obePlanAccionBE.Responsable     = drd.GetInt32(posResponsable);
                        obePlanAccionBE.tipoPlan        = drd.GetInt16(postipoPlan);
                        obePlanAccionBE.Estado          = drd.GetBoolean(posEstado);
                        obePlanAccionBE.Fecha           = drd.GetDateTime(posFecha);
                        obePlanAccionBE.Registro_id     = drd.GetInt32(posRegistro_id);
                        lTB_PlanAccionBE.Add(obePlanAccionBE);
                    }
                    drd.Close();
                }
            }
            catch (SqlException x)
            {
            }
            catch (Exception x)
            {
            }
            finally
            {
                if (cnx.State == ConnectionState.Open)
                {
                    cnx.Close();
                }
                cmd.Parameters.Clear();
            }
            return(lTB_PlanAccionBE);
        }
Exemple #6
0
        public List <TB_PlanAccionBE> TraerTB_PlanAccionByIdO(Int16 _PlanAccion_id)
        {
            string conexion = MiConexion.GetCnx();
            List <TB_PlanAccionBE> lTB_PlanAccionBE = null;
            SqlConnection          con = new SqlConnection(conexion);

            con.Open();
            SqlCommand cmd = new SqlCommand("sp_TraerTB_PlanAccionById", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@PlanAccion_id", SqlDbType.SmallInt));
            cmd.Parameters["@PlanAccion_id"].Value = _PlanAccion_id;
            SqlDataReader drd = cmd.ExecuteReader();

            if (drd != null)
            {
                lTB_PlanAccionBE = new List <TB_PlanAccionBE>();
                int             posPlanAccion_id   = drd.GetOrdinal("PlanAccion_id");
                int             posPlanAccion_desc = drd.GetOrdinal("PlanAccion_desc");
                int             posResponsable     = drd.GetOrdinal("Responsable");
                int             postipoPlan        = drd.GetOrdinal("tipoPlan");
                int             posEstado          = drd.GetOrdinal("Estado");
                int             posFecha           = drd.GetOrdinal("Fecha");
                int             posRegistro_id     = drd.GetOrdinal("Registro_id");
                TB_PlanAccionBE obePlanAccionBE    = null;
                while (drd.Read())
                {
                    obePlanAccionBE = new TB_PlanAccionBE();
                    obePlanAccionBE.PlanAccion_id   = drd.GetInt16(posPlanAccion_id);
                    obePlanAccionBE.PlanAccion_desc = drd.GetString(posPlanAccion_desc);
                    obePlanAccionBE.Responsable     = drd.GetInt32(posResponsable);
                    obePlanAccionBE.tipoPlan        = drd.GetInt16(postipoPlan);
                    obePlanAccionBE.Estado          = drd.GetBoolean(posEstado);
                    obePlanAccionBE.Fecha           = drd.GetDateTime(posFecha);
                    obePlanAccionBE.Registro_id     = drd.GetInt16(posRegistro_id);
                    lTB_PlanAccionBE.Add(obePlanAccionBE);
                }
                drd.Close();
            }

            return(lTB_PlanAccionBE);
        }
Exemple #7
0
        public bool InsertarTB_PlanAccion(TB_PlanAccionBE _TB_PlanAccionBE)
        {
            cnx.ConnectionString = MiConexion.GetCnx();
            cmd.Connection       = cnx;
            cmd.CommandType      = CommandType.StoredProcedure;
            cmd.CommandText      = "sp_InsertarTB_PlanAccion";
            SqlParameter par1;

            try
            {
                cmd.Parameters.Add(new SqlParameter("@PlanAccion_desc", SqlDbType.VarChar, 150));
                cmd.Parameters["@PlanAccion_desc"].Value = _TB_PlanAccionBE.PlanAccion_desc;
                cmd.Parameters.Add(new SqlParameter("@Registro_id", SqlDbType.SmallInt));
                cmd.Parameters["@Registro_id"].Value = _TB_PlanAccionBE.Registro_id;
                cmd.Parameters.Add(new SqlParameter("@responsable", SqlDbType.SmallInt));
                cmd.Parameters["@responsable"].Value = _TB_PlanAccionBE.Responsable;
                cmd.Parameters.Add(new SqlParameter("@tipoPlan", SqlDbType.SmallInt));
                cmd.Parameters["@tipoPlan"].Value = _TB_PlanAccionBE.tipoPlan;
                cmd.Parameters.Add(new SqlParameter("@Estado", SqlDbType.Int));
                cmd.Parameters["@Estado"].Value = _TB_PlanAccionBE.Estado;
                cmd.Parameters.Add(new SqlParameter("@Sistema_id", SqlDbType.Int));
                cmd.Parameters["@Sistema_id"].Value = _TB_PlanAccionBE.Sistema_id;
                cmd.Parameters.Add(new SqlParameter("@fecha", SqlDbType.DateTime));
                cmd.Parameters["@fecha"].Value = _TB_PlanAccionBE.Fecha;
                cnx.Open();
                cmd.ExecuteNonQuery();
                vexito = true;
            }
            catch (SqlException x)
            {
                vexito = false;
            }
            finally
            {
                if (cnx.State == ConnectionState.Open)
                {
                    cnx.Close();
                }
                cmd.Parameters.Clear();
            }
            return(vexito);
        }
Exemple #8
0
        public TB_PlanAccionBE TraerTB_PlanAccionById(int _PlanAccion_id)
        {
            TB_PlanAccionBE _Etq_PlanosBE = new TB_PlanAccionBE();

            try
            {
                cnx.ConnectionString = MiConexion.GetCnx();
                cmd.Connection       = cnx;
                cmd.CommandType      = CommandType.StoredProcedure;
                cmd.CommandText      = "sp_TraerTB_PlanAccionById";
                //Agregamos el parametro para el SP
                cmd.Parameters.Add(new SqlParameter("@PlanAccion_id", SqlDbType.Int));
                cmd.Parameters["@PlanAccion_id"].Value = _PlanAccion_id;
                cnx.Open();
                dtr = cmd.ExecuteReader();
                if (dtr.HasRows == true)
                {
                    dtr.Read();
                    var _with1 = _Etq_PlanosBE;
                    _with1.PlanAccion_id   = Convert.ToInt16(dtr.GetValue(dtr.GetOrdinal("PlanAccion_id")));
                    _with1.PlanAccion_desc = dtr.GetValue(dtr.GetOrdinal("PlanAccion_desc")).ToString();
                    _with1.Responsable     = Convert.ToInt32(dtr.GetValue(dtr.GetOrdinal("Responsable")));
                    _with1.Estado          = Convert.ToBoolean(dtr.GetValue(dtr.GetOrdinal("Estado")));
                    _with1.Fecha           = Convert.ToDateTime(dtr.GetValue(dtr.GetOrdinal("Fecha")));
                    _with1.Registro_id     = Convert.ToInt32(dtr.GetValue(dtr.GetOrdinal("Registro_id")));
                }
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                if (cnx.State == ConnectionState.Open)
                {
                    cnx.Close();
                }
                cmd.Parameters.Clear();
            }
            return(_Etq_PlanosBE);
        }
Exemple #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         _PlanAccion_id = Convert.ToInt32(Request.QueryString["PlanAccion_id"]);
         _Incidente_id  = Convert.ToInt32(Request.QueryString["Incidente_id"]);
         if (this.IsPostBack)
         {
         }
         else
         {
             _TB_PlanAccionBE = _TB_PlanAccionBL.TraerTB_PlanAccionById(_PlanAccion_id);
             LlenarComboResponsable(_TB_PlanAccionBE.Responsable);
             txtFecha.Text       = _TB_PlanAccionBE.Fecha.ToString("dd/MM/yyyy");
             txtPlan.Text        = _TB_PlanAccionBE.PlanAccion_desc;
             chbCumplido.Checked = _TB_PlanAccionBE.Estado;
             _Incidente_id       = _TB_PlanAccionBE.Registro_id;
         }
     }
     catch (Exception x)
     {
         // Response.Redirect("error.aspx");
     }
 }
Exemple #10
0
 public bool ActualizarTB_PlanAccion(TB_PlanAccionBE _TB_PlanAccionBE)
 {
     return(_TB_PlanAccionADO.ActualizarTB_PlanAccion(_TB_PlanAccionBE));
 }
Exemple #11
0
 public bool InsertarTB_PlanAccion(TB_PlanAccionBE _TB_PlanAccionBE)
 {
     return(_TB_PlanAccionADO.InsertarTB_PlanAccion(_TB_PlanAccionBE));
 }