Esempio n. 1
0
        public void TaoDichVu_2()
        {
            DAL.DataProvider.InitalizeConnection();

            DichVuDTO dichVu = new DichVuDTO(DichVuBUS.PhatSinhMaDichVu(), "xyz", 30000, "Đĩa", BUSTest.Properties.Resources.No_Image_Available, 2);

            DichVuBUS.LuuThongTinDichVu(dichVu);


            DichVuDTO p = DichVuBUS.LayThongTinDichVu(dichVu.MaDV);

            Assert.IsTrue(dichVu.TenDV == p.TenDV);
        }
Esempio n. 2
0
        private void wbntThemdichvu_ButtonClick(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e)
        {
            switch (e.Button.Properties.Tag.ToString())
            {
            case "Thêm":
                //Kiểm tra thông tin hợp lệ
                if (txtTenDichVu.Text == "")
                {
                    return;
                }

                if (txtDonVi.Text == "")
                {
                    return;
                }


                //Lưu thông tinh
                if (DichVuBUS.LuuThongTinDichVu(new DichVuDTO(Convert.ToInt32(txtMaDV.Text), txtTenDichVu.Text, Convert.ToDouble(txtDonGia.EditValue), txtDonVi.Text, resizeImage(pictureEdit1.Image), listLoaiDichVu[cmbLoaiDV.SelectedIndex].MaLoaiDV)))
                {
                    //Thông báo thành công

                    XtraMessageBox.Show("Thêm dịch vụ thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    actionBack();
                }
                else
                {
                    //Thông báo thất bại

                    XtraMessageBox.Show("Thêm dịch vụ thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;

            case "Hủy":
                if (ThongBaoHuyKoLuuDichVu())
                {
                    actionBack();
                }
                break;

            default:
                break;
            }
        }