예제 #1
0
        private void ok_btn_Click(object sender, EventArgs e)
        {
            dtoCaNhan.MACANHAN       = RandomString(10);
            dtoCaNhan.TENNGUOILIENHE = hoten_txt.Text;
            dtoCaNhan.SDT            = sdt_txt.Text;
            dtoCaNhan.EMAIL          = email_txt.Text;
            dtoCaNhan.DIACHI         = SoNha_txt.Text + " Đường " + Duong_txt.Text + " Quận " + QuanHuyen_txt.Text;

            busKhachHang.them(dtoCaNhan);

            dtoDonHang.MADONHANG = RandomString(10);
            dtoDonHang.MACANHAN  = dtoCaNhan.MACANHAN;
            bushangHoa.themdonhang_canhan(dtoDonHang);

            dtoHangHoaDat.MADONHANG    = dtoDonHang.MADONHANG;
            dtoHangHoaDat.MAHANGHOADAT = RandomString(10);
            dtoHangHoaDat.SOLUONG      = dataGridView1.Rows.Count - 1;
            bushangHoa.themhangdat(dtoHangHoaDat);
            for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
            {
                LoaiHangHoaDatDTO hang = new LoaiHangHoaDatDTO();
                DataGridViewRow   row  = this.dataGridView1.Rows[i];
                hang.MALOAIHANGHOADAT = RandomString(10);
                hang.MAHANHOADAT      = dtoHangHoaDat.MAHANGHOADAT;
                hang.MAHANGHOA        = row.Cells[1].Value.ToString();
                hang.SOLUONG          = row.Cells[3].Value.ToString();
                bushangHoa.themloaihanghoadat(hang);
            }


            qldh.QuanLyDonHang_Load(sender, e);
            this.Hide();
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string n = RandomString(10);
            string m = RandomString(10);

            dtoKhachHang.id        = n;
            dtoKhachHang.HOVATEN   = Nguoilh_txt.Text;
            dtoKhachHang.sdt       = tel_txt.Text;
            dtoKhachHang.EMAIL     = email_txt.Text;
            dtoKhachHang.SONHA     = Sonha_txt.Text;
            dtoKhachHang.DUONG     = Duong_txt.Text;
            dtoKhachHang.MAHUYEN   = Quanhuyen_txt.Text;
            dtoKhachHang.MATINH    = TinhTp_cbbox.Text;
            dtoKhachHang.MAXA      = Phuongxa_cbbox.Text;
            dtoKhachHang.PHONG     = Phong_txt.Text;
            dtoKhachHang.TENCOQUAN = Tochuc_txt.Text;
            dtoKhachHang.mst       = Mst_txt.Text;
            busKhachHang.themKhachHang_HopDong(dtoKhachHang);

            dtoHopDong.id               = m;
            dtoHopDong.EMAIL            = Email2_txt.Text;
            dtoHopDong.TENNGUOILIENHE   = Nguoilh2_txt.Text;
            dtoHopDong.sdt              = Tel2_txt.Text;
            dtoHopDong.DIACHI           = Cuxa2_txt.Text;
            dtoHopDong.FAX              = Fax2_txt.Text;
            dtoHopDong.MST              = Mst2_txt.Text;
            dtoHopDong.TENTOCHUC        = Tochuc2_txt.Text;
            dtoHopDong.SONHA            = Sonha2_txt.Text;
            dtoHopDong.DUONG            = Duong2_txt.Text;
            dtoHopDong.MAHUYEN          = Quanhuyen2_cbbox.Text;
            dtoHopDong.PHONG            = Phong2_txt.Text;
            dtoHopDong.MAXA             = Phuongxa2_cbbox.Text;
            dtoHopDong.MATINH           = Tinhtp2_cbbox.Text;
            dtoHopDong.THOIGIANGIAODICH = tggh_cbbox.Text;
            dtoHopDong.KHUCAOOC         = Cuxa2_txt.Text;
            dtoHopDong.MANHANVIEN       = nvgd_cbbox.Text;
            dtoHopDong.LAU              = Lau2_txt.Text;
            dtoHopDong.PHONGBAN         = Phongban2_txt.Text;

            busKhachHang.themHopDong_HopDong(dtoHopDong);
            string id = RandomString(10);

            dtoDonHang.MADONHANG = id;
            dtoDonHang.MAHOPDONG = dtoHopDong.id;
            bushangHoa.themdonhang_hopdong(dtoDonHang);

            dtoHangHoaDat.MADONHANG    = dtoDonHang.MADONHANG;
            dtoHangHoaDat.MAHANGHOADAT = RandomString(10);
            dtoHangHoaDat.SOLUONG      = dataGridView1.Rows.Count - 1;
            bushangHoa.themhangdat(dtoHangHoaDat);
            for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
            {
                LoaiHangHoaDatDTO hang = new LoaiHangHoaDatDTO();
                DataGridViewRow   row  = this.dataGridView1.Rows[i];
                hang.MALOAIHANGHOADAT = RandomString(10);
                hang.MAHANHOADAT      = dtoHangHoaDat.MAHANGHOADAT;
                hang.MAHANGHOA        = row.Cells[1].Value.ToString();
                hang.SOLUONG          = row.Cells[3].Value.ToString();
                bushangHoa.themloaihanghoadat(hang);
            }
            qldh.QuanLyDonHang_Load(sender, e);
            this.Hide();
        }