/// <summary>
        ///     hàm thực hiện việc xử lý thông tin chuyển khoa
        /// </summary>
        private void ProcessChuyenKhoa()
        {
            DataRow query = (from khoa in PDanhSachPhanBuongGiuong.AsEnumerable()
                             where
                             Utility.Int32Dbnull(khoa[NoitruPhanbuonggiuong.Columns.Id]) ==
                             Utility.Int32Dbnull(Utility.Int32Dbnull(txtPatientDept_ID.Text))
                             select khoa).FirstOrDefault();

            if (query != null)
            {
                NoitruDmucBuong objRoom =
                    NoitruDmucBuong.FetchByID(Utility.Int32Dbnull(grdBuong.GetValue(NoitruDmucBuong.Columns.IdBuong)));
                if (objRoom != null)
                {
                    query[NoitruDmucBuong.Columns.IdBuong]  = Utility.Int32Dbnull(objRoom.IdBuong, -1);
                    query[NoitruDmucBuong.Columns.TenBuong] = Utility.sDbnull(objRoom.TenBuong);
                }
                NoitruDmucGiuongbenh objBed =
                    NoitruDmucGiuongbenh.FetchByID(
                        Utility.Int32Dbnull(grdGiuong.GetValue(NoitruDmucGiuongbenh.Columns.IdGiuong)));
                if (objBed != null)
                {
                    query[NoitruDmucGiuongbenh.Columns.IdGiuong]  = Utility.Int32Dbnull(objBed.IdGiuong, -1);
                    query[NoitruDmucGiuongbenh.Columns.TenGiuong] = Utility.sDbnull(objBed.TenGiuong);
                }
                query[NoitruPhanbuonggiuong.Columns.Id] = Utility.sDbnull(txtPatientDept_ID.Text);
                query.AcceptChanges();
            }
        }
