示例#1
0
        public DataTable MostrarLibre(DMesa Mesa)
        {
            DataTable     dtResultado = new DataTable("Mesa");
            SqlConnection sqlCon      = new SqlConnection();

            try
            {
                sqlCon.ConnectionString = Conexion.cn;
                SqlCommand sqlCmd = new SqlCommand();
                sqlCmd.Connection  = sqlCon;
                sqlCmd.CommandText = "sp_mostrarMesaLibre";
                sqlCmd.CommandType = CommandType.StoredProcedure;

                SqlParameter ParIdSalon = new SqlParameter();
                ParIdSalon.ParameterName = "@idSalon";
                ParIdSalon.SqlDbType     = SqlDbType.Int;
                ParIdSalon.Value         = Mesa.IdSalon;
                sqlCmd.Parameters.Add(ParIdSalon);

                SqlDataAdapter sqlDat = new SqlDataAdapter(sqlCmd);
                sqlDat.Fill(dtResultado);
            }
            catch (Exception ex)
            {
                dtResultado = null;
            }

            return(dtResultado);
        }
示例#2
0
        public string EditarEstadoMesa(DMesa Mesa)
        {
            string        rpta   = "";
            SqlConnection sqlCon = new SqlConnection();

            try
            {
                sqlCon.ConnectionString = Conexion.cn;
                sqlCon.Open();
                //Comandos
                SqlCommand sqlCmd = new SqlCommand();
                sqlCmd.Connection  = sqlCon;
                sqlCmd.CommandText = "sp_editarEstadoMesa";
                sqlCmd.CommandType = CommandType.StoredProcedure;

                SqlParameter ParIdMesa = new SqlParameter();
                ParIdMesa.ParameterName = "@idMesa";
                ParIdMesa.SqlDbType     = SqlDbType.Int;
                ParIdMesa.Value         = Mesa.IdMesa;
                sqlCmd.Parameters.Add(ParIdMesa);

                SqlParameter ParEstadoTipo = new SqlParameter();
                ParEstadoTipo.ParameterName = "@estado";
                ParEstadoTipo.SqlDbType     = SqlDbType.VarChar;
                ParEstadoTipo.Size          = 20;
                ParEstadoTipo.Value         = Mesa.EstadoTipo;
                sqlCmd.Parameters.Add(ParEstadoTipo);

                rpta = sqlCmd.ExecuteNonQuery() == 1 ? "OK" : "No se editó el Registro";
            }
            catch (Exception ex)
            {
                rpta = ex.Message;
            }
            finally
            {
                if (sqlCon.State == ConnectionState.Open)
                {
                    sqlCon.Close();
                }
            }
            return(rpta);
        }