Beispiel #1
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            if (txtMahd.Text == "" || txtmanv.Text == "" || txtchietkhau.Text == "")
            {
                MessageBox.Show("Không được để trống");
                return;
            }
            d = 1;
            HOADONBAN hd = new HOADONBAN();
            var       kt = from s in db.HOADONBANs where s.MAHD == txtMahd.Text select s;

            if (kt.Count() > 0)
            {
                MessageBox.Show("Trùng khóa chính");
                return;
            }
            hd.MAHD     = txtMahd.Text;
            hd.NGAYLAP  = Convert.ToDateTime(DateTime.Now.ToShortDateString());
            hd.MANV     = txtmanv.Text;
            hd.TONGTIEN = 0;
            if (rdb_kvl.Checked == true)
            {
                txt_kvl.Visible = true;
                hd.KHVANGLAI    = txt_kvl.Text;
                txt_kvl.Text    = db.SINHMA_KH();
                txtMahd.Text    = db.SINHMA_HDB();
            }
            else
            {
                txtmakh.Visible = true;
                hd.KHVANGLAI    = txtmakh.Text;
            }
            hd.CHIECKHAU = Convert.ToDouble(txtchietkhau.Text.ToString());
            db.HOADONBANs.InsertOnSubmit(hd);
            db.SubmitChanges();
            this.hOADONBANTableAdapter.Fill(this.dataSet_ShopGiay.HOADONBAN);
            //CTHD_Load(sender, e);
            MessageBox.Show("Thành công");
        }
Beispiel #2
0
        private void CTHD_Load(object sender, EventArgs e)
        {
            rdb_kvl.Checked = true;
            // TODO: This line of code loads data into the 'dataSet_ShopGiay.BanHang' table. You can move, or remove it, as needed.
            //  this.banHangTableAdapter.Fill(this.dataSet_ShopGiay.BanHang);

            // TODO: This line of code loads data into the 'dataSet_ShopGiay.KHUYENMAI' table. You can move, or remove it, as needed.
            this.kHUYENMAITableAdapter.Fill(this.dataSet_ShopGiay.KHUYENMAI);

            // TODO: This line of code loads data into the 'dataSet_ShopGiay.HOADONBAN' table. You can move, or remove it, as needed.
            this.hOADONBANTableAdapter.Fill(this.dataSet_ShopGiay.HOADONBAN);
            txtMahd.Text = db.SINHMA_HDB();
            txtmanv.Text = Tennv;
            txt_kvl.Text = db.SINHMA_KH();

            String t;

            for (int i = 0; i < banHangDataGridView.Rows.Count; i++)
            {
                txtTongsl.Text = i.ToString();
            }
        }