Пример #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            var rec     = new Receipt();
            var control = new ControlInput();

            if (!control.ControlStringInput(NewTitle.Text.ToString(), 100))
            {
                return;
            }

            if (!control.ControlStringInput(NewDescription.Text.ToString(), 300))
            {
                return;
            }

            if (!control.ControlStringInput(NewIngredients.Text.ToString(), 300))
            {
                return;
            }

            rec.ReceiptID      = _ID;
            rec.RecTitle       = NewTitle.Text.ToString();
            rec.RecDescription = NewDescription.Text.ToString();
            rec.RecIngredients = NewIngredients.Text.ToString();
            rec.CategoryID     = int.Parse(NewCategories.SelectedValue.ToString());

            var Update = new AddData();

            Update.UpdateReceipt(rec);

            var Done = new CompleteMessage("Update ");

            Done.Show();
            this.Close();
        }
Пример #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            var control = new ControlInput();


            if (!control.ControlStringInput(TitleBox.Text.ToString(), 100))
            {
                return;
            }

            if (!control.ControlStringInput(DescriptionBox.Text.ToString(), 300))
            {
                return;
            }

            if (!control.ControlStringInput(IngredientsBox.Text.ToString(), 300))
            {
                return;
            }


            var Rec = new Receipt();

            Rec.RecTitle       = TitleBox.Text.ToString();
            Rec.RecDescription = DescriptionBox.Text.ToString();
            Rec.RecIngredients = IngredientsBox.Text.ToString();
            Rec.CategoryID     = int.Parse(CategoryBox.SelectedValue.ToString());

            var Test = new AddData();

            Test.AddReceipt(Rec);

            var Done = new CompleteMessage("Addition ");

            Done.Show();
            this.Close();
        }