Beispiel #1
0
        private void btnThemHoaDon_Click(object sender, EventArgs e)
        {
            double khuyenMai = Convert.ToDouble(listKhuyenMai.Sum(v => v.GiaTri));

            using (ThemHoaDon form2 = new ThemHoaDon(taiKhoan, khuyenMai))
            {
                form2.ShowDialog();
            }
        }
Beispiel #2
0
        /// <summary>
        /// them coc nay` vao hoa' don
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnThemVaoGioHang_Click(object sender, EventArgs e)
        {
            if (txtSoLuong.Text == "")
            {
                MessageBox.Show("Nhập số lượng sản phẩm!");
            }
            else
            {
                if (Convert.ToInt32(txtSoLuong.Text.ToString()) < 0)
                {
                    MessageBox.Show("Số lượng > 0!");
                }
                else
                {
                    gioHang.SoLuong = Convert.ToInt32(txtSoLuong.Text.ToString());

                    // gui lai giu lieu ve form cha
                    ThemHoaDon parent = (ThemHoaDon)this.Owner;

                    // list topping
                    // Dictionary<int, string> pairs = null;

                    if (gioHang.MaTopping != null)
                    {
                        List <ToppingViewModel> listTopping = new List <ToppingViewModel>();
                        // pairs = new Dictionary<int, string>();
                        //add ten va ma topping vao Dictionary
                        gioHang.MaTopping.ForEach(v =>
                        {
                            var _tmp = toppingList.Find(n => n.MaTopping == v);
                            listTopping.Add(_tmp);
                            //pairs.Add(v, toppingList.Find(n => n.MaTopping == v).TenTopping);
                        });

                        //gui du~ lieu.
                        parent.GetDataFromChild(gioHang, listTopping);
                        //parent.GetListTopping(listTopping);
                    }
                    this.Close();
                }
            }
        }