Beispiel #2
0
 void grdRoom_UpdatingCell(object sender, UpdatingCellEventArgs e)
 {
     try
     {
         if (!Utility.isValidGrid(grdRoom))
         {
             return;
         }
         if (e.InitialValue.ToString() != e.Value.ToString())
         {
             NoitruDmucBuong _obj = NoitruDmucBuong.FetchByID(Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdRoom, NoitruDmucBuong.Columns.IdBuong)));
             _obj.MaBuong   = e.Column.DataMember.ToUpper() == NoitruDmucBuong.Columns.MaBuong.ToUpper() ? e.Value.ToString() : Utility.sDbnull(Utility.GetValueFromGridColumn(grdRoom, NoitruDmucBuong.Columns.MaBuong), "");
             _obj.TenBuong  = e.Column.DataMember.ToUpper() == NoitruDmucBuong.Columns.TenBuong.ToUpper() ? e.Value.ToString() : Utility.sDbnull(Utility.GetValueFromGridColumn(grdRoom, NoitruDmucBuong.Columns.TenBuong), "");
             _obj.DonGia    = e.Column.DataMember.ToUpper() == NoitruDmucBuong.Columns.DonGia.ToUpper() ? (int)e.Value : Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdRoom, NoitruDmucBuong.Columns.DonGia), 0);
             _obj.MotaThem  = e.Column.DataMember.ToUpper() == NoitruDmucBuong.Columns.MotaThem.ToUpper() ? e.Value.ToString() : Utility.sDbnull(Utility.GetValueFromGridColumn(grdRoom, NoitruDmucBuong.Columns.MotaThem), "");
             _obj.TrangThai = e.Column.DataMember.ToUpper() == NoitruDmucBuong.Columns.TrangThai.ToUpper() ? (byte)e.Value : Utility.ByteDbnull(Utility.GetValueFromGridColumn(grdRoom, NoitruDmucBuong.Columns.TrangThai), 1);
             _obj.SttHthi   = e.Column.DataMember.ToUpper() == NoitruDmucBuong.Columns.SttHthi.ToUpper() ? (Int16)e.Value : Utility.Int16Dbnull(Utility.GetValueFromGridColumn(grdRoom, NoitruDmucBuong.Columns.SttHthi), 1);
             _obj.IsNew     = false;
             _obj.MarkOld();
             _obj.Save();
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #3
0
        private void BindData()
        {
            SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema)
                                .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaLanKham.Text);

            if (sqlQuery.GetRecordCount() > 0)
            {
                objLuotkham = sqlQuery.ExecuteSingle <KcbLuotkham>();
                if (objLuotkham != null)
                {
                    txtMaLanKham.Text = Utility.sDbnull(objLuotkham.MaLuotkham);
                    txtSoBHYT.Text    = Utility.sDbnull(objLuotkham.MatheBhyt);
                    DmucKhoaphong objDmucKhoaphong = DmucKhoaphong.FetchByID(objLuotkham.IdKhoanoitru);
                    if (objDmucKhoaphong != null)
                    {
                        txtDepartmentName.Tag  = Utility.sDbnull(objDmucKhoaphong.IdKhoaphong);
                        txtDepartment_ID.Text  = Utility.sDbnull(objDmucKhoaphong.IdKhoaphong);
                        txtDepartmentName.Text = Utility.sDbnull(objDmucKhoaphong.TenKhoaphong);
                    }

                    KcbDanhsachBenhnhan objPatientInfo = KcbDanhsachBenhnhan.FetchByID(objLuotkham.IdBenhnhan);
                    if (objPatientInfo != null)
                    {
                        txtPatient_Name.Text = Utility.sDbnull(objPatientInfo.TenBenhnhan);
                        txtPatient_ID.Text   = Utility.sDbnull(objLuotkham.IdBenhnhan);
                        txtNamSinh.Text      = Utility.sDbnull(objPatientInfo.NamSinh);
                        txtTuoi.Text         = Utility.sDbnull(DateTime.Now.Year - objPatientInfo.NamSinh);
                        txtPatientSex.Text   = objPatientInfo.GioiTinh;// Utility.Int32Dbnull(objPatientInfo.PatientSex) == 0 ? "Nam" : "Nữ";
                    }
                    objPhanbuonggiuong = NoitruPhanbuonggiuong.FetchByID(objLuotkham.IdRavien);
                    dtNgayvao.Value    = objPhanbuonggiuong.NgayVaokhoa;
                    if (objPhanbuonggiuong != null)
                    {
                        txtPatientDept_ID.Text = Utility.sDbnull(objPhanbuonggiuong.Id);
                        NoitruDmucBuong objRoom = NoitruDmucBuong.FetchByID(objPhanbuonggiuong.IdBuong);
                        if (objRoom != null)
                        {
                            txtSoPhong.Text = Utility.sDbnull(objRoom.TenBuong);
                            txtSoPhong.Tag  = Utility.sDbnull(objPhanbuonggiuong.IdBuong);
                        }
                        NoitruDmucGiuongbenh objNoitruDmucGiuongbenh = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong);
                        if (objNoitruDmucGiuongbenh != null)
                        {
                            txtSoGiuong.Text = Utility.sDbnull(objNoitruDmucGiuongbenh.TenGiuong);
                            txtSoGiuong.Tag  = Utility.sDbnull(objPhanbuonggiuong.IdGiuong);
                        }
                    }
                }
            }
            ModifyCommand();
        }
Beispiel #4
0
        private void cmdSua_Click(object sender, EventArgs e)
        {
            int             idphong = Utility.Int32Dbnull(grdRoom.GetValue(NoitruDmucBuong.Columns.IdBuong));
            NoitruDmucBuong objRoom = NoitruDmucBuong.FetchByID(idphong);

            if (objRoom != null)
            {
                var frm = new frm_Add_PhongNoiTru();
                frm.objRoom       = objRoom;
                frm.m_enAct       = action.Update;
                frm.p_dtDataPhong = globalVariables.gv_PhongNoitru;
                frm.grdList       = grdRoom;
                frm.MyGetData     = new frm_Add_PhongNoiTru.timkiem(LoadData);
                frm.ShowDialog();
            }
            ModifyCommand();
        }
        private void BindData()
        {
            SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema)
                                .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaLanKham.Text);

            if (sqlQuery.GetRecordCount() > 0)
            {
                objLuotkham = sqlQuery.ExecuteSingle <KcbLuotkham>();
                if (objLuotkham != null)
                {
                    txtMaLanKham.Text = Utility.sDbnull(objLuotkham.MaLuotkham);
                    txtSoBHYT.Text    = Utility.sDbnull(objLuotkham.MatheBhyt);
                    DmucKhoaphong objLDepartment = DmucKhoaphong.FetchByID(objLuotkham.IdKhoanoitru);
                    if (objLDepartment != null)
                    {
                        txtDepartment_ID.Text  = Utility.sDbnull(objLDepartment.IdKhoaphong);
                        txtDepartmentName.Tag  = Utility.sDbnull(objLDepartment.IdKhoaphong);
                        txtDepartmentName.Text = Utility.sDbnull(objLDepartment.TenKhoaphong);
                    }
                    KcbDanhsachBenhnhan objPatientInfo = KcbDanhsachBenhnhan.FetchByID(objLuotkham.IdBenhnhan);
                    if (objPatientInfo != null)
                    {
                        txtPatient_Name.Text = Utility.sDbnull(objPatientInfo.TenBenhnhan);
                        txtPatient_ID.Text   = Utility.sDbnull(objLuotkham.IdBenhnhan);
                        txtNamSinh.Text      = Utility.sDbnull(objPatientInfo.NamSinh);
                        txtTuoi.Text         = Utility.sDbnull(DateTime.Now.Year - objPatientInfo.NamSinh);
                        txtPatientSex.Text   = objPatientInfo.GioiTinh;                                        // Utility.Int32Dbnull(objPatientInfo.) == 0 ? "Nam" : "Nữ";
                    }
                    NoitruPhanbuonggiuong objPhanbuonggiuong = NoitruPhanbuonggiuong.FetchByID(IDBuonggiuong); // noitru_nhapvien.LaythongtinBuonggiuongHtai(objLuotkham);
                    if (objPhanbuonggiuong != null)
                    {
                        dtNgayvao.Value        = objPhanbuonggiuong.NgayVaokhoa;
                        txtPatientDept_ID.Text = Utility.sDbnull(objPhanbuonggiuong.Id);
                        NoitruDmucBuong objRoom = NoitruDmucBuong.FetchByID(objPhanbuonggiuong.IdBuong);
                        if (objRoom != null)
                        {
                            txtSoPhong.Text = Utility.sDbnull(objRoom.TenBuong);
                            txtSoPhong.Tag  = Utility.sDbnull(objPhanbuonggiuong.IdBuong);
                        }
                        NoitruDmucGiuongbenh objNoitruDmucGiuongbenh = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong);
                        if (objNoitruDmucGiuongbenh != null)
                        {
                            txtSoGiuong.Text = Utility.sDbnull(objNoitruDmucGiuongbenh.TenGiuong);
                            txtSoGiuong.Tag  = Utility.sDbnull(objPhanbuonggiuong.IdGiuong);
                        }
                    }

                    DataTable dtGia = new dmucgiagiuong_busrule().dsGetList("-1").Tables[0];
                    dtGia.DefaultView.Sort = NoitruGiabuonggiuong.Columns.SttHthi + "," + NoitruGiabuonggiuong.Columns.TenGia;
                    txtGia.Init(dtGia,
                                new List <string>()
                    {
                        NoitruGiabuonggiuong.Columns.IdGia,
                        NoitruGiabuonggiuong.Columns.MaGia,
                        NoitruGiabuonggiuong.Columns.TenGia
                    });
                    cboGia.DataSource    = dtGia;
                    cboGia.DataMember    = NoitruGiabuonggiuong.Columns.IdGia;
                    cboGia.ValueMember   = NoitruGiabuonggiuong.Columns.IdGia;
                    cboGia.DisplayMember = NoitruGiabuonggiuong.Columns.TenGia;

                    m_dtDataRoom = THU_VIEN_CHUNG.NoitruTimkiembuongTheokhoa(Utility.Int32Dbnull(txtDepartment_ID.Text));
                    Utility.SetDataSourceForDataGridEx_Basic(grdBuong, m_dtDataRoom, true, true, "1=1", "sluong_giuong_trong desc,ten_buong");
                    txtRoom_code.Init(m_dtDataRoom, new List <string>()
                    {
                        NoitruDmucBuong.Columns.IdBuong, NoitruDmucBuong.Columns.MaBuong, NoitruDmucBuong.Columns.TenBuong
                    });
                    if (grdBuong.DataSource != null)
                    {
                        grdBuong.MoveFirst();
                    }
                }
                else
                {
                    string tempt = txtMaLanKham.Text;
                    ClearControl();
                    if (m_dtDataRoom != null)
                    {
                        m_dtDataRoom.Clear();
                    }
                    if (m_dtDatabed != null)
                    {
                        m_dtDataRoom.Clear();
                    }
                    txtMaLanKham.Text = tempt;
                    txtMaLanKham.SelectAll();
                    txtMaLanKham.Focus();
                }
            }
        }