예제 #1
0
 public static void DeleteStall(SqlConnection SQLconn, int StallID)
 {
     using (SqlCommand command = new SqlCommand("dbo.DeleteStall", SQLconn))
     {
         command.CommandType = CommandType.StoredProcedure;
         command.Parameters.Add("@IDStall", SqlDbType.Int).Value = StallID;
         SQLconn.Open();
         command.ExecuteNonQuery();
     }
     SQLServerConnection.CloseSQLConnection(SQLconn);
 }
예제 #2
0
 public static void AddType(SqlConnection SQLconn, string FoodType, string TypeDescription)
 {
     using (SqlCommand command = new SqlCommand("dbo.AddNewFoodType", SQLconn))
     {
         command.CommandType = CommandType.StoredProcedure;
         command.Parameters.Add("@TypeFood", SqlDbType.VarChar, 100).Value = FoodType;
         command.Parameters.Add("@DescType", SqlDbType.VarChar, 200).Value = TypeDescription;
         SQLconn.Open();
         command.ExecuteNonQuery();
     }
     SQLServerConnection.CloseSQLConnection(SQLconn);
 }
예제 #3
0
 public static void UpdateStall(SqlConnection SQLconn, int StallID, string StallTypeName, string StallDescription)
 {
     using (SqlCommand command = new SqlCommand("dbo.UpdateStall", SQLconn))
     {
         command.CommandType = CommandType.StoredProcedure;
         command.Parameters.Add("@IDStall", SqlDbType.Int).Value            = StallID;
         command.Parameters.Add("@NameStall", SqlDbType.VarChar, 100).Value = StallTypeName;
         command.Parameters.Add("@DescStall", SqlDbType.VarChar, 200).Value = StallDescription;
         SQLconn.Open();
         command.ExecuteNonQuery();
     }
     SQLServerConnection.CloseSQLConnection(SQLconn);
 }
예제 #4
0
        private void buttonView_Click(object sender, EventArgs e)
        {
            SqlConnection SQLconn = SQLServerConnection.SQLConnection();

            using (SqlDataAdapter dataAdapter = new SqlDataAdapter("dbo.ViewMenu", SQLconn))
            {
                var command = new SqlCommandBuilder(dataAdapter);
                var ds      = new DataSet();
                dataAdapter.Fill(ds);
                dataGridView.DataSource = ds.Tables[0];
            }
            SQLServerConnection.CloseSQLConnection(SQLconn);
        }
예제 #5
0
        private void buttonSearchStall_Click(object sender, System.EventArgs e)
        {
            string        Stall   = "%" + textBoxStallName.Text + "%";
            SqlConnection SQLconn = SQLServerConnection.SQLConnection();

            using (SqlCommand command = new SqlCommand("dbo.SearchStall", SQLconn))
            {
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add("@NameStall", SqlDbType.VarChar, 100).Value = Stall;
                var            ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter();
                SQLconn.Open();
                da.SelectCommand = command;
                da.Fill(ds);
                MMF.dataGridView.DataSource = ds.Tables[0];
            }
            SQLServerConnection.CloseSQLConnection(SQLconn);
        }
예제 #6
0
        public static List <StallList> GetStallList(SqlConnection SQLconn)
        {
            List <StallList> SL = new List <StallList>();

            using (SqlCommand command = new SqlCommand("dbo.GetStallList", SQLconn))
            {
                command.CommandType = CommandType.StoredProcedure;
                SQLconn.Open();
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        StallList tempSL = new StallList();
                        tempSL.StallID          = reader.GetInt32(0);
                        tempSL.StallName        = reader.GetString(1);
                        tempSL.StallDescription = reader.GetString(2);
                        SL.Add(tempSL);
                    }
                }
            }
            SQLServerConnection.CloseSQLConnection(SQLconn);
            return(SL);
        }
예제 #7
0
        public static List <TypeList> GetTypeList(SqlConnection SQLconn)
        {
            List <TypeList> TL = new List <TypeList>();

            using (SqlCommand command = new SqlCommand("dbo.GetFoodTypeList", SQLconn))
            {
                command.CommandType = CommandType.StoredProcedure;
                SQLconn.Open();
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        TypeList tempTL = new TypeList();
                        tempTL.FoodTypeID      = reader.GetInt32(0);
                        tempTL.FoodType        = reader.GetString(1);
                        tempTL.TypeDescription = reader.GetString(2);
                        TL.Add(tempTL);
                    }
                }
            }
            SQLServerConnection.CloseSQLConnection(SQLconn);
            return(TL);
        }