コード例 #1
0
ファイル: clsSQL.cs プロジェクト: tiamatinc/project2
 public DataTable getIngredients(clsRecipe rec)
 {
     _strSQL = "SELECT Name, Description, Season FROM Ingredients, Recipe_Contains WHERE Ingr_fk = Ingr_id AND Rec_fk = "
               + rec.id + ";";
     executesql();
     return(_dtResult);
 }
コード例 #2
0
 public frmShowRecipe(frmShowResults resultsForm, clsRecipe thisRec)
 {
     _data        = new clsSQL();
     _resultsForm = resultsForm;
     _thisRecipe  = thisRec;
     _ingredients = _data.getIngredients(_thisRecipe);
     InitializeComponent();
     populate();
 }
コード例 #3
0
        public void addRecipe(clsRecipe recNewRecipe, List <clsIngredient> ingredientsUsed,
                              List <String> stylesUsed, List <String> catsUsed)
        {
            _strSQL = "INSERT INTO Recipes (Season, Directions, Favorite, Name) VALUES ('" + recNewRecipe.season + "', '" +
                      recNewRecipe.directions + "', '" + recNewRecipe.favorite + "', '" + recNewRecipe.name + "'); SELECT TOP 1 Rec_id " +
                      "FROM RECIPES ORDER BY Rec_id DESC;";
            executesql();
            int recID = Convert.ToInt32(_dtResult.Rows[0]["Rec_id"]);

            containsInsert(ingredientsUsed, recID);
            recStylesInsert(stylesUsed, recID);
            recCatsInsert(catsUsed, recID);
        }
コード例 #4
0
 public frmAddRecipe()
 {
     _recNewRecipe    = new clsRecipe();
     _data            = new clsSQL();
     _ingredientsUsed = new List <clsIngredient>();
     _stylesUsed      = new List <String>();
     _catsUsed        = new List <String>();
     lstIngredients   = new ListView();
     lstCategories    = new ListView();
     lstStyles        = new ListView();
     InitializeComponent();
     populateIngredients();
     populateCategories();
     populateStyles();
 }
コード例 #5
0
ファイル: frmShowResults.cs プロジェクト: tiamatinc/project2
        private void btnFavorite_Click(object sender, EventArgs e)
        {
            clsRecipe rec  = new clsRecipe();
            clsSQL    data = new clsSQL();

            // str = DataGridView1.Rows[DataGridView.SelectedRows[0].Index].Cells[X].Value.ToString();
            rec.id         = Int32.Parse(dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[1].Value.ToString());
            rec.name       = dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[2].Value.ToString();
            rec.season     = dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[3].Value.ToString();
            rec.directions = dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[4].Value.ToString();
            Char[] chararr = dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[5].Value.ToString().ToCharArray();
            rec.favorite = chararr[0];
            data.favoriteRecipe(rec);
            MessageBox.Show(rec.name + " has been added to your favorites!");
            dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[5].Value = "Y";
        }
コード例 #6
0
ファイル: frmShowResults.cs プロジェクト: tiamatinc/project2
        private void showView()
        {
            clsRecipe rec = new clsRecipe();

            // str = DataGridView1.Rows[DataGridView.SelectedRows[0].Index].Cells[X].Value.ToString();
            rec.id         = Int32.Parse(dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[1].Value.ToString());
            rec.name       = dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[2].Value.ToString();
            rec.season     = dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[3].Value.ToString();
            rec.directions = dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[4].Value.ToString();
            Char[] chararr = dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[5].Value.ToString().ToCharArray();
            rec.favorite = chararr[0];

            frmShowRecipe showRec = new frmShowRecipe(this, rec);

            showRec.Show();
            this.Hide();
        }
コード例 #7
0
ファイル: clsSQL.cs プロジェクト: tiamatinc/project2
 public DataTable getCategories(clsRecipe rec)
 {
     _strSQL = "SELECT Name FROM Categories, Recipe_Categories WHERE Cat_id = Cat_fk AND Rec_fk = " + rec.id + ";";
     executesql();
     return(_dtResult);
 }
コード例 #8
0
ファイル: clsSQL.cs プロジェクト: tiamatinc/project2
 public DataTable getStyles(clsRecipe rec)
 {
     _strSQL = "SELECT Name FROM Styles, Recipe_Styles  WHERE Style_id = Style_fk AND Rec_fk = " + rec.id + ";";
     executesql();
     return(_dtResult);
 }
コード例 #9
0
ファイル: clsSQL.cs プロジェクト: tiamatinc/project2
 public void favoriteRecipe(clsRecipe rec)
 {
     _strSQL = "UPDATE Recipes SET Favorite = 'Y' WHERE Rec_id = " + rec.id + ";";
     executesql();
 }