Exemplo n.º 1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if(txtName.Text!=""&& txtGia.Text!="")
            {
             if (!checkBoxX1.Checked)
            {
                 TachSo(txtGia);
                KhoHang.Model.InsertKho kho = new Model.InsertKho();
                kho.InsertNguyenLieu(txtName.Text, cbDonVi.Text, a,MaDanhMuc);
                this.Close();
            }
            else
            {
                if (txtGiaThucDon.Text != "")
                {
                    TachSo(txtGia);
                    KhoHang.Model.InsertKho kho = new Model.InsertKho();
                    kho.InsertNguyenLieu(txtName.Text, cbDonVi.Text, a, MaDanhMuc);
                    ThucDon.InsertThucDon thucdon = new ThucDon.InsertThucDon();
                    TachSo(txtGiaThucDon);
                    int MaDanhMucThucDon = Convert.ToInt32(cbDanhMucThucDon.SelectedValue.ToString());
                    string Anh = "";
                    thucdon.InsertMonAn(txtName.Text, cbDonVi.Text, a,Anh,MaDanhMucThucDon);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Bạn điền giá của sản phẩm");
                }

            }
            }else
            {
                MessageBox.Show("Bạn điền đầy đủ thông tin");
            }
        }
Exemplo n.º 2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                ThucDon.InsertThucDon thucdon = new ThucDon.InsertThucDon();
                if(txtThucDon.Text!=""&& txtGiaBan.Text!="")
                {
                string TenMonAn = txtThucDon.Text;
                string DonVi = comboTreeDonVi.Text;
                checkso(txtGiaBan);
                float Gia = a;
                string Anh = path;
                int MaDanhMucThucDon = Convert.ToInt32(comboTreeDanhMuc.SelectedValue.ToString());
                if (checkBoxXThucDon.Checked)
                {
                    checkso(txtGiaNguyenLieu);
                   float GiaNguyenLieu = a;
                    int MaDanhMucNguyenLieu = Convert.ToInt32(cbDanhMucNguyenLieu.SelectedValue.ToString());
                  KhoHang.Model.InsertKho insert = new KhoHang.Model.InsertKho();
                    thucdon.InsertMonAn(TenMonAn, DonVi, Gia, Anh, MaDanhMucThucDon);
                   insert.InsertNguyenLieu(TenMonAn, DonVi, Gia, MaDanhMucNguyenLieu);

                }
                else
                {
                    thucdon.InsertMonAn(TenMonAn, DonVi, Gia, Anh, MaDanhMucThucDon);
                }

                this.Close();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }