private void button5_Click(object sender, EventArgs e)
 {
     if (textBox_ID_visit.Text == "")
     {
         MessageBox.Show("يرجى تحديد رقم الزيارة او اسم المريض لدخول الى الوصفة الطبية", "عذرا", MessageBoxButtons.OK, MessageBoxIcon.Question);
     }
     else
     {
         recipe1 ss = new recipe1();
         ss.Show();
     }
 }
Пример #2
0
        private static recipe1 ReadRecipe(IDataRecord reader)
        {
            int    id     = reader.GetInt32(0);
            string dato   = reader.GetString(1);
            string recipe = reader.GetString(2);


            recipe1 recipe3 = new recipe1
            {
                dato   = dato,
                recipe = recipe,
            };

            return(recipe3);
        }
Пример #3
0
        public int Post([FromBody] recipe1 r)
        {
            const string postString = "INSERT INTO recipe(dato, recipe ) VALUES (@dato, @recipe)";

            using (SqlConnection databaseConnection = new SqlConnection(connectionString))
            {
                databaseConnection.Open();
                using (SqlCommand insertCommand = new SqlCommand(postString, databaseConnection))
                {
                    insertCommand.Parameters.AddWithValue("@dato", r.dato);
                    insertCommand.Parameters.AddWithValue("@recipe", r.recipe);

                    int rowsAffected = insertCommand.ExecuteNonQuery();

                    return(rowsAffected);
                }
            }
        }
Пример #4
0
        public IEnumerable <recipe1> GetAllRecipe()
        {
            const string selectString = "SELECT * FROM Recipe order by id DESC";

            using (SqlConnection databaseConnection = new SqlConnection(connectionString))
            {
                databaseConnection.Open();
                using (SqlCommand selectCommand = new SqlCommand(selectString, databaseConnection))
                {
                    using (SqlDataReader reader = selectCommand.ExecuteReader())
                    {
                        List <recipe1> recipeList = new List <recipe1>();
                        while (reader.Read())
                        {
                            recipe1 weight = ReadRecipe(reader);
                            recipeList.Add(weight);
                        }
                        return(recipeList);
                    }
                }
            }
        }