/// <summary>
        /// 
        /// </summary>
        /// <param name="dauphancach"></param>
        /// <returns></returns>
        public static string LAYDSACH_IDKHOTHUOC_CHAN(string dauphancach)
        {
            DataTable m_dtKhoThuoc = new DataTable();
              SqlQuery sqlQuery = new Select().From(TDmucKho.Schema);
              if (!globalVariables.IsAdmin)
              {
              sqlQuery.Where(TDmucKho.Columns.IdKho).In(new Select(QheNhanvienKho.Columns.IdKho)
                                                        .From(QheNhanvienKho.Schema).Where(QheNhanvienKho.Columns.IdNhanvien)
                                                        .IsEqualTo(globalVariables.gv_intIDNhanvien));

              }
              if (sqlQuery.HasWhere)
              sqlQuery.And(TDmucKho.Columns.KieuKho).In(lstKhochan);
              else
              {
              sqlQuery.Where(TDmucKho.Columns.KieuKho).In(lstKhochan);
              }
              sqlQuery.And(TDmucKho.Columns.KhoThuocVt).In(lstKhoThuoc);
              sqlQuery.And(TDmucKho.Columns.LaTuthuoc).IsEqualTo(0);
              sqlQuery.And(TDmucKho.Columns.LoaiKho).IsEqualTo(0);
              sqlQuery.OrderAsc(TDmucKho.Columns.SttHthi);
              m_dtKhoThuoc = sqlQuery.ExecuteDataSet().Tables[0];
              if (m_dtKhoThuoc.Rows.Count <= 0) return "";
              return string.Join(dauphancach, m_dtKhoThuoc.AsEnumerable().Select(c => c.Field<string>(TDmucKho.Columns.IdKho)).ToList<string>().ToArray());
        }
Example #2
0
 /// <summary>
 /// hàm thực hiện việc lấy thôgn tin của phường xã
 /// </summary>
 /// <param name="MaQuanHuyen"></param>
 /// <returns></returns>
 public static DataTable LayThongTinPhuongXa(string MaQuanHuyen)
 {
     SqlQuery sqlQuery = new Select().From(DDviDchinh.Schema)
         .Where(DDviDchinh.Columns.LoaiDviDchinh).IsEqualTo("PX").And(DDviDchinh.Columns.MaCha).IsEqualTo(MaQuanHuyen)
         .OrderAsc(DDviDchinh.Columns.SttHthi);
     return sqlQuery.ExecuteDataSet().Tables[0];
 }
 private static DataTable GetTestListByTestTypeId(string pTestTypeId)
 {
     var testListByTestTypeId =
         new Select().From(LStandardTest.Schema.Name).Where(LStandardTest.Columns.TestTypeId).IsEqualTo(
             pTestTypeId).OrderAsc(LStandardTest.Columns.DataSequence).ExecuteDataSet().Tables[0];
     return testListByTestTypeId;
 }
Example #4
0
        //ham nay se thuc hien lay thong tin tren server ve
        public cls_SignInfor(string sv_sBieuMau, string sv_sDonVi, DataTable ReportSourceTable)
        {
            exists = true;
            SqlCommand cmdNguoiKy = new SqlCommand();
            string strSQL = "Select * from tbl_Trinhky Where ReportName = N'" + sv_sBieuMau + "'";
            DataTable dtbNguoiKy = new DataTable();
            try
            {

                    dtbNguoiKy =new Select().From("tbl_Trinhky").Where("ReportName").IsEqualTo(sv_sBieuMau)
                            .ExecuteDataSet().Tables[0];

                if (dtbNguoiKy.Rows.Count > 0) exists = true;

            }
            catch (Exception ex)
            {
                exists = false;
            }
            if (exists == false) return;

            try
            {
                if (dtbNguoiKy.Rows.Count > 0)
                {
                    //gan cac thong tin co duoc vao bien
                    mv_TEN_BIEUBC = (string)dtbNguoiKy.Rows[0]["ReportName"];
                    try
                    {
                        mv_TEN_DOITUONG = (string)dtbNguoiKy.Rows[0]["ObjectName"];
                    }
                    catch (Exception ex)
                    {
                        mv_TEN_DOITUONG = " ";
                    }

                    mv_FONT_CHU = (string)dtbNguoiKy.Rows[0]["Font_Name"];
                    mv_CO_CHU = (int)dtbNguoiKy.Rows[0]["Font_Size"];
                    mv_KIEU_CHU = (string)dtbNguoiKy.Rows[0]["Font_Stype"];
                    try
                    {

                        mv_NOI_DUNG = (string)dtbNguoiKy.Rows[0]["ObjectContent"];

                    }
                    catch (Exception ex)
                    {
                        mv_NOI_DUNG = " ";
                    }
                }
                else
                {
                    exists = false;
                }
            }
            catch (Exception ex)
            {
                exists = false;
            }
        }
        private void cmdSave_Click(object sender, EventArgs e)
        {
            SqlQuery q = new Select().From(SysUserPrinter.Schema)
                .Where(SysUserPrinter.Columns.SysUserName).IsEqualTo(globalVariables.UserName);
            if(q.GetRecordCount()<=0)
            {
                new SysUserPrinterController().Insert(globalVariables.UserName, txtQuantity.Value,
                                                      Utility.sDbnull(cboListPrint.Text, ""), txtKetoan.Text,
                                                      txtLapBangKe.Text, txtGiamdinhbaohiem.Text,
                                                      txtDaidienkhamchuabenh.Text);

            }else
            {
                new Update(SysUserPrinter.Schema)
                    .Set(SysUserPrinter.Columns.PrinterName).EqualTo(cboListPrint.Text)
                    .Set(SysUserPrinter.Columns.CreatedBy).EqualTo(txtLapBangKe.Text)
                    .Set(SysUserPrinter.Columns.AccountName).EqualTo(txtKetoan.Text)
                    .Set(SysUserPrinter.Columns.InsuranceBy).EqualTo(txtGiamdinhbaohiem.Text)
                    .Set(SysUserPrinter.Columns.HospitalBy).EqualTo(txtDaidienkhamchuabenh.Text)
                    .Set(SysUserPrinter.Columns.PagerCopy).EqualTo(Utility.Int32Dbnull(txtQuantity.Text, 1))
                    .Where(SysUserPrinter.Columns.SysUserName).IsEqualTo(globalVariables.UserName).Execute();
            }
            Utility.ShowMsg("Bạn cập nhập thông tin thành công","Thông báo");
            this.Close();
        }
Example #6
0
        public TPhieuXuatthuocBenhnhan CreatePhieuXuatBenhNhan(KcbDonthuoc objDonthuoc)
        {
            KcbDanhsachBenhnhan objBenhnhan = KcbDanhsachBenhnhan.FetchByID(objDonthuoc.IdBenhnhan);
            KcbLuotkham objLuotkham = new Select().From(KcbLuotkham.Schema)
                .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objDonthuoc.MaLuotkham)
                .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objDonthuoc.IdBenhnhan).ExecuteSingle<KcbLuotkham>();

            TPhieuXuatthuocBenhnhan objPhieuXuatBnhan = new TPhieuXuatthuocBenhnhan();
            objPhieuXuatBnhan.NgayXacnhan =  globalVariables.SysDate;
            objPhieuXuatBnhan.IdPhongChidinh = Utility.Int16Dbnull(objDonthuoc.IdPhongkham);
            objPhieuXuatBnhan.IdKhoaChidinh = Utility.Int16Dbnull(objDonthuoc.IdKhoadieutri);
            objPhieuXuatBnhan.IdBacsiKedon = Utility.Int16Dbnull(objDonthuoc.IdBacsiChidinh);
            objPhieuXuatBnhan.IdDonthuoc = Utility.Int32Dbnull(objDonthuoc.IdDonthuoc);
            objPhieuXuatBnhan.IdNhanvien = globalVariables.gv_intIDNhanvien;
            //objPhieuXuatBnhan.HienThi = 1;
            objPhieuXuatBnhan.ChanDoan = Utility.sDbnull(objLuotkham.ChanDoan);
            objPhieuXuatBnhan.MabenhChinh = Utility.sDbnull(objLuotkham.MabenhChinh);
            objPhieuXuatBnhan.IdDoituongKcb = Utility.Int16Dbnull(objLuotkham.IdDoituongKcb);
            objPhieuXuatBnhan.MaDoituongKcb = objLuotkham.MaDoituongKcb;
            objPhieuXuatBnhan.GioiTinh = objBenhnhan.GioiTinh;
            objPhieuXuatBnhan.TenBenhnhan = Utility.sDbnull(objBenhnhan.TenBenhnhan);
            objPhieuXuatBnhan.TenKhongdau = Utility.sDbnull(Utility.UnSignedCharacter(objBenhnhan.TenBenhnhan));
            objPhieuXuatBnhan.DiaChi = Utility.sDbnull(objBenhnhan.DiaChi);
            objPhieuXuatBnhan.NamSinh = Utility.Int32Dbnull(objBenhnhan.NamSinh);
            objPhieuXuatBnhan.MatheBhyt = Utility.sDbnull(objLuotkham.MatheBhyt);
            objPhieuXuatBnhan.NgayKedon = objDonthuoc.NgayKedon;
            objPhieuXuatBnhan.NgayTao = globalVariables.SysDate;
            objPhieuXuatBnhan.NguoiTao = globalVariables.UserName;
            objPhieuXuatBnhan.Noitru = objDonthuoc.Noitru;
            objPhieuXuatBnhan.LoaiPhieu = (byte?)LoaiPhieu.PhieuXuatKhoBenhNhan;
            return objPhieuXuatBnhan;
        }
Example #7
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            SqlQuery sqlQuery = new Select().From(SysManagementUnit.Schema)
                .Where(SysManagementUnit.Columns.PkSBranchID).IsEqualTo("LIS");

            if (sqlQuery.GetRecordCount() <= 0)
            {
                //LDonVi.Insert("LIS", txtDonViCapTren.Text, txtDonVi.Text, txtDiaChi.Text, txtDienThoai.Text);
                SysManagementUnit objSysManagementUnit = new SysManagementUnit();
                objSysManagementUnit.PkSBranchID = "LIS";
                objSysManagementUnit.SName = txtDonVi.Text;
                objSysManagementUnit.SParentBranchName = txtDonViCapTren.Text;
                objSysManagementUnit.SAddress = txtDiaChi.Text;
                objSysManagementUnit.SPhone = txtDienThoai.Text;
                objSysManagementUnit.IsNew = true;
                objSysManagementUnit.Save();
            }
            else
            {

                SysManagementUnit objSysManagementUnit = new SysManagementUnit();
                objSysManagementUnit.MarkOld();
                objSysManagementUnit.IsLoaded = true;
                objSysManagementUnit.PkSBranchID = "LIS";
                objSysManagementUnit.SName = txtDonVi.Text;
                objSysManagementUnit.SParentBranchName = txtDonViCapTren.Text;
                objSysManagementUnit.SAddress = txtDiaChi.Text;
                objSysManagementUnit.SPhone = txtDienThoai.Text;
               // objSysManagementUnit.IsNew = true;
                objSysManagementUnit.Save();
            }
            Utility.ShowMsg("Bạn thực hiện lưu thành công","Thông báo");
        }
Example #8
0
 public static DataTable GetStaffListbyDepartmentId(int departmentId)
 {
     DataTable dataTable = new DataTable();
     SqlQuery sqlQuery = new Select().From(DmucNhanvien.Schema)
         .Where(DmucNhanvien.Columns.IdKhoa).IsEqualTo(departmentId);
     dataTable = sqlQuery.ExecuteDataSet().Tables[0];
     return dataTable;
 }
Example #9
0
 public bool CheckExistUserPass(string UserName,string Password)
 {
     SqlQuery sqlQuery = new Select().From(SysUser.Schema)
     .Where(SysUser.Columns.PkSuid).IsEqualTo(globalVariables.UserName)
     .And(SysUser.Columns.SPwd).IsEqualTo(objEncrypt.Mahoa(Password));
        if (sqlQuery.GetRecordCount() <= 0) return false;
        else return true;
 }
Example #10
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 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 = 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 System.Collections.Generic.List<string>() { NoitruGiabuonggiuong.Columns.IdGia, NoitruGiabuonggiuong.Columns.MaGia, 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");
                    if (grdBuong.DataSource != null)
                    {
                        grdBuong.MoveFirst();
                    }
                }
            }
        }
        public void Select_ColumnList_Specified()
        {
            SubSonic.SqlQuery qry = new Select("productid", "productname").From(Product.Schema);
            ANSISqlGenerator gen = new ANSISqlGenerator(qry);

            string selectList = gen.GenerateCommandLine();

            Assert.AreEqual("SELECT [dbo].[Products].[ProductID], [dbo].[Products].[ProductName]\r\n", selectList);
        }
Example #12
0
       /// <summary>
       /// hàm thực hiện lấy thông tin của thành phố
       /// </summary>
       /// <returns></returns>
       public static DataTable  LayThongTinThanhPho()
       {
           DataTable dataTable =

               new Select().From(DDviDchinh.Schema).Where(DDviDchinh.Columns.LoaiDviDchinh).IsEqualTo("TP").OrderAsc(
                   DDviDchinh.Columns.SttHthi).ExecuteDataSet().Tables[0];

           return dataTable;
       }
Example #13
0
 public static NoitruPhanbuonggiuong LaythongtinBuonggiuongHtai(KcbLuotkham objPatientExam)
 {
     NoitruPhanbuonggiuong objPhanbuonggiuong = new Select().From(NoitruPhanbuonggiuong.Schema)
         .Where(NoitruPhanbuonggiuong.Columns.MaLuotkham).IsEqualTo(objPatientExam.MaLuotkham)
         .And(NoitruPhanbuonggiuong.Columns.IdBenhnhan).IsEqualTo(objPatientExam.IdBenhnhan)
         .And(NoitruPhanbuonggiuong.Columns.NoiTru).IsEqualTo(1)
         .And(NoitruPhanbuonggiuong.Columns.TrangThai).IsEqualTo(0).ExecuteSingle<NoitruPhanbuonggiuong>();
     return objPhanbuonggiuong;
 }
 private void IntitalData()
 {
     SqlQuery sqlQuery = new Select().From(LObjectType.Schema).OrderAsc(LObjectType.Columns.SName);
     sqlQuery = new Select().From(TTestTypeList.Schema).Where(TTestTypeList.Columns.TestTypeId).IsEqualTo(2).Or(TTestTypeList.Columns.TestTypeId).IsEqualTo(5).OrderAsc(TTestTypeList.Columns.IntOrder);
     //DataBinding.BindDataCombox(cboLoaiXetnghiem, sqlQuery.ExecuteDataSet().Tables[0], TTestTypeList.Columns.TestTypeId,
     //                          TTestTypeList.Columns.TestTypeName);
     DataBinding.BindDataCombobox(cboLoaiXetnghiem, sqlQuery.ExecuteDataSet().Tables[0], TTestTypeList.Columns.TestTypeId,
                               TTestTypeList.Columns.TestTypeName);
 }
Example #15
0
        public void Acc_ExecuteJoinedDataSet_Should_Accept_Parameters()
        {
            int someProduct = 1;
            SubSonic.SqlQuery sq = new Select()
                 .From(Product.Schema)
                 .Where(Product.ProductIDColumn).IsEqualTo(someProduct);

            DataSet ds = sq.ExecuteJoinedDataSet();
            Assert.AreEqual(1, ds.Tables[0].Rows.Count);
        }
Example #16
0
        /// <summary>
        /// hàm thực hêện tìm kiếm thông tin 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdSearch_Click(object sender, EventArgs e)
        {
            SqlQuery sqlQuery = new Select().From(RISLink.DataAccessLayer.ErrorLog.Schema)
                .Where(RISLink.DataAccessLayer.ErrorLog.Columns.ErrorCode).IsEqualTo(cboKieu.SelectedValue)
                .And(RISLink.DataAccessLayer.ErrorLog.Columns.ErrorTime).IsBetweenAnd(dtFromDate.Value.Date,
                                                                                      dtToDate.Value.Date);
            m_dtErrorLog = sqlQuery.ExecuteDataSet().Tables[0];
            grdLogError.DataSource = m_dtErrorLog;

        }
 public void SetUp()
 {
     e = new Employee();
     d = new Department();
     ep = new EmployeeProject();
     p = new Project();
     q = null;
     results = null;
     currentRowIndex = 0;
 }
 private bool CheckValidData()
 {
     SysReport obj = null;
     if (string.IsNullOrEmpty(txtMa.Text))
     {
         Utility.ShowMsg("Chưa nhập mã báo cáo", "Thông báo", MessageBoxIcon.Information);
         txtMa.Focus();
         txtMa.SelectAll();
         return false;
     }
     if (string.IsNullOrEmpty(txtTieude.Text))
     {
         Utility.ShowMsg("Chưa nhập tiêu đề báo cáo", "Thông báo", MessageBoxIcon.Information);
         txtTieude.Focus();
         txtTieude.SelectAll();
         return false;
     }
     if (cboNhom.Items.Count<=0)
     {
         Utility.ShowMsg("Chưa khởi tạo danh mục nhóm báo cáo", "Thông báo", MessageBoxIcon.Information);
         cboNhom.Focus();
         return false;
     }
     if (txtTenFileMacDinh.Text.Trim() == "")
     {
         Utility.ShowMsg("Chưa nhập tên file chuẩn", "Thông báo", MessageBoxIcon.Information);
         txtTenFileMacDinh.Focus();
         txtMa.SelectAll();
         return false;
     }
     if (objReport.IsNew)
     {
         obj = new SysReportController().FetchByID(txtMa.Text).FirstOrDefault();
         if (obj != null)
         {
             Utility.ShowMsg("Mã báo cáo đã tồn tại. Chọn mã khác", "Thông báo", MessageBoxIcon.Information);
             txtMa.Focus();
             txtMa.SelectAll();
             return false;
         }
     }
     else
     {
         obj = new Select().From(SysReport.Schema).Where(SysReport.Columns.MaBaocao).IsEqualTo(Utility.DoTrim(txtMa.Text))
             .And(SysReport.Columns.MaBaocao).IsNotEqualTo(objReport.MaBaocao).ExecuteSingle<SysReport>();
         if (obj != null)
         {
             Utility.ShowMsg("Mã báo cáo đã tồn tại. Chọn mã khác", "Thông báo", MessageBoxIcon.Information);
             txtMa.Focus();
             txtMa.SelectAll();
             return false;
         }
     }
     return true;
 }
Example #19
0
        public static DataTable LayDulieuDanhmucChung(List<string> lstLoai)
        {
            DataTable m_NN = new DataTable();

            m_NN =
                new Select(DmucChung.Columns.Ma, DmucChung.Columns.Ten, DmucChung.Columns.Loai).From(DmucChung.Schema)
                    .Where(DmucChung.Columns.Loai).In(lstLoai)
                    .OrderAsc(DmucChung.Columns.SttHthi)
                    .ExecuteDataSet().Tables[0];
            return m_NN;
        }
        private void AutocompleteLoaithuoc()
        {
            DataTable dtLoaithuoc = null;
            try
            {
                dtLoaithuoc =
             new Select().From(DmucLoaithuoc.Schema).Where(DmucLoaithuoc.KieuThuocvattuColumn).IsEqualTo(KIEU_THUOC_VT).ExecuteDataSet().Tables[0];

                if (dtLoaithuoc == null) return;
                if (!dtLoaithuoc.Columns.Contains("ShortCut"))
                    dtLoaithuoc.Columns.Add(new DataColumn("ShortCut", typeof(string)));
                foreach (DataRow dr in dtLoaithuoc.Rows)
                {
                    string shortcut = "";
                    string realName = dr[DmucLoaithuoc.TenLoaithuocColumn.ColumnName].ToString().Trim() + " " +
                                      Utility.Bodau(dr[DmucLoaithuoc.TenLoaithuocColumn.ColumnName].ToString().Trim());
                    shortcut = dr[DmucLoaithuoc.MaLoaithuocColumn.ColumnName].ToString().Trim();
                    string[] arrWords = realName.ToLower().Split(' ');
                    string _space = "";
                    string _Nospace = "";
                    foreach (string word in arrWords)
                    {
                        if (word.Trim() != "")
                        {
                            _space += word + " ";
                            //_Nospace += word;
                        }
                    }
                    shortcut += _space; // +_Nospace;
                    foreach (string word in arrWords)
                    {
                        if (word.Trim() != "")
                            shortcut += word.Substring(0, 1);
                    }
                    dr["ShortCut"] = shortcut;
                }
            }
            catch
            {
            }
            finally
            {
                var source = new List<string>();
                var query = from p in dtLoaithuoc.AsEnumerable()
                            select p[DmucLoaithuoc.IdLoaithuocColumn.ColumnName].ToString() + "#" + p[DmucLoaithuoc.MaLoaithuocColumn.ColumnName].ToString()
                            + "@" + p[DmucLoaithuoc.TenLoaithuocColumn.ColumnName].ToString() + "@" + p.Field<string>("shortcut").ToString();
                source = query.ToList();
                this.txtLoaithuoc.AutoCompleteList = source;
                this.txtLoaithuoc.TextAlign = HorizontalAlignment.Left;
                this.txtLoaithuoc.CaseSensitive = false;
                this.txtLoaithuoc.MinTypedCharacters = 1;

            }
        }
 private void cboKhoaNoiTru_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (bHasloaded)
     {
         SqlQuery sqlQuery = new Select().From(NoitruDmucBuong.Schema)
             .Where(NoitruDmucBuong.Columns.IdKhoanoitru).IsEqualTo(Utility.Int32Dbnull(cboKhoaNoiTru.SelectedValue));
         DataBinding.BindDataCombobox(cboPhongNoiTru, sqlQuery.ExecuteDataSet().Tables[0], NoitruDmucBuong.Columns.IdBuong,
                                    NoitruDmucBuong.Columns.TenBuong, "Chọn phòng nội trú",true);
         // IntialDataControl();
     }
 }
 public static void CreateManagementUnit()
 {
     SqlQuery q = new Select().From(SysManagementUnit.Schema);
     var objManagementUnit = q.ExecuteSingle<SysManagementUnit>();
     if (objManagementUnit != null)
     {
         globalVariables.ParentBranch_Name = objManagementUnit.SParentBranchName;
         globalVariables.Branch_Name = objManagementUnit.SName;
         globalVariables.Branch_Phone = objManagementUnit.SPhone;
         globalVariables.Branch_Address = objManagementUnit.SAddress;
     }
 }
Example #23
0
        /// <summary>
        /// hàm thực hiện việc xác nhận thông tin 
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <returns></returns>
        public ActionResult HuyXacNhanPhieuNhapKho(TPhieuNhapxuatthuoc objPhieuNhap, ref string errMsg)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu);
                        TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection =
                            sqlQuery.ExecuteAsCollection<TPhieuNhapxuatthuocChitietCollection>();

                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection)
                        {

                            ActionResult _Kiemtrathuochuyxacnhan = Kiemtrathuochuyxacnhan(objPhieuNhap, objPhieuNhapCt);
                            if (_Kiemtrathuochuyxacnhan != ActionResult.Success) return _Kiemtrathuochuyxacnhan;
                            //Xóa toàn bộ chi tiết trong TBiendongThuoc
                            new Delete().From(TBiendongThuoc.Schema)
                                .Where(TBiendongThuoc.IdPhieuColumn).IsEqualTo(objPhieuNhap.IdPhieu)
                                .And(TBiendongThuoc.IdPhieuChitietColumn).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet)
                                   .And(TBiendongThuoc.MaLoaiphieuColumn).IsEqualTo(objPhieuNhap.LoaiPhieu).Execute();

                            new Update(TPhieuNhapxuatthuocChitiet.Schema).Set(TPhieuNhapxuatthuocChitiet.Columns.IdThuockho).EqualTo(-1)
                                .Set(TPhieuNhapxuatthuocChitiet.Columns.NgayNhap).EqualTo(null)
                               .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieuchitiet).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet).Execute();

                            StoredProcedure sp = SPs.ThuocXuatkho(objPhieuNhap.IdKhonhap,objPhieuNhapCt.IdThuoc, objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan,
                                                                       Utility.DecimaltoDbnull(objPhieuNhap.Vat), objPhieuNhapCt.SoLuong,objPhieuNhapCt.IdThuockho,objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo,
                                                                       0, errMsg);

                            sp.Execute();
                        }

                        new Update(TPhieuNhapxuatthuoc.Schema)
                            .Set(TPhieuNhapxuatthuoc.Columns.IdNhanvien).EqualTo(-1)
                            .Set(TPhieuNhapxuatthuoc.Columns.NguoiXacnhan).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.NgayXacnhan).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.TrangThai).EqualTo(0)
                            .Where(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu).Execute();
                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception ex)
            {
                Utility.CatchException("Lỗi khi hủy xác nhận nhập kho", ex);
                return ActionResult.Error;

            }
        }
        private void cmdDeleteALL_Click(object sender, EventArgs e)
        {
            try
            {
                Janus.Windows.GridEX.GridEXRow[] checkedRows;
                checkedRows = grdList.GetCheckedRows();
                if (checkedRows.Length == 0)
                {

                    Utility.ShowMsg("Bạn phải chọn một bản ghi thao tác", "Thông báo");
                    grdList.Focus();
                    return;
                }
                string lstError = "";
                if (grdList.CurrentRow != null)
                {
                    string message = string.Format("Bạn có muốn xoá {0} bản ghi đang chọn không", checkedRows.Length);
                    if (Utility.AcceptQuestion(message, "Thông báo", true))
                    {
                        foreach (Janus.Windows.GridEX.GridEXRow row in checkedRows)
                        {
                            int iddichvu = Utility.Int32Dbnull(row.Cells[DmucDichvucl.Columns.IdDichvu].Value, 0);
                            DmucDichvuclsChitiet item = new Select().From(DmucDichvuclsChitiet.Schema).Where(DmucDichvuclsChitiet.Columns.IdDichvu).IsEqualTo(iddichvu).ExecuteSingle<DmucDichvuclsChitiet>();
                            if (item != null)
                            {
                                lstError =lstError+ Utility.sDbnull(row.Cells[DmucDichvucl.Columns.TenDichvu].Value, "")+";";
                            }
                            else
                            {
                            ((DataRowView)row.DataRow).Delete();

                            new Delete()
                                .From(DmucDichvucl.Schema)
                                .Where(DmucDichvucl.Columns.IdDichvu)
                                .IsEqualTo(iddichvu)
                                .Execute();
                            }
                        }
                        if (Utility.DoTrim(lstError) != "")
                        {
                            Utility.ShowMsg("Một số dịch vụ chi tiết sau đã có chi tiết nên bạn không thể xóa\n" + lstError);
                        }
                    }
                }
            }
            catch
            {
            }
            finally
            {
                ModifyCommand();
            }
        }
Example #25
0
 /// <summary>
 /// hàm thực hiện việc lấy màu của hệ thống
 /// </summary>
 /// <returns></returns>
 public static string GetSysColor()
 {
     SqlQuery q = new Select().From(SysFormColor.Schema)
        .Where(SysFormColor.Columns.SystemColorId).IsEqualTo(1);
     string SysColor = "";
     SysFormColor objSystemParameter = q.ExecuteSingle<SysFormColor>();
     if (objSystemParameter != null)
     {
         SysColor = Utility.sDbnull(objSystemParameter.ColorValue);
     }
     return SysColor;
 }
Example #26
0
 public DmucKieudmuc GetKieuDanhMuc(string MaLoai)
 {
     try
     {
         DmucKieudmuc v_obj = new Select().From(DmucKieudmuc.Schema.TableName).Where(DmucKieudmuc.Columns.MaLoai).IsEqualTo(MaLoai).ExecuteSingle<DmucKieudmuc>();
         return v_obj;
     }
     catch
     {
         return null;
     }
 }
Example #27
0
        public ActionResult HuyXacNhanPhieuHuy_thanhly_Thuoc(TPhieuNhapxuatthuoc objPhieuNhap, ref string errMsg)
        {
            HisDuocProperties objHisDuocProperties = PropertyLib._HisDuocProperties;
            string errorMessage = "";
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu);
                        TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection =
                            sqlQuery.ExecuteAsCollection<TPhieuNhapxuatthuocChitietCollection>();

                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection)
                        {
                            long idthuockho = -1;
                            //Nhập lại kho thanh lý
                            StoredProcedure sp = SPs.ThuocNhapkhoOutput(objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan,
                                                                      objPhieuNhapCt.SoLuong, Utility.DecimaltoDbnull(objPhieuNhapCt.Vat),
                                                                      objPhieuNhapCt.IdThuoc, objPhieuNhap.IdKhoxuat, objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo,
                                                                      objPhieuNhapCt.SoDky, objPhieuNhapCt.SoQdinhthau, idthuockho, idthuockho, objPhieuNhapCt.NgayNhap, objPhieuNhapCt.GiaBhyt, objPhieuNhapCt.GiaPhuthuDungtuyen, objPhieuNhapCt.GiaPhuthuTraituyen, objPhieuNhapCt.KieuThuocvattu);
                            sp.Execute();
                            idthuockho = Utility.Int64Dbnull(sp.OutputValues[0], -1);
                            if (idthuockho != objPhieuNhapCt.IdThuockho)//Nếu ai đó xóa bằng tay trong bảng thuốc kho thì cần update lại
                                new Update(TPhieuNhapxuatthuocChitiet.Schema).Set(TPhieuNhapxuatthuocChitiet.Columns.IdThuockho).EqualTo(idthuockho)
                                    .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieuchitiet).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet).Execute();
                        }
                        //Xóa toàn bộ chi tiết trong TBiendongThuoc
                        new Delete().From(TBiendongThuoc.Schema)
                            .Where(TBiendongThuoc.IdPhieuColumn).IsEqualTo(objPhieuNhap.IdPhieu)
                            .And(TBiendongThuoc.MaLoaiphieuColumn).IsEqualTo(objPhieuNhap.LoaiPhieu).Execute();
                        new Update(TPhieuNhapxuatthuoc.Schema)
                            .Set(TPhieuNhapxuatthuoc.Columns.NguoiSua).EqualTo(globalVariables.UserName)
                            .Set(TPhieuNhapxuatthuoc.Columns.NgaySua).EqualTo(globalVariables.SysDate)
                            .Set(TPhieuNhapxuatthuoc.Columns.NguoiXacnhan).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.NgayXacnhan).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.TrangThai).EqualTo(0)
                            .Where(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu)
                            .And(TPhieuNhapxuatthuoc.LoaiPhieuColumn).IsEqualTo(objPhieuNhap.LoaiPhieu).Execute();
                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception ex)
            {
                Utility.CatchException("Lỗi khi hủy xác nhận phiếu ",ex);
                return ActionResult.Error;
            }
        }
Example #28
0
        public ActionResult AddNewPatientExam(KcbDanhsachBenhnhan objPatientInfo, KcbLuotkham objLuotkham, KcbDangkyKcb objRegExam, int KieuKham)
        {
            try
            {
                using (var scope = new TransactionScope())
                {
                    using (var dbscope = new SharedDbConnectionScope())
                    {
                        UpdatePatientInfo(objPatientInfo);
                        SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema)
                           .Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan)
                           .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham);
                        if (sqlQueryPatientExam.GetRecordCount() > 0)//Nếu BN khác đã lấy mã này
                        {

                            objLuotkham.MaLuotkham = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM();

                        }
                        objLuotkham.IsNew = true;
                        objLuotkham.Save();
                        if (objLuotkham.TrangthaiNoitru >= 1)
                        {
                            SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema).Where(
                                KcbLuotkham.Columns.MaLuotkham).IsNotEqualTo(objLuotkham.MaLuotkham)
                                .And(KcbLuotkham.Columns.SoBenhAn).IsEqualTo(objLuotkham.SoBenhAn)
                                .And(KcbLuotkham.Columns.TrangthaiNoitru).IsGreaterThanOrEqualTo(1);

                            if (sqlQuery.GetRecordCount() > 0)
                            {
                                var query = new Update(KcbLuotkham.Schema)
                                     .Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(THU_VIEN_CHUNG.LaySoBenhAn())
                                     .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).
                                     Execute();
                            }

                        }
                        if (objRegExam != null)
                        {
                            objRegExam.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham);
                            objRegExam.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan);
                            AddRegExam(objRegExam,objLuotkham, false, KieuKham);
                        }
                        scope.Complete();
                        return ActionResult.Success;
                    }
                }
            }
            catch (Exception ex)
            {
                return ActionResult.Error;
            }
        }
Example #29
0
 public static DataTable GetAllDepartment()
 {
     try
     {
         DataTable query =
             new Select("1 as Checked, *").From(LDepartment.Schema.Name).ExecuteDataSet().Tables[0];
         return query;
     }
     catch (Exception)
     {
         throw;
     }
 }
        private void AutocompleteKieuKham()
        {
            DataTable dtStaff = new DataTable();
            try
            {
                 dtStaff = new Select(SysUser.Columns.PkSuid, string.Format("({0} + isnull(' - ' + {1},'')) as Staff_Name", SysUser.Columns.PkSuid, SysUser.Columns.SFullName)).From(SysUser.Schema).ExecuteDataSet().Tables[0];

                if (dtStaff == null) return;
                if (!dtStaff.Columns.Contains("ShortCut"))
                    dtStaff.Columns.Add(new DataColumn("ShortCut", typeof(string)));
                foreach (DataRow dr in dtStaff.Rows)
                {
                    string shortcut = "";
                    string realName = dr["Staff_Name"].ToString().Trim() + " " +
                                      Utility.Bodau(dr["Staff_Name"].ToString().Trim());
                    shortcut = dr[SysUser.Columns.PkSuid].ToString().Trim();
                    string[] arrWords = realName.ToLower().Split(' ');
                    string _space = "";
                    string _Nospace = "";
                    foreach (string word in arrWords)
                    {
                        if (word.Trim() != "")
                        {
                            _space += word + " ";
                            //_Nospace += word;
                        }
                    }
                    shortcut += _space; // +_Nospace;
                    foreach (string word in arrWords)
                    {
                        if (word.Trim() != "")
                            shortcut += word.Substring(0, 1);
                    }
                    dr["ShortCut"] = shortcut;
                }
            }
            catch
            {
            }
            finally
            {
                var source = new List<string>();
                var query = from p in dtStaff.AsEnumerable()
                            select p[SysUser.Columns.PkSuid].ToString() + "#" + p[SysUser.Columns.PkSuid].ToString() + "@" + p["Staff_Name"].ToString() + "@" + p.Field<string>("shortcut").ToString();
                source = query.ToList();
                this.txtNhanvien.AutoCompleteList = source;
                this.txtNhanvien.TextAlign = HorizontalAlignment.Center;
                this.txtNhanvien.CaseSensitive = false;
                this.txtNhanvien.MinTypedCharacters = 1;
            }
        }