private void btDelete_Click(object sender, EventArgs e) { string maLP = txt_MaLoaiphong.Text.Trim().ToString(); QLKS_BUS_WebserviceSoapClient ws = new QLKS_BUS_WebserviceSoapClient(); if (MessageBox.Show(this, "Bạn muốn xóa loại phòng "+ maLP +" này ko", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { int kt_using = ws.KiemTra_Using(maLP); if (kt_using == 0) { int kt_xoa = ws.delete(maLP); if (kt_xoa == 1) { frmThayDoiQD_Load(null, null); MessageBox.Show("Xóa thành công!"); return; } else { MessageBox.Show("Mã loại phòng này không đúng"); } } else { MessageBox.Show("Mã loại phòng này đang được sử dúng"); } } }
private void btLogin_Click(object sender, EventArgs e) { QLKS_BUS_WebserviceSoapClient ws = new QLKS_BUS_WebserviceSoapClient(); if (KiemTraRong() == true) { info(); if (ws.KiemTra_tendangnhap(UserDTO.Name) == false) { MessageBox.Show("Tên đăng nhập không đúng!"); txt_UserName.Focus(); return; } else { if (ws.KiemTra_matkhau(UserDTO.Name, UserDTO.PassWord) == false) { MessageBox.Show("Mật khẩu chưa chính xác!"); txt_Password.Focus(); return; } else { frm_Main.pws = ws.getIdKUserByIdUser(UserDTO); //MessageBox.Show(busnguoidung.getIdKUserByIdUser(UserDTO)); //Thread thread = new Thread(new ThreadStart(hienform_main)); //Tạo luồng mới //thread.Start(); //Khởi chạy luồng Thread thread = new Thread(new ThreadStart(hienform_main)); thread.Start(); this.Dispose(); //this.Close(); //this.Close(); //đóng Form hiện tại. (Form1) } } } }
private void btSave_Click(object sender, EventArgs e) { //them QLKS_BUS_WebserviceSoapClient ws = new QLKS_BUS_WebserviceSoapClient(); if (kt == 1) { if (KiemTra_rong() == false) { int kt_so = ws.KiemTra_So(txt_DonGia.Text.ToString()); if (kt_so == 1) { if (txt_DonGia.Text.Length < 15) { info(); int kt_maLP = ws.KiemTra_MaLP(dtoLP); if (kt_maLP == 0) { ws.insertLoaiPhong(dtoLP); frmThayDoiQD_Load(null, null); MessageBox.Show("Thêm thành công!"); } else { MessageBox.Show("Mã loại phòng bị trùng!"); txt_MaLoaiphong.Focus(); return; } } else { MessageBox.Show("Số nhập vào quá lớn"); return; } } else { MessageBox.Show("Đơn giá phải là số!"); txt_DonGia.Focus(); return; } } } // sua if (kt == 2) { txt_MaLoaiphong.Enabled = false; int kiemtra_so = ws.KiemTra_So(txt_DonGia.Text.Trim().ToString()); if (KiemTra_rong() == false) { if (kiemtra_so == 1) { info(); ws.update(dtoLP); frmThayDoiQD_Load(null, null); MessageBox.Show("Sửa thành công"); txt_MaLoaiphong.Enabled = true; txt_TenLoaiPhong.Enabled = true; } else { MessageBox.Show("Đơn giá phải là số!"); } } } }
private void btluu_Click(object sender, EventArgs e) { QLKS_BUS_WebserviceSoapClient ws = new QLKS_BUS_WebserviceSoapClient(); string GT = txt_giatri.Text.Trim().ToString(); int kt_so = ws.KiemTra_So(GT); if (kt_so == 1) { float giatri = float.Parse(GT); int kt_chaylenh = 0; if (option_khachtoida.Checked == true) { kt_chaylenh = ws.UpdateThamSo("1", giatri); } if (option_tyle.Checked == true) { kt_chaylenh = ws.UpdateThamSo("2", giatri); } if (option_heso.Checked == true) { kt_chaylenh = ws.UpdateThamSo("3", giatri); } if (kt_chaylenh == 1) { MessageBox.Show("cập nhật thành công"); getListTS(); } else { MessageBox.Show("lỗi"); } } else { MessageBox.Show("chuỗi nhập vào phải là số"); txt_giatri.Focus(); } }