示例#1
0
        /// <summary>
        /// Конструктор, вызываемый при нажатии "Добавить"
        /// </summary>
        /// <param name="data_module"></param>
        public add_cards(db_connect data_module)
        {
            InitializeComponent();

            //получаем список блюд
            class_card[] card = new class_card[512];
            card = Program.add_read_module.get_list_food_name_in_card();
            if (card != null)
            {
                this.cb_food.Items.Clear();
                for (int i = 1; i < card.Count(); i++)
                {
                    if (card[i] != null)
                    {
                        this.cb_food.Items.Add(card[i].food_name);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            this._data_module = data_module;
            this.set_state("NEW");
        }
示例#2
0
        /// <summary>
        /// Конструктор, вызываемый для редактирования
        /// </summary>
        /// <param name="data_module"></param>
        /// <param name="card_id"></param>
        /// <param name="food_name"></param>
        /// <param name="food_id"></param>
        public add_cards(db_connect data_module, int card_id, string food_name, int food_id)
        {
            InitializeComponent();
            cb_food.Visible = false;
            label1.Visible = false;
            this.b_save.Location = new System.Drawing.Point(10, 130);
            this.b_cancel.Location = new System.Drawing.Point(160, 130);
            this.Size = new Size(520, 195);
              label2.Location= new System.Drawing.Point(5, 10);
              tb_cost.Location = new System.Drawing.Point(10, 30);
              label4.Location = new System.Drawing.Point(5, 55);

              tb_card_numb.Location = new System.Drawing.Point(10, 75);
            //получаем список блюд
            class_card[] card = new class_card[512];
            card = Program.add_read_module.get_list_food_name_in_card();
            if (card != null)
            {
                this.cb_food.Items.Clear();
                for (int i = 1; i < card.Count(); i++)
                {
                    if (card[i] != null)
                    {
                        this.cb_food.Items.Add(card[i].food_name);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            this.card_id = card_id.ToString();
            this.food_id = food_id.ToString();
            this.set_state("OLD");
            this.food_name = food_name.ToString();

            this.fill_card_data();
            this._data_module = data_module;
        }