Example #1
0
        //ArrayList lista = new ArrayList();
        //public void CargarEstado()
        //{
        //    lista.Add("HABILITADO");
        //    lista.Add("DESHABILITADO");
        //    this.ddlEstado.DataSource = lista;
        //    DataBind();
        //}



        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                lbl_mensaje.Text = "";
                if (validarDatos())
                {
                    DtoServicio prof    = new DtoServicio();
                    CtrServicio ctrprof = new CtrServicio();

                    prof.codServicio = int.Parse(Request.Params["c"]);
                    prof.nombre      = txtNombre.Text.Trim();
                    prof.descripcion = txtDescripcion.Text.Trim();
                    if (ddlEstado.SelectedValue.ToString() == "1")
                    {
                        prof.estado = 1;
                    }
                    else
                    {
                        prof.estado = 0;
                    }

                    ctrprof.modificarServicio(prof);

                    lbl_mensaje.Text = "Se modificó exitósamente el servicio: " + prof.nombre;
                }
            }
            catch { lbl_mensaje.Text = "Error al intentar modificar el servicio"; }
        }
Example #2
0
        public bool getServicio(DtoServicio serv)
        {
            SqlCommand cmd = new SqlCommand("sp_getServicio", conexion);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@codServicio", serv.codServicio);

            conexion.Open();
            bool hayRegistros;

            SqlDataReader reader = cmd.ExecuteReader();

            hayRegistros = reader.Read();

            if (hayRegistros)
            {
                serv.nombre      = reader[1].ToString();
                serv.descripcion = reader[2].ToString();
                //serv.estado = int.Parse(reader[3].ToString());
            }

            conexion.Close();
            return(hayRegistros);
        }
Example #3
0
        public void disableServicio(DtoServicio serv)
        {
            SqlCommand cmd = new SqlCommand("sp_disableServicio", conexion);

            cmd.CommandType = CommandType.StoredProcedure;

            conexion.Open();
            cmd.ExecuteNonQuery();
            conexion.Close();
        }
Example #4
0
        public void cargarDatos()
        {
            CtrServicio ctrser = new CtrServicio();
            DtoServicio serv   = new DtoServicio();

            serv.codServicio = int.Parse(Session["c"].ToString());

            ctrser.consultarServicio(serv);

            txtNombre.Text      = serv.nombre;
            txtDescripcion.Text = serv.descripcion;
        }
Example #5
0
        public void InsertServicio(DtoServicio serv)
        {
            SqlCommand cmd = new SqlCommand("sp_insertServicio", conexion);

            cmd.CommandType = CommandType.StoredProcedure;


            cmd.Parameters.AddWithValue("@nombre", serv.nombre);
            cmd.Parameters.AddWithValue("@descripcion", serv.descripcion);



            conexion.Open();
            cmd.ExecuteNonQuery();
            conexion.Close();
        }
Example #6
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                lbl_mensaje.Text = "";
                if (validarDatos())
                {
                    DtoServicio ser = new DtoServicio();

                    ser.nombre      = txtNombre.Text.Trim();
                    ser.descripcion = txtDescripcion.Text.Trim();
                    //ser.estado =1;


                    CtrServicio ctrser = new CtrServicio();
                    ctrser.registrarServicio(ser);

                    lbl_mensaje.Text = "Se registró exitósamente el servicio : " + ser.nombre;
                    limpiar();
                }
            }
            catch { lbl_mensaje.Text = "Error al intentar registrar el servicio"; }
        }
Example #7
0
 public bool consultarServicio(DtoServicio serv)
 {
     return(daoservi.getServicio(serv));
 }
Example #8
0
 public void inhabilitarServicio(DtoServicio serv)
 {
     daoservi.disableServicio(serv);
 }
Example #9
0
 public void modificarServicio(DtoServicio serv)
 {
     daoservi.updateServicio(serv);
 }
Example #10
0
 public void registrarServicio(DtoServicio serv)
 {
     daoservi.InsertServicio(serv);
 }