Exemplo n.º 1
0
 /// <summary>
 /// CONSULTA UNA TAREA
 /// </summary>
 /// <param name="obclsTareas">MODELO DE TAREAS</param>
 /// <returns></returns>
 public List <Logica.Models.clsTareas> getTareasController(Logica.Models.clsTareas obclsTareasModel)
 {
     try
     {
         Logica.BL.clsTareas obclsTareas = new Logica.BL.clsTareas();
         return(obclsTareas.getTareas(obclsTareasModel));
     }
     catch (Exception ex) { throw ex; }
 }
Exemplo n.º 2
0
 /// <summary>
 /// ELIMINA UNA TAREA
 /// </summary>
 /// <param name="obclsTareas">MODELO DE TAREAS</param>
 /// <returns></returns>
 public string deleteTareasController(Logica.Models.clsTareas obclsTareasModel)
 {
     try
     {
         Logica.BL.clsTareas obclsTareas = new Logica.BL.clsTareas();
         return(obclsTareas.deleteTareas(obclsTareasModel));
     }
     catch (Exception ex) { throw ex; }
 }
Exemplo n.º 3
0
 /// <summary>
 /// MODIFICA UNA TAREA
 /// </summary>
 /// <param name="obclsTareas">MODELO DE TAREA</param>
 /// <returns></returns>
 public string updateTareasController(Logica.Models.clsTareas obclsTareas)
 {
     try
     {
         Logica.BL.clsTareas obclsTarea = new Logica.BL.clsTareas();
         return(obclsTarea.updateTareas(obclsTareas));
     }
     catch (Exception ex) { throw ex; }
 }
Exemplo n.º 4
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string stMensaje = string.Empty;
                if (string.IsNullOrEmpty(txtCodigo.Text))
                {
                    stMensaje += "Ingrese codigo";
                }

                if (!stMensaje.Equals(string.Empty))
                {
                    throw new Exception(stMensaje.TrimEnd(','));
                }

                Logica.Models.clsTareas obclsTareas = new Logica.Models.clsTareas
                {
                    inCodigo           = Convert.ToInt32(txtCodigo.Text),
                    stTitular          = txtTitularTarea.Text,
                    stAsunto           = txtAsunto.Text,
                    stFechaVencimiento = txtFechaVencimiento.Text,
                    stContacto         = txtContacto.Text,
                    stCuenta           = txtCuenta.Text,
                    obclsEstadoTareas  = new Logica.Models.clsEstadoTareas
                    {
                        inCodigo = Convert.ToInt32(ddlEstadoTarea.SelectedValue)
                    },
                    obclsPrioridad = new Logica.Models.clsPrioridad
                    {
                        inCodigo = Convert.ToInt32(ddlPrioridad.SelectedValue)
                    },
                    stEnviarMensaje = chkEnviarMensaje.Checked ? "S" : "N",
                    stRepetir       = chkRepetir.Checked ? "S" : "N",
                    stDescripcion   = txtDescripcion.Text
                };

                Controllers.TareasController obTareasController = new Controllers.TareasController();

                if (string.IsNullOrEmpty(lblOpcion.Text))//adicionar
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script> swal('Mensaje','" + obTareasController.addTareasController(obclsTareas) + "','success') </script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script> swal('Mensaje','" + obTareasController.updateTareasController(obclsTareas) + "','success') </script>");
                }

                lblOpcion.Text           = txtCodigo.Text = txtTitularTarea.Text = txtAsunto.Text = txtFechaVencimiento.Text = txtContacto.Text = txtCuenta.Text = txtDescripcion.Text = string.Empty;
                chkEnviarMensaje.Checked = chkRepetir.Checked = false;

                getTareas();
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script> swal('Error','" + ex.Message + "','error') </script>");
            }
        }
