Пример #1
0
        //Конструктор, вызываемый для редактирования
        public add_food_in_book(db_connect data_module, string food_in_book_card, string food_in_book_food, string food_in_book_book, int card_id, int food_id, int book_id)
        {
            InitializeComponent();

            food_in_book[] food_in_book = new food_in_book[512];
            food_in_book = Program.add_read_module.get_list_food_in_book_id(book_id);
            if (food_in_book != null)
            {
                this.lb_food.Items.Clear();
                for (int i = 1; i < food_in_book.Count(); i++)
                {
                    if (food_in_book[i] != null)
                    {
                        this.lb_food.Items.Add(food_in_book[i].food_id);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            this.food_id = food_id.ToString();

            this.set_state("OLD");

            this.food = food_in_book_food.ToString();

            this.fill_food_in_book_data();
            this._data_module = data_module;
        }
Пример #2
0
        // Конструктор, вызываемый при нажатии "Добавить"
        public add_food_in_book(db_connect data_module, int book_id, string _author, string _year)
        {
            InitializeComponent();
            author = _author;
            year = _year;

            food_in_book[] food_in_book = new food_in_book[512];
            food_in_book = Program.add_read_module.get_list_food_in_book_id(book_id);
            if (food_in_book != null)
            {
                this.lb_food.Items.Clear();
                for (int i = 1; i < food_in_book.Count(); i++)
                {
                    if (food_in_book[i] != null)
                    {
                        this.lb_food.Items.Add(food_in_book[i].food);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            this._data_module = data_module;
            this.set_state("NEW");
        }