Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataService._ConnectionString = ConfigurationManager.ConnectionStrings["QLConnectionString"].ConnectionString;

        if ((int)Session["Login"] == 0)
        {
            Response.Redirect("~/DangNhap.aspx");
        }
        if ((string)Session["LoaiNguoiDung"] == "Bac si")
        {
            Response.Redirect("~/KhongCoChucNang.aspx");
        }
        ThamSoControl tsctr  = new ThamSoControl();
        ThamSoInfo    tsinfo = new ThamSoInfo();

        tsinfo         = tsctr.spLayThongTinBangThamSoCoMa(1);// so nguoi dang ky toi da
        lbSLNguoi.Text = tsinfo.GiaTri.ToString();
        PhieuDangKyControl pdkctr = new PhieuDangKyControl();
        //if (!IsPostBack)

        DateTime ngaytam = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
        {
            int sl = pdkctr.DemSLBenhNhanDKTrongNgay(ngaytam);
            lbSoNguoi.Text = sl.ToString();
        }
    }
Esempio n. 2
0
        //  create proc sp_LayThongTinBangThamSoCoMa @MaTS int
        public ThamSoInfo spLayThongTinBangThamSoCoMa(int MaTS)
        {
            ThamSoInfo info = new ThamSoInfo();

            dataService.Conect();

            dataService.Cmd             = new SqlCommand("sp_LayThongTinBangThamSoCoMa", dataService.Cnn);
            dataService.Cmd.CommandType = CommandType.StoredProcedure;
            dataService.Cmd.Parameters.Add("@MaTS", SqlDbType.Int);
            dataService.Cmd.Parameters["@MaTS"].Value = MaTS;
            SqlDataReader r = dataService.Cmd.ExecuteReader();

            while (r.Read())
            {
                info.GiaTri = int.Parse(r.GetValue(2).ToString());
            }



            dataService.DisConect();
            return(info);
        }
Esempio n. 3
0
    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 ";
    }