Exemplo n.º 5
0
        protected void gvwDatos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                int inIndice = Convert.ToInt32(e.CommandArgument);

                if (e.CommandName.Equals("Editar"))
                {
                    lblOpcion.Text    = "2";
                    txtCodigo.Enabled = false;

                    //ACCEDE A UN CONTROL WEB DENTRO DE UN GRID
                    txtCodigo.Text = ((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text;

                    //ACCEDE A UNA CELDE DENTRO DE UN GRID
                    txtTitularTarea.Text         = gvwDatos.Rows[inIndice].Cells[1].Text.Replace("&nbsp;", "");
                    txtAsunto.Text               = gvwDatos.Rows[inIndice].Cells[2].Text.Replace("&nbsp;", "");
                    txtFechaVencimiento.Text     = gvwDatos.Rows[inIndice].Cells[3].Text.Replace("&nbsp;", "");
                    txtContacto.Text             = gvwDatos.Rows[inIndice].Cells[4].Text.Replace("&nbsp;", "");
                    txtCuenta.Text               = gvwDatos.Rows[inIndice].Cells[5].Text.Replace("&nbsp;", "");
                    ddlEstadoTarea.SelectedValue = ((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigoEstadoTarea")).Text;
                    ddlPrioridad.SelectedValue   = ((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigoPrioridad")).Text;
                    chkEnviarMensaje.Checked     = gvwDatos.Rows[inIndice].Cells[8].Text.Equals("S") ? true : false;
                    chkRepetir.Checked           = gvwDatos.Rows[inIndice].Cells[9].Text.Equals("S") ? true : false;
                    txtDescripcion.Text          = gvwDatos.Rows[inIndice].Cells[10].Text.Replace("&nbsp;", "");
                }
                else if (e.CommandName.Equals("Eliminar"))
                {
                    Logica.Models.clsTareas obclsTareas = new Logica.Models.clsTareas
                    {
                        inCodigo = Convert.ToInt32(((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text)
                    };

                    Controllers.TareasControllers obTareasControllers = new Controllers.TareasControllers();
                    ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Mensaje!', '" + obTareasControllers.deleteTareasController(obclsTareas) + "', 'success')</script>");

                    LimpiarCampos();
                    getTareas();
                    txtCodigo.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                Logica.BL.clsGeneral obclsGeneral = new Logica.BL.clsGeneral();
                string stError = obclsGeneral.Log(ex.Message.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "mensaje", "<script>swal('Error!', '" + stError + "', 'error')</script>");
            }
        }
Exemplo n.º 6
0
        protected void gvwDatos_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            try
            {
                int inIndice = Convert.ToInt32(e.CommandArgument);

                if (e.CommandName.Equals("Modificar"))
                {
                    lblOpcion.Text = "M";

                    txtCodigo.Text               = ((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text;
                    txtTitularTarea.Text         = gvwDatos.Rows[inIndice].Cells[1].Text;
                    txtAsunto.Text               = gvwDatos.Rows[inIndice].Cells[2].Text;
                    txtFechaVencimiento.Text     = gvwDatos.Rows[inIndice].Cells[3].Text;
                    txtContacto.Text             = gvwDatos.Rows[inIndice].Cells[4].Text;
                    txtCuenta.Text               = gvwDatos.Rows[inIndice].Cells[5].Text;
                    ddlEstadoTarea.SelectedValue = ((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigoEstadoTarea")).Text;
                    ddlPrioridad.SelectedValue   = ((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigoPrioridad")).Text;
                    chkEnviarMensaje.Checked     = gvwDatos.Rows[inIndice].Cells[8].Text.Equals("S") ? true : false;
                    chkRepetir.Checked           = gvwDatos.Rows[inIndice].Cells[9].Text.Equals("S") ? true : false;
                    txtDescripcion.Text          = gvwDatos.Rows[inIndice].Cells[10].Text;
                }
                else if (e.CommandName.Equals("Eliminar"))
                {
                    Logica.Models.clsTareas obclsTareas = new Logica.Models.clsTareas
                    {
                        inCodigo = Convert.ToInt32(((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text)
                    };

                    Controllers.TareasController obTareasController = new Controllers.TareasController();
                    ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script> swal('Mensaje','" + obTareasController.deleteTareasController(obclsTareas) + "','success') </script>");
                    getTareas();
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script> swal('Error','" + ex.Message + "','error') </script>");
            }
        }