Пример #1
0
        private void btSua_Click(object sender, EventArgs e)
        {
            DAO_SanPham dao = new DAO_SanPham();

            if (HinhAnh == "")
            {
                MessageBox.Show("Please Select Image");
            }
            else
            {
                Exceptionn ex = new Exceptionn();
                if (ex.KiemTraChuoi(new string[] { tbTen.Text, tbDonVi.Text }, new int[] { 100, 100 }) &&
                    ex.KiemTraSoLuong(tbSoLuong.Text, 999999999) && ex.KiemTraSoLuong(tbDonGia.Text, 10 ^ 37))
                {
                    DTO_SanPham dto = new DTO_SanPham(tbTen.Text, Convert.ToInt32(tbSoLuong.Text), tbDonVi.Text,
                                                      Convert.ToDateTime(dtpNgayThem.Text), Convert.ToDateTime(dtpNgaySanXuat.Text),
                                                      Convert.ToDateTime(dtpHanSuDung.Text), HinhAnh, Convert.ToDouble(tbDonGia.Text), Convert.ToInt32(cbbDanhMuc.SelectedValue));
                    dto.ID = id;
                    dao.Update(dto);
                }
            }
            FSanPham_Load(sender, e);
        }