Esempio n. 1
0
        public String GuardarCambios()
        {
            DTipoPlanilla tipoPlanilla = new DTipoPlanilla();

            tipoPlanilla.Idtipoplanilla = IdTipoPlanilla;
            tipoPlanilla.TipoPlanilla   = Tipo_Planilla;

            switch (state)
            {
            case EntityState.Guardar:
                Rtipoplanilla.Add(tipoPlanilla);
                mensaje = tipoPlanilla.mensaje;
                break;

            case EntityState.Modificar:
                Rtipoplanilla.Edit(tipoPlanilla);
                mensaje = "¡Modificado!";
                break;

            case EntityState.Remover:
                Rtipoplanilla.Delete(tipoPlanilla);
                mensaje = tipoPlanilla.mensaje;
                break;
            }
            return(mensaje);
        }
Esempio n. 2
0
        public int Delete(DTipoPlanilla entiti)
        {
            result = 0;
            using (SqlConnection conn = RConexion.Getconectar())
            {
                conn.Open();
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandText = "SP_DELETE_TIP_PLANILLA";
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@idtipo_planilla", entiti.Idtipoplanilla);
                    cmd.Parameters.Add("@mensaje", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
                    result         = cmd.ExecuteNonQuery();
                    entiti.mensaje = cmd.Parameters["@mensaje"].Value.ToString();
                    cmd.Parameters.Clear();
                }
            }
            return(result);
        }
Esempio n. 3
0
        public int Edit(DTipoPlanilla entiti)
        {
            result = 0;
            using (SqlConnection connect = RConexion.Getconectar())
            {
                connect.Open();
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = connect;
                    cmd.CommandText = "SP_UPDATE_TIPOPLANILLA";
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@nombre_planilla", entiti.TipoPlanilla);
                    cmd.Parameters.AddWithValue("@id_tipPlanilla", entiti.Idtipoplanilla);

                    result = cmd.ExecuteNonQuery();
                    cmd.Parameters.Clear();
                }
            }
            return(result);
        }
Esempio n. 4
0
        public int Add(DTipoPlanilla entiti)
        {
            result = 0;
            using (SqlConnection connect = RConexion.Getconectar())
            {
                connect.Open();
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = connect;
                    cmd.CommandText = "SP_REGISTRAR_TipPLANILLA";
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@nombre_planilla", entiti.TipoPlanilla);

                    cmd.Parameters.Add("@mensaje", SqlDbType.VarChar, 30).Direction = ParameterDirection.Output;
                    result         = cmd.ExecuteNonQuery();
                    entiti.mensaje = cmd.Parameters["@mensaje"].Value.ToString();
                    cmd.Parameters.Clear();
                }
            }
            return(result);
        }
Esempio n. 5
0
        public DataTable GetData(DTipoPlanilla entiti)
        {
            DataTable dt;

            using (SqlConnection cnn = RConexion.Getconectar())
            {
                cnn.Open();
                SqlDataAdapter da = new SqlDataAdapter();
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection   = cnn;
                    cmd.CommandText  = "SP_SHOW_TIPO_PLAN";
                    cmd.CommandType  = CommandType.StoredProcedure;
                    da.SelectCommand = cmd;

                    using (dt = new DataTable())
                    {
                        da.Fill(dt);
                        da.Dispose();
                    }
                }
            }
            return(dt);
        }