protected void Button1_Click(object sender, EventArgs e) { // lay ma benh nhan tu ma dang nhap ma tai khoan int MaNguoiLon; int MaTK = (int)Session["MaTK"]; NguoiLonControl nglonctr = new NguoiLonControl(); MaNguoiLon = nglonctr.MaBenhNhanKhiBietMaTK(MaTK); // luu vao phieu dang ky PhieuDangKyControl pdkctr = new PhieuDangKyControl(); PhieuDangKyInfo pdkinf = new PhieuDangKyInfo(); pdkinf.MaBenhNhan = MaNguoiLon; pdkinf.Ngay = UCNgay.NgayThang; pdkinf.TrieuChung = txtTCnguoilon.Text; // them phieu dang ky try { pdkctr.sp_ThemPhieuDangKy(pdkinf); // lay ma phieu dang ky len // int SoTT = pdkctr.LayMaPhieuDangKyTuMaBenhNhan(MaNguoiLon, pdkinf.Ngay); int SoTT = pdkctr.DemSLBenhNhanDKTrongNgay(UCNgay.NgayThang); lbSoDiKham.Text = "Số đi khám bệnh là :" + SoTT.ToString(); int SoLuongNguoi = int.Parse(lbSoNguoi.Text); } catch { } }
//----9--them thong tin Phieu dang ky //create proc sp_ThemPhieuDangKy @ngay datetime, @trieuchung nvarchar(100), @maBN int public void sp_ThemPhieuDangKy(PhieuDangKyInfo info) { dataService.Conect(); dataService.Cmd = new SqlCommand("sp_ThemPhieuDangKy", dataService.Cnn); dataService.Cmd.CommandType = CommandType.StoredProcedure; dataService.Cmd.Parameters.Add("@ngay", SqlDbType.DateTime); dataService.Cmd.Parameters["@ngay"].Value = info.Ngay; dataService.Cmd.Parameters.Add("@trieuchung", SqlDbType.NVarChar); dataService.Cmd.Parameters["@trieuchung"].Value = info.TrieuChung; dataService.Cmd.Parameters.Add("@maBN", SqlDbType.Int); dataService.Cmd.Parameters["@maBN"].Value = info.MaBenhNhan; dataService.Cmd.ExecuteNonQuery(); dataService.DisConect(); }
//create proc sp_DemSLBenhNhanDKTrongNgay @ngay datetime public int sp_DemSLBenhNhanDKTrongNgay(DateTime ngay) { int dem = 0; PhieuDangKyInfo info = new PhieuDangKyInfo(); dataService.Conect(); dataService.Cmd = new SqlCommand("sp_DemSLBenhNhanDKTrongNgay", dataService.Cnn); dataService.Cmd.CommandType = CommandType.StoredProcedure; dataService.Cmd.Parameters.Add("@ngay", SqlDbType.DateTime); dataService.Cmd.Parameters["@ngay"].Value = ngay; SqlDataReader r = dataService.Cmd.ExecuteReader(); while (r.Read()) { info.SoLuong = int.Parse(r.GetValue(0).ToString()); } dem = info.SoLuong; dataService.DisConect(); return(dem); }
public void sp_ThemPhieuDangKy(PhieuDangKyInfo info) { accPDK.sp_ThemPhieuDangKy(info); }
protected void btDangKy_Click(object sender, EventArgs e) { // kiem tra so luong nguoi da dang ky trong ngay PhieuDangKyControl pdkctr = new PhieuDangKyControl(); int SluongDK = pdkctr.DemSLBenhNhanDKTrongNgay(UCNgayThangNam2.NgayThang); ThamSoControl tsctr = new ThamSoControl(); ThamSoInfo tsinfo = new ThamSoInfo(); tsinfo = tsctr.spLayThongTinBangThamSoCoMa(1); int SLDKToiDa = tsinfo.GiaTri; if (SluongDK > SLDKToiDa) { // khong cho dang ky Label1.Text = "So Luong DK Vuot Muc cho Phep,Chon Ngay Khac Di"; return; } Label1.Text = ""; int MaNguoiLon; int MaTK = (int)Session["MaTK"]; NguoiLonControl nglonctr = new NguoiLonControl(); MaNguoiLon = nglonctr.MaBenhNhanKhiBietMaTK(MaTK); //dang ky cho tre em // lay ma nguoi lon dang online= ma nguoi lon // int MaBenhNhan = 3; BenhNhanControl ctrBN = new BenhNhanControl(); BenhNhanInfo infoBN = new BenhNhanInfo(); infoBN.Ten = txtHotenTre.Text; infoBN.NgaySinh = UCNgayThangNam1.NgayThang; infoBN.DiaChi = txtDiachi.Text; if (ckNam.Checked == true) { infoBN.Phai = "Nam"; } else { infoBN.Phai = "Nu"; } ctrBN.ThemThongTinBenhNhan(infoBN); //nhap cac thong tin //luu xuong bang benh nhan //lay ma tre em vua moi luu= ma benh nhan //lay ma nguoi lon= ma nguoi lon dang Online TreEmControl ctrTE = new TreEmControl(); TreEmInfo infoTE = new TreEmInfo(); //int MaNguoiLon = 3; infoBN = ctrBN.ThongTinBenhNhanVuaThem(); infoTE.MaBenhNhan = infoBN.Ma; infoTE.MaNguoiLon = MaNguoiLon; ctrTE.ThemTreEm(infoTE); // lb.Text = "Them Thanh Cong Benh Nhan Tre Em"; // luu xuong bang tre em //luu xuong bang Dang ky PhieuDangKyControl ctrpdk = new PhieuDangKyControl(); PhieuDangKyInfo infopdk = new PhieuDangKyInfo(); infopdk.MaBenhNhan = MaNguoiLon; infopdk.Ngay = UCNgayThangNam2.NgayThang; infopdk.TrieuChung = txtTCtreem.Text; ctrpdk.sp_ThemPhieuDangKy(infopdk); int soluong = ctrpdk.DemSLBenhNhanDKTrongNgay(infopdk.Ngay); lbsoluong.Text = soluong.ToString(); Label2.Text = "Them Thanh Cong Dang ky "; }