Exemplo n.º 1
0
        Point offset    = new Point(0, 0); //记录动了多少距离
        public Shoping_Form(Customer customer, Merchant merchant, Form mainForm)
        {
            form             = mainForm;
            order.Customer   = customer;
            this.merchant    = merchant;
            order.MerchantId = merchant.Id;

            merchant.CuisineTypes = Merchant_Service.getAllCuisineTypes(merchant);
            InitializeComponent();
            int i = 0;

            foreach (CuisineType cuisineType in merchant.CuisineTypes)
            {
                RadioButton radioButton = new RadioButton();
                radioButton.Name       = cuisineType.TypeName;
                radioButton.Text       = cuisineType.TypeName;
                radioButton.Appearance = Appearance.Button;
                radioButton.SetBounds(5, 60 * i + 5, 120, 60);
                radioButton.Font      = new Font("微软雅黑 Light", 12, FontStyle.Regular);
                radioButton.TextAlign = ContentAlignment.MiddleCenter;
                pnlCuisineType.Controls.Add(radioButton);
                radioButton.Click += new EventHandler(Cuisine_Form_Show);
                i++;
            }

            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
        }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Cuisine cuisine = new Cuisine(Name2.Text, Des2.Text, int.Parse(Price2.Text), Merchant_Service.getAllCuisineTypes(currentMerchant)[dataGridView1.CurrentCell.RowIndex].Id, path.Text);

            Merchant_Service.addCuisine(cuisine);
            cuisineBindingSource.DataSource = Merchant_Service.getAllCuisineTypes(currentMerchant)[dataGridView1.CurrentCell.RowIndex].Cuisines;
            cuisineBindingSource.ResetBindings(false);
        }
Exemplo n.º 3
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (dataGridView2.CurrentCell.RowIndex >= 0)
     {
         Merchant_Service.deleteCuisine(Merchant_Service.getAllCuisineTypes(currentMerchant)[dataGridView1.CurrentCell.RowIndex].Cuisines[dataGridView2.CurrentCell.RowIndex]);
         cuisineBindingSource.DataSource = Merchant_Service.getAllCuisineTypes(currentMerchant)[dataGridView1.CurrentCell.RowIndex].Cuisines;
         cuisineBindingSource.ResetBindings(false);
     }
 }
Exemplo n.º 4
0
 private void dataGridView1_MouseClick(object sender, MouseEventArgs e)
 {
     if (Merchant_Service.getAllCuisineTypes(currentMerchant) != null)
     {
         cuisineBindingSource.DataSource = Merchant_Service.getAllCuisineTypes(currentMerchant)[dataGridView1.CurrentCell.RowIndex].Cuisines;
         //cuisineBindingSource.DataSource = currentMerchant.CuisineTypes[dataGridView1.CurrentCell.RowIndex].Cuisines;
         cuisineBindingSource.ResetBindings(false);
     }
 }
Exemplo n.º 5
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            CuisineType newType = new CuisineType(nameBox.Text, currentMerchant.Id);

            //currentMerchant.CuisineTypes.Add(newType);
            Merchant_Service.addCuisineType(newType);
            typeBindingSource.DataSource = Merchant_Service.getAllCuisineTypes(currentMerchant);
            //typeBindingSource.DataSource = currentMerchant.CuisineTypes;
            typeBindingSource.ResetBindings(false);
        }
Exemplo n.º 6
0
        public Edit_Cuisine_Form(Merchant merchant)
        {
            this.currentMerchant = merchant;
            typeBindingSource    = new BindingSource();
            InitializeComponent();

            typeBindingSource.DataSource = Merchant_Service.getAllCuisineTypes(merchant);
            //typeBindingSource.DataSource = currentMerchant.CuisineTypes;
            typeBindingSource.ResetBindings(false);

            //cuisineBindingSource.DataSource = Merchant_Service.getAllCuisineTypes(merchant)[0];
            //cuisineBindingSource.DataSource = Merchant_Service.getAllCuisines(cuisineType);
            //cuisineBindingSource.DataSource = type.Cuisines;
            cuisineBindingSource.ResetBindings(false);
        }
Exemplo n.º 7
0
        public Shoping_Form(Customer customer, Merchant merchant)
        {
            order.OrderState      = "待支付";
            order.Customer        = customer;
            this.merchant         = merchant;
            merchant.CuisineTypes = Merchant_Service.getAllCuisineTypes(merchant);
            InitializeComponent();
            int i = 0;

            foreach (CuisineType cuisineType in merchant.CuisineTypes)
            {
                RadioButton radioButton = new RadioButton();
                radioButton.Name       = cuisineType.TypeName;
                radioButton.Text       = cuisineType.TypeName;
                radioButton.Appearance = Appearance.Button;
                radioButton.SetBounds(0, 100 * i, 180, 100);

                i++;
            }
        }
Exemplo n.º 8
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     cuisineBindingSource.DataSource = Merchant_Service.getAllCuisineTypes(currentMerchant)[dataGridView1.CurrentCell.RowIndex].Cuisines;
 }