예제 #1
0
        /// <summary>
        /// Hàm thực hiện xóa kho
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdXoa_Click(object sender, EventArgs e)
        {
            try
            {
                if (!IsValidData())
                {
                    return;
                }
                if (Utility.AcceptQuestion("Bạn có muốn xóa thông tin của kho thuốc vật tư đang chọn không", "Thông báo", true))
                {
                    foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdKhoThuoc.GetCheckedRows())
                    {
                        new Delete().From(QheDoituongKho.Schema)
                        .Where(QheDoituongKho.Columns.IdKho).IsEqualTo(Utility.Int32Dbnull(gridExRow.Cells["ID_KHO"].Value, -1))
                        .Execute();
                        if (new Delete().From(TDmucKho.Schema).Where(TDmucKho.Columns.IdKho).IsEqualTo(Utility.Int32Dbnull(gridExRow.Cells[TDmucKho.Columns.IdKho].Value, -1)).Execute() > 0)
                        {
                            m_blnCancel = false;
                            gridExRow.Delete();
                        }
                    }

                    grdKhoThuoc.UpdateData();
                    grdKhoThuoc.Refresh();

                    m_dtKhoThuoc.AcceptChanges();
                    //  Utility.ShowMsg("Bạn xóa thông tin thành công", "thông báo");
                    ModifyCommand();
                }
            }
            catch (Exception exception)
            {
            }
        }
 void cmdKhoa_Click(object sender, EventArgs e)
 {
     try
     {
         if (objLuotkham == null)
         {
             Utility.ShowMsg("Bạn cần chọn Bệnh nhân cần để khóa");
             txtMaluotkham.Focus();
             txtMaluotkham.SelectAll();
             return;
         }
         if (!Utility.AcceptQuestion("Bạn có chắc chắn muốn khóa bệnh nhân này không ?", "Xác nhận", true))
         {
             return;
         }
         objLuotkham.LastActionName = "Khóa bệnh nhân";
         objLuotkham.Locked         = 1;
         objLuotkham.Save();
         cmdKhoa.Enabled   = !Utility.Byte2Bool(objLuotkham.Locked);
         cmdMoKhoa.Enabled = !cmdKhoa.Enabled;
         Utility.ShowMsg("Đã khóa Bệnh nhân thành công");
     }
     catch (Exception ex)
     {
         Utility.CatchException(ex);
     }
 }
        /// <summary>
        /// hàm thực hiện xóa thông tin của hiếu nhập chi tiết
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdXoaPhieuNhap_Click(object sender, EventArgs e)
        {
            Utility.SetMsg(uiStatusBar2.Panels["MSG"], "", false);
            int IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);

            if (!InValiUpdateXoa())
            {
                return;
            }
            if (Utility.AcceptQuestion(string.Format("Bạn có muốn xóa phiếu trả thuốc từ khoa nội trú về kho với mã phiếu {0}\n hay không?", IdPhieu), "Thông báo", true))
            {
                ActionResult actionResult = new THUOC_NHAPKHO().XoaPhieuNhapKho(IdPhieu);
                switch (actionResult)
                {
                case ActionResult.Success:
                    grdList.CurrentRow.Delete();
                    grdList.UpdateData();
                    m_dtDataNhapKho.AcceptChanges();
                    Utility.SetMsg(uiStatusBar2.Panels["MSG"], "Bạn xóa thông tin phiếu trả thuốc từ khoa nội trú về kho thành công", false);
                    break;

                case ActionResult.Error:
                    break;
                }
            }
            ModifyCommand();
        }
예제 #4
0
        /// <summary>
        /// HÀM THỰC HIỆN VIỆC XÁC NHẬN NHẬP KHO THUỐC
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdNhapKho_Click(object sender, EventArgs e)
        {
            try
            {
                cmdNhapKho.Enabled = false;
                Utility.SetMsg(uiStatusBar1.Panels["MSG"], "", false);
                if (THU_VIEN_CHUNG.Laygiatrithamsohethong("THUOC_HIENTHI_NGAYXACNHAN", "0", false) == "0")
                {
                    if (!Utility.AcceptQuestion("Bạn có chắc chắn muốn xác nhận phiếu nhập kho đang chọn hay không?\nSau khi xác nhận, thuốc sẽ được cộng vào trong kho nhập", "Thông báo", true))
                    {
                        return;
                    }
                }

                int ITPhieuNhapxuatthuoc = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);
                TPhieuNhapxuatthuoc objTPhieuNhapxuatthuoc = TPhieuNhapxuatthuoc.FetchByID(ITPhieuNhapxuatthuoc);
                if (objTPhieuNhapxuatthuoc != null)
                {
                    DateTime _ngayxacnhan = globalVariables.SysDate;
                    if (THU_VIEN_CHUNG.Laygiatrithamsohethong("THUOC_HIENTHI_NGAYXACNHAN", "0", false) == "1")
                    {
                        frm_ChonngayXacnhan _ChonngayXacnhan = new frm_ChonngayXacnhan();
                        _ChonngayXacnhan.pdt_InputDate = objTPhieuNhapxuatthuoc.NgayHoadon;
                        _ChonngayXacnhan.ShowDialog();
                        if (_ChonngayXacnhan.b_Cancel)
                        {
                            return;
                        }
                        else
                        {
                            _ngayxacnhan = _ChonngayXacnhan.pdt_InputDate;
                        }
                    }
                    ActionResult actionResult =
                        _NHAPKHO.XacNhanPhieuNhapKho(objTPhieuNhapxuatthuoc, _ngayxacnhan);
                    switch (actionResult)
                    {
                    case ActionResult.Success:
                        Utility.SetMsg(uiStatusBar1.Panels["MSG"], "Xác nhận phiếu nhập kho thành công", false);
                        grdList.CurrentRow.BeginEdit();
                        grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.TrangThai].Value    = 1;
                        grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.NgayXacnhan].Value  = _ngayxacnhan;
                        grdList.CurrentRow.Cells[TPhieuNhapxuatthuoc.Columns.NguoiXacnhan].Value = globalVariables.UserName;
                        grdList.CurrentRow.EndEdit();
                        break;

                    case ActionResult.Error:
                        Utility.ShowMsg("Lỗi khi xác nhận phiếu nhập kho thuốc", "Thông báo lỗi", MessageBoxIcon.Error);
                        break;
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                ModifyCommand();
            }
        }
예제 #5
0
        void cmdChotDanhSach_Click(object sender, EventArgs e)
        {
            ActionResult actionResult = ActionResult.UNKNOW;

            if (radoChotMoi.Checked)
            {
                if (Utility.AcceptQuestion("Bạn có chắc chắn muốn chốt các bản ghi thanh toán còn sót lại hay không?", "Xác nhận chốt thanh toán", true))
                {
                    actionResult = new KCB_THANHTOAN().Chotbaocao(dtpNgayChot.Value, dtpNgayThanhToan.Value);
                }
            }
            else
            {
                if (Utility.AcceptQuestion("Bạn có chắc chắn muốn chốt các bản ghi thanh toán còn sót lại hay không?", "Xác nhận chốt thanh toán", true))
                {
                    actionResult = new KCB_THANHTOAN().ChotVetbaocao(dtpNgayChot.Value, dtpNgayThanhToan.Value);
                }
            }
            switch (actionResult)
            {
            case ActionResult.Success:
                Utility.ShowMsg("Đã chốt thanh toán thành công");
                break;

            case ActionResult.Error:
                Utility.ShowMsg("Có lỗi trong quá trình chốt thanh toán");
                break;
            }
        }
예제 #6
0
        /// <summary>
        /// hàm thực hiện xóa thông tin của hiếu nhập chi tiết
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdXoaPhieuNhap_Click(object sender, EventArgs e)
        {
            int    IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);
            string khoxuat = Utility.sDbnull(grdList.CurrentRow.Cells["ten_khoxuat"].Value, "");
            string khonhap = Utility.sDbnull(grdList.CurrentRow.Cells["ten_khonhap"].Value, "");

            if (!IsValid4UpdateDelete())
            {
                return;
            }
            if (Utility.AcceptQuestion(string.Format("Bạn có chắc chắn muốn xóa thông tin phiếu chuyển kho với mã phiếu {0} hay không?", IdPhieu), "Thông báo", true))
            {
                ActionResult actionResult = new THUOC_NHAPKHO().XoaPhieuNhapKho(IdPhieu);
                switch (actionResult)
                {
                case ActionResult.Success:
                    grdList.CurrentRow.Delete();
                    grdList.UpdateData();
                    m_dtDataNhapKho.AcceptChanges();
                    THU_VIEN_CHUNG.Log(this.Name, globalVariables.UserName,
                                       string.Format(
                                           "Xóa phiếu chuyển kho tuyến huyện với số phiếu là :{0} - Từ kho {1} đến kho {2}",
                                           id_PhieuNhap, khoxuat, khonhap), action.Delete);
                    Utility.ShowMsg("Bạn xóa thông tin phiếu chuyển kho thành công", "Thông báo", MessageBoxIcon.Information);
                    break;

                case ActionResult.Error:
                    break;
                }
            }
            ModifyCommand();
        }
예제 #7
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Utility.AcceptQuestion("Bạn có chắc chắn muốn lưu lại toàn bộ thông tin dự trù thuốc/vật tư trong kho?", "Thông báo", true))
                {
                    return;
                }
                foreach (GridEXRow _row in grdList.GetDataRows())
                {
                    int   IDTHUOC = Utility.Int32Dbnull(grdList.GetValue(DmucThuoc.Columns.IdThuoc), 0);
                    Int16 IDKHO   = Utility.Int16Dbnull(cboKhoxuat.SelectedValue);
                    int   SOLUONG = Utility.Int32Dbnull(grdList.GetValue("SO_LUONG"), 0);

                    if (SOLUONG <= 0)
                    {
                        new Delete().From(TDutruThuoc.Schema).Where(TDutruThuoc.Columns.IdThuoc).IsEqualTo(IDTHUOC)
                        .And(TDutruThuoc.Columns.IdKho).IsEqualTo(IDKHO)
                        .And(TDutruThuoc.Columns.KieuThuocVt).IsEqualTo(KIEU_THUOC_VT).Execute();
                    }
                    else
                    {
                        new Update(TDutruThuoc.Schema)
                        .Set(TDutruThuoc.Columns.SoluongDutru).EqualTo(SOLUONG)
                        .Where(TDutruThuoc.Columns.IdThuoc).IsEqualTo(IDTHUOC).And(TDutruThuoc.Columns.IdKho).
                        IsEqualTo(IDKHO)
                        .And(TDutruThuoc.Columns.KieuThuocVt).IsEqualTo(KIEU_THUOC_VT).Execute();
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg("Lỗi:", ex.Message);
            }
        }
예제 #8
0
 private void cmdXoa_Click(object sender, EventArgs e)
 {
     if (Utility.AcceptQuestion("Bạn có muốn xóa thông tin bản ghi đang chọn không ?", "Thông báo", true))
     {
         Delete();
     }
 }
예제 #9
0
        private void DeleteAllTestId(Int32 Test_ID)
        {
            try
            {
                if (!Utility.AcceptQuestion("Thực hiện xóa", "Thông báo", true))
                {
                    return;
                }

                Query myQuery;

                myQuery           = TResultDetail.CreateQuery().WHERE(TTestInfo.Columns.TestId, Test_ID);
                myQuery.QueryType = QueryType.Delete;
                myQuery.Execute();

                myQuery           = TTestInfo.CreateQuery().WHERE(TTestInfo.Columns.TestId, Test_ID);
                myQuery.QueryType = QueryType.Delete;
                myQuery.Execute();

                grdTestInfo.CurrentRow.Delete();
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
예제 #10
0
        private void cmdXoaGiuong_Click(object sender, EventArgs e)
        {
            if (grdBed.GetCheckedRows().Length <= 0)
            {
                Utility.ShowMsg("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxIcon.Error);
                return;
            }
            foreach (GridEXRow gridExRow in grdBed.GetCheckedRows())
            {
                int    idgiuong  = Utility.Int32Dbnull(gridExRow.Cells[NoitruDmucGiuongbenh.Columns.IdGiuong].Value);
                string TenGiuong = Utility.sDbnull(gridExRow.Cells[NoitruDmucGiuongbenh.Columns.TenGiuong].Value);

                SqlQuery sqlQuery = new Select().From(NoitruPhanbuonggiuong.Schema)
                                    .Where(NoitruPhanbuonggiuong.Columns.IdGiuong).IsEqualTo(idgiuong);
                if (sqlQuery.GetRecordCount() > 0)
                {
                    Utility.ShowMsg("Giường nội trú " + TenGiuong + " đã được sử dụng trong quá trình phân buồng giường, Bạn không thể xóa\n Mời bạn xem lại", "Thông báo");
                    return;
                }
            }
            if (Utility.AcceptQuestion("Bạn có muốn xóa thông tin bản ghi đang chọn không ?", "Thông báo", true))
            {
                foreach (GridEXRow gridExRow in grdBed.GetCheckedRows())
                {
                    short idphong = Utility.Int16Dbnull(gridExRow.Cells[NoitruDmucGiuongbenh.Columns.IdGiuong].Value);
                    NoitruDmucGiuongbenh.Delete(idphong);

                    gridExRow.Delete();
                }
                grdBed.UpdateData();
                m_dtDataGiuong.AcceptChanges();
            }
            ModifyCommand();
        }
 private void cmdXoaChiDinh_Click(object sender, EventArgs e)
 {
     try
     {
         if (!InValiAssign())
         {
             return;
         }
         string[] query = (from chidinh in grdDetail.GetCheckedRows().AsEnumerable()
                           let x = Utility.sDbnull(chidinh.Cells[DmucDichvuclsChitiet.Columns.TenChitietdichvu].Value)
                                   select x).ToArray();
         string serviceDetailName = string.Join("; ", query);
         string question          = string.Format("Bạn có muốn xóa thông tin chỉ định {0} \n đang chọn không",
                                                  serviceDetailName);
         if (Utility.AcceptQuestion(question, "Thông báo", true))
         {
             PerforActionDeleteAssign();
             //ModifyCommmand();
             ModifycommandAssignDetail();
         }
     }
     catch (Exception ex)
     {
         Utility.ShowMsg("Lỗi:" + ex.Message);
     }
 }
예제 #12
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (grdPhongBan.RowCount <= 0)
            {
                Utility.ShowMsg("Hiện chưa có bản ghi nào chọn", "Thông báo");
                grdPhongBan.Focus();
                return;
            }
            v_Department_id = Utility.Int32Dbnull(grdPhongBan.CurrentRow.Cells[DmucKhoaphong.Columns.IdKhoaphong].Value, -1);

            if (grdPhongBan.CurrentRow != null)
            {
                if (Utility.AcceptQuestion("Bạn có muốn xoá bản ghi này không", "Thông bảo", true))
                {
                    DmucKhoaphong.Delete(DmucKhoaphong.Columns.IdKhoaphong, v_Department_id);
                    DataRow[] array = dsTable.Select(DmucKhoaphong.Columns.IdKhoaphong + "=" + v_Department_id);
                    if (array.GetLength(0) > 0)
                    {
                        array[0].Delete();
                        dsTable.AcceptChanges();
                    }
                }

                ModifyCommand();
            }
        }
예제 #13
0
        private void cmdXoaPhieuNhap_Click(object sender, EventArgs e)
        {
            Utility.SetMsg(uiStatusBar2.Panels["MSG"], "", false);
            if (!IsValid4UpdateDeleteXoa())
            {
                return;
            }
            int IDPhieuNhap = Utility.Int32Dbnull(grdList.GetValue(TPhieutrathuocKholeVekhochan.Columns.IdPhieu), -1);

            if (Utility.AcceptQuestion(string.Format("Bạn có muốn xóa phiếu trả thuốc đang chọn hay không?", IDPhieuNhap), "Thông báo", true))
            {
                ActionResult actionResult = new PhieuTraLai().XoaPhieuNhapTraKho(IDPhieuNhap);
                switch (actionResult)
                {
                case ActionResult.Success:
                    grdList.CurrentRow.Delete();
                    grdList.UpdateData();
                    m_dtDataNhapTraKho.AcceptChanges();
                    Utility.SetMsg(uiStatusBar2.Panels["MSG"], "Xóa phiếu trả thuốc thành công", false);
                    break;

                case ActionResult.Error:
                    break;
                }
            }
            ModifyCommand();
        }
 void mnuHuyLinhthuocAll_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Utility.isValidGrid(grdPres))
         {
             return;
         }
         List <int> lstNoValidData = new List <int>();
         List <int> lstID_Donthuoc = (from p in grdPres.GetDataRows().AsEnumerable()
                                      where Utility.Int32Dbnull(((DataRowView)p.DataRow)[TPhieuCapphatChitiet.Columns.DaLinh], -1) == 1
                                      select Utility.Int32Dbnull(((DataRowView)p.DataRow)["id_donthuoc"], -1)).ToList <int>();
         if (lstID_Donthuoc.Count <= 0)
         {
             return;
         }
         if (Utility.AcceptQuestion(string.Format("Bạn có chắc chắn hủy bệnh nhân lĩnh thuốc cho {0} đơn thuốc đang chọn hay không?", lstID_Donthuoc.Count.ToString()), "Thông báo", true))
         {
             frm_NhaplydoHuy _NhaplydoHuy = new frm_NhaplydoHuy();
             _NhaplydoHuy.ShowDialog();
             if (!_NhaplydoHuy.m_blnCancel)
             {
                 if (CapphatThuocKhoa.BenhNhanLinhThuoc(idPhieucapphat, lstID_Donthuoc, 0, ref lstNoValidData) == ActionResult.Success)
                 {
                     foreach (GridEXRow _row in grdPres.GetDataRows())
                     {
                         if (lstID_Donthuoc.Contains(Utility.Int32Dbnull(_row.Cells["id_donthuoc"].Value, -1)))
                         {
                             _row.BeginEdit();
                             _row.Cells["da_linh"].Value = 0;
                             if (lstNoValidData.Count > 0 && lstNoValidData.Contains(Utility.Int32Dbnull(_row.Cells["id_donthuoc"].Value, -1)))
                             {
                                 _row.Cells["not_valid"].Value = 1;
                             }
                             _row.EndEdit();
                         }
                     }
                     grdPres.Refetch();
                     Utility.SetMsg(uiStatusBar2.Panels["Msg"], "Hủy lĩnh thuốc thành công!", false);
                 }
                 else
                 {
                     Utility.SetMsg(uiStatusBar2.Panels["Msg"], "Hủy lĩnh thuóc không thành công!Liên hệ VMS để được trợ giúp", true);
                 }
                 mnuHuyLinhthuocAll.Enabled     = m_Donthuoc.Select("da_linh=1").Length > 0;
                 mnuLinhthuocAll.Enabled        = m_Donthuoc.Select("da_linh=0").Length > 0;
                 mnuHuyLinhthuocCurrent.Enabled = Utility.isValidGrid(grdPres) && Utility.sDbnull(grdPres.GetValue("da_linh"), "-1") == "1";
                 mnuLinhthuocCurrent.Enabled    = Utility.isValidGrid(grdPres) && Utility.sDbnull(grdPres.GetValue("da_linh"), "-1") == "0";
                 if (lstNoValidData.Count > 0)
                 {
                     Utility.ShowMsg("Chú ý: Một số đơn thuốc bạn chọn chứa thuốc trả lại đã được tổng hợp trong phiếu trả thuốc thừa nên hệ thống bỏ qua không thực hiện và đánh dấu màu đỏ. Đề nghị bạn kiểm tra lại");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Utility.CatchException(ex);
     }
 }
예제 #15
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (!isValidData())
            {
                return;
            }
            if (Utility.AcceptQuestion("Bạn có muốn xóa thông tin đang chọn hay không", "Thông báo", true))
            {
                int record = new Delete().From(DmucDiachinh.Schema)
                             .Where(DmucDiachinh.Columns.MaDiachinh).IsEqualTo(v_Survey_code).Execute();

                if (record > 0)
                {
                    grdSurveys.CurrentRow.Delete();
                    grdSurveys.UpdateData();
                    grdSurveys.Refresh();
                    DataRow[] arrDr = globalVariables.gv_dtDmucDiachinh.Select(DmucDiachinh.Columns.MaDiachinh + "='" + v_Survey_code + "'");
                    if (arrDr.Length > 0)
                    {
                        globalVariables.gv_dtDmucDiachinh.Rows.Remove(arrDr[0]);
                    }
                    Utility.ShowMsg("Bạn xóa thông tin địa chính đang chọn thành công", "Thông báo");
                }
                else
                {
                    Utility.ShowMsg("Có lỗi trong khi xóa thông tin địa chính", "Thông báo");
                }
            }
            ModifyCommand();
        }
예제 #16
0
 void cmdHuy_Click(object sender, EventArgs e)
 {
     if (objLuotkham == null)
     {
         Utility.SetMsg(lblMsg, "Bạn cần chọn bệnh nhân trước khi thực hiện hủy chuyển viện", true);
         return;
     }
     if (Utility.AcceptQuestion(string.Format("Bạn có chắc chắn muốn hủy chuyển viện cho bệnh nhân {0} hay không?", txtTenBN.Text), "Xác nhận hủy chuyển viện", true))
     {
         try
         {
             using (var scope = new TransactionScope())
             {
                 using (var dbscope = new SharedDbConnectionScope())
                 {
                     objLuotkham.TthaiChuyendi     = 0;
                     objLuotkham.IdBenhvienDi      = -1;
                     objLuotkham.IdBacsiChuyenvien = -1;
                     objLuotkham.NgayRavien        = null;
                     objLuotkham.IsNew             = false;
                     objLuotkham.MarkOld();
                     objLuotkham.Save();
                     new Delete().From(KcbPhieuchuyenvien.Schema).Where(KcbPhieuchuyenvien.Columns.IdPhieu).IsEqualTo(Utility.Int32Dbnull(txtId.Text, -1)).Execute();
                 }
                 scope.Complete();
                 Utility.SetMsg(lblMsg, string.Format("Hủy chuyển viện cho bệnh nhân {0} thành công", txtTenBN.Text), true);
             }
         }
         catch (Exception ex)
         {
             Utility.CatchException(ex);
         }
     }
 }
예제 #17
0
        /// <summary>
        /// hàm thực hiện xóa thông tin của hiếu nhập chi tiết
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdXoaPhieuNhap_Click(object sender, EventArgs e)
        {
            int IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);

            if (!IsValid4UpdateDelete())
            {
                return;
            }
            if (Utility.AcceptQuestion(string.Format("Bạn có chắc chắn muốn xóa thông tin phiếu chuyển kho với mã phiếu {0} hay không?", IdPhieu), "Thông báo", true))
            {
                ActionResult actionResult = new THUOC_NHAPKHO().XoaPhieuNhapKho(IdPhieu);
                switch (actionResult)
                {
                case ActionResult.Success:
                    grdList.CurrentRow.Delete();
                    grdList.UpdateData();
                    m_dtDataNhapKho.AcceptChanges();
                    Utility.ShowMsg("Bạn xóa thông tin phiếu chuyển kho thành công", "Thông báo", MessageBoxIcon.Information);
                    break;

                case ActionResult.Error:
                    break;
                }
            }
            ModifyCommand();
        }
예제 #18
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (grdTestData.CurrentRow != null && grdTestData.CurrentRow.RowType == RowType.Record)
                {
                    //if (DDataControl.CreateQuery().WHERE(DDataControl.Columns.TestDataId, Utility.sDbnull(grdTestData.GetValue("TestData_ID"))).GetRecordCount() > 0 |
                    //   TResultDetail.CreateQuery().WHERE(TResultDetail.Columns.TestDataId, Utility.sDbnull(grdTestData.GetValue("TestData_ID"))).GetRecordCount() > 0)

                    if (DDataControl.CreateQuery().WHERE(DDataControl.Columns.TestDataId, Utility.sDbnull(grdTestData.GetValue("TestData_ID"))).GetRecordCount() > 0
                        )
                    {
                        Utility.ShowMsg(string.Format("{0} đang sử dụng. Không được xóa.", grdTestData.GetValue("TestData_ID")));
                    }
                    else
                    if (
                        Utility.AcceptQuestion(
                            string.Format("Xóa {0} của {1}", grdTestData.GetValue("Data_Name"),
                                          grdTestData.GetValue("TestType_Name")), "Thông báo", true))
                    {
                        new Delete().From(LStandardTest.Schema.Name).Where(LStandardTest.Columns.TestDataId).IsEqualTo(
                            grdTestData.GetValue("TestData_ID")).Execute();
                        grdTestData.CurrentRow.Delete();
                        grdTestData.UpdateData();
                        dtTestDataList.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
예제 #19
0
        /// <summary>
        /// Thực hiện Xóa dữ liệu
        /// </summary>
        private bool PerformDeleteAct()
        {
            try
            {
                string ActResult     = "";
                string DeleteContent = m_strListName + " (" + txtMa.Text.Trim() + "-" + txtTen.Text.Trim() + ")";

                if (!Utility.AcceptQuestion("Bạn có muốn xóa " + DeleteContent + " hay không?", "Xác nhận trước khi xóa danh mục", true))
                {
                    return(false);
                }
                //Thực hiện hành động xóa
                m_BusRules.DeleteList(txtMa.Text.Trim(), loaidanhmuc, ref ActResult);
                if (ActResult == ActionResult.Success.ToString())
                {
                    RemoveRowfromDataTable(txtMa.Text.Trim());
                    //Thông báo xóa thành công
                    Utility.SetMsg(lblMsg, "Đã xóa " + DeleteContent + " thành công ?", false);
                }

                else if (ActResult == ActionResult.Exception.ToString())
                {
                    Utility.ShowMsg(ActResult);
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
                return(false);
            }
        }
예제 #20
0
        void mnuChotCurrent_Click(object sender, EventArgs e)
        {
            if (!Utility.isValidGrid(grdPres))
            {
                return;
            }
            List <int> lstID_Donthuoc = new List <int>()
            {
                Utility.Int32Dbnull(grdPres.GetValue("id_donthuoc"), -1)
            };

            if (Utility.AcceptQuestion("Bạn có chắc chắn chốt số liệu cấp phát thuốc cho đơn thuốc đang chọn hay không?", "Thông báo", true))
            {
                if (new ChotThuoc().CHOT_CAPPHAT(lstID_Donthuoc, id_kho, dtNgayPhatThuoc.Value.Date) == ActionResult.Success)
                {
                    grdPres.CurrentRow.BeginEdit();
                    grdPres.CurrentRow.Cells["trangthai_chot"].Value = 1;
                    grdPres.CurrentRow.Cells["ngay_chot"].Value      = dtNgayPhatThuoc.Value.Date;
                    grdPres.CurrentRow.EndEdit();
                    grdPres.Refetch();
                    Utility.SetMsg(uiStatusBar2.Panels["1"], "Chốt số liệu thành công!", false);
                }
                else
                {
                    Utility.SetMsg(uiStatusBar2.Panels["1"], "Chốt số liệu không thành công!Liên hệ VMS để được trợ giúp", true);
                }
                mnuHuychotAll.Enabled     = m_dtDataDonThuoc.Select("trangthai_chot=1").Length > 0 && PropertyLib._HisDuocProperties.ChoPhepHuyChotThuoc;
                mnuChotAll.Enabled        = m_dtDataDonThuoc.Select("trangthai_chot=0").Length > 0;
                mnuHuychotCurrent.Enabled = Utility.isValidGrid(grdPres) && Utility.sDbnull(grdPres.GetValue("trangthai_chot"), "-1") == "1" && PropertyLib._HisDuocProperties.ChoPhepHuyChotThuoc;
                mnuChotCurrent.Enabled    = Utility.isValidGrid(grdPres) && Utility.sDbnull(grdPres.GetValue("trangthai_chot"), "-1") == "0";
            }
        }
예제 #21
0
 private void tsmDelTestInfo_Click(object sender, EventArgs e)
 {
     try
     {
         if (
             TResultDetail.CreateQuery().WHERE(TResultDetail.Columns.TestId,
                                               Utility.Int32Dbnull(
                                                   grdTestInfo.GetValue(TTestInfo.Columns.TestId))).
             GetRecordCount() > 0)
         {
             Utility.ShowMsg("Đã có kết quả. Không được xóa !");
             return;
         }
         if (Utility.AcceptQuestion("Xóa " + grdTestInfo.GetValue(TTestTypeList.Columns.TestTypeName),
                                    "Thông báo", true))
         {
             new Delete().From(TTestInfo.Schema.Name).Where(TTestInfo.Columns.TestId).
             IsEqualTo(Utility.Int32Dbnull(grdTestInfo.GetValue("Test_ID"))).Execute();
             new Delete().From(TRegList.Schema.Name).Where(TRegList.Columns.TestId).
             IsEqualTo(Utility.Int32Dbnull(grdTestInfo.GetValue("Test_ID"))).Execute();
             grdTestInfo.CurrentRow.Delete();
             grdTestInfo.UpdateData();
             dtTestInfo.AcceptChanges();
         }
     }
     catch (Exception ex)
     {
         Utility.ShowMsg(ex.Message);
     }
 }
예제 #22
0
        /// <summary>
        /// hàm thực hiện xóa thông tin của hiếu nhập chi tiết
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdXoaPhieuNhap_Click(object sender, EventArgs e)
        {
            int IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);

            if (!InValiUpdateXoa())
            {
                return;
            }
            if (Utility.AcceptQuestion(string.Format("Bạn có muốn xóa thông tin phiếu trả nhà cung cấp với Id: {0}?", IdPhieu), "Thông báo", true))
            {
                Utility.SetMsg(uiStatusBar2.Panels["MSG"], "", true);
                ActionResult actionResult = new THUOC_NHAPKHO().XoaPhieuNhapKho(IdPhieu);
                switch (actionResult)
                {
                case ActionResult.Success:
                    grdList.CurrentRow.Delete();
                    grdList.UpdateData();
                    m_dtDataNhapKho.AcceptChanges();
                    Utility.SetMsg(uiStatusBar2.Panels["MSG"], "Bạn xóa phiếu trả thành công", false);
                    break;

                case ActionResult.Error:
                    Utility.ShowMsg("Lỗi trong quá trình xóa thông tin của phiếu trả nhà cung cấp", "Thông báo lỗi", MessageBoxIcon.Error);
                    break;
                }
            }
            ModifyCommand();
        }
예제 #23
0
        /// <summary>
        /// hàm thực hiện việc xóa thông tin chi tiết của phiếu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdXoaPhieuNhap_Click(object sender, EventArgs e)
        {
            Utility.SetMsg(uiStatusBar1.Panels["MSG"], "", false);
            int    ITPhieuNhapxuatthuoc = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);
            string khoxuat = Utility.sDbnull(grdList.CurrentRow.Cells["ten_khoxuat"].Value, "");
            string khonhap = Utility.sDbnull(grdList.CurrentRow.Cells["ten_khonhap"].Value, "");

            if (!InValiUpdateXoa())
            {
                return;
            }
            if (Utility.AcceptQuestion(string.Format("Bạn có chắc chắn muốn xóa thông tin phiếu nhập kho với mã phiếu {0} hay không?", ITPhieuNhapxuatthuoc), "Thông báo", true))
            {
                ActionResult actionResult = _NHAPKHO.XoaPhieuNhapKho(ITPhieuNhapxuatthuoc);
                switch (actionResult)
                {
                case ActionResult.Success:
                    grdList.CurrentRow.Delete();
                    grdList.UpdateData();
                    m_dtDataNhapKho.AcceptChanges();
                    m_dtDataNhapKho.AcceptChanges();
                    THU_VIEN_CHUNG.Log(this.Name, globalVariables.UserName,
                                       string.Format(
                                           "Xóa phiếu nhập kho với số phiếu là :{0} -Tại kho {1}}",
                                           ITPhieuNhapxuatthuoc, khoxuat), action.Delete);
                    Utility.SetMsg(uiStatusBar1.Panels["MSG"], "Bạn xóa thông tin phiếu nhập kho thành công", false);
                    break;

                case ActionResult.Error:
                    Utility.ShowMsg("Lỗi trong quá trình xóa thông tin của phiếu nhập kho", "Thông báo lỗi", MessageBoxIcon.Error);
                    break;
                }
            }
            ModifyCommand();
        }
예제 #24
0
        /// <summary>
        /// Thực hiện nghiệp vụ Delete dữ liệu
        /// </summary>
        private void PerformDeleteAction()
        {
            if (Utility.AcceptQuestion("Bạn có muốn xóa đối tượng đang chọn hay không?", "Xác nhận xóa", true))
            {
                int v_intObjectTypeID = Convert.ToInt32(txtID.Text.Trim());

                QheDoituongThuoc _item2 = new Select().From(QheDoituongThuoc.Schema).Where(QheDoituongThuoc.Columns.IdDoituongKcb).IsEqualTo(v_intObjectTypeID).ExecuteSingle <QheDoituongThuoc>();
                if (_item2 != null)
                {
                    Utility.ShowMsg("Đối tượng KCB này đã được sử dụng trong bảng khác nên bạn không thể xóa");
                    return;
                }


                DataRow [] v_DeleteObject = dsTable.Select(DmucDoituongkcb.Columns.IdDoituongKcb + "=" + v_intObjectTypeID);

                //Gọi nghiệp vụ xóa dữ liệu\
                //int Count = DmucDoituongkcb.Delete(v_intObjectTypeID);

                int record = new Delete().From(DmucDoituongkcb.Schema).Where(DmucDoituongkcb.IdDoituongKcbColumn).IsEqualTo(v_intObjectTypeID).Execute();
                if (record > 0)//Nếu xóa thành công trong CSDL
                {
                    v_DeleteObject[0].Delete();
                    m_enAction = action.FirstOrFinished;
                    SetControlStatus();
                    Utility.ShowMsg("Đã xóa đối tượng có mã: " + v_intObjectTypeID + " ra khỏi hệ thống.");
                }
                else//Có lỗi xảy ra
                {
                    Utility.ShowMsg("Lỗi khi xóa ");
                }
            }
        }
예제 #25
0
 void mnuDeleteCheckedItems_Click(object sender, EventArgs e)
 {
     try
     {
         Utility.SetMsg(lblMsg, "", false);
         if (!Utility.AcceptQuestion("Bạn có chắc chắn muốn xóa các chi tiết đang chọn ra khỏi phiếu Vật tư", "Xác nhận xóa", true))
         {
             return;
         }
         List <long> lstIdchitietDonthuoc = (from q in grdVTTH.GetCheckedRows().AsEnumerable()
                                             select Utility.Int64Dbnull(q.Cells[KcbDonthuocChitiet.Columns.IdChitietdonthuoc].Value, -1)).Distinct().ToList <long>();
         if (lstIdchitietDonthuoc.Count <= 0)
         {
             Utility.SetMsg(lblMsg, "Bạn cần chọn ít nhất một chi tiết cần xóa", true);
             return;
         }
         string sId = string.Join(",", lstIdchitietDonthuoc);
         new KCB_KEDONTHUOC().XoaChitietDonthuoc(sId);
         XoaThuocKhoiBangdulieu(m_dtVTTH, lstIdchitietDonthuoc);
         m_blnCancel = false;
         Utility.SetMsg(lblMsg, "Đã xóa các chi tiết Vật tư tiêu hao thành công", false);
     }
     catch (Exception ex)
     {
         Utility.SetMsg(lblMsg, ex.Message, true);
     }
 }
        /// <summary>
        /// Thực hiện nghiệp vụ Delete dữ liệu
        /// </summary>
        private void PerformDeleteAction()
        {
            if (Utility.AcceptQuestion("Bạn có muốn xóa Loại thuốc đang chọn hay không?", "Xác nhận xóa", true))
            {
                Int16 v_shtIdLoaithuoc = Convert.ToInt16(txtID.Text.Trim());
                //Kiểm tra xem đã được sử dụng trong bảng khác chưa

                if (new DmucThuocController().FetchByQuery(DmucThuoc.CreateQuery().AddWhere("Id_Loaithuoc", Comparison.Equals, v_shtIdLoaithuoc)).Count > 0)
                {
                    Utility.SetMsg(lblMsg, "Loại thuốc này đã được sử dụng trong danh mục thuốc(vật tư) nên bạn không thể xóa", true);
                    return;
                }
                DataRow[] arrDr = m_dtLoaithuoc.Select(DmucLoaithuoc.Columns.IdLoaithuoc + "=" + txtID.Text);
                //Gọi nghiệp vụ xóa dữ liệu\
                int Count = DmucLoaithuoc.Delete(v_shtIdLoaithuoc);

                if (arrDr.Length > 0)//Nếu xóa thành công trong CSDL
                {
                    m_dtLoaithuoc.Rows.Remove(arrDr[0]);
                    m_dtLoaithuoc.AcceptChanges();
                    //Return to the InitialStatus
                    m_enAction = action.FirstOrFinished;
                    SetControlStatus();
                    Utility.SetMsg(lblMsg, "Đã xóa Loại có mã: " + v_shtIdLoaithuoc + " ra khỏi hệ thống.", false);
                }
                else//Có lỗi xảy ra
                {
                    Utility.SetMsg(lblMsg, "Lỗi khi xóa loại thuốc", true);
                }
            }
        }
예제 #27
0
 /// <summary>
 /// hàm thực hiện xóa thông tin bản ghi
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdDelete_Click(object sender, EventArgs e)
 {
     if (grd_Insurance_Objects.CurrentRow != null)
     {
         if (Utility.AcceptQuestion("Bạn có muốn xóa thông tin bản ghi đang chọn hay không", "Thông báo", true))
         {
             int _IdDichvukcb = Utility.Int32Dbnull(grd_Insurance_Objects.CurrentRow.Cells[DmucDichvukcb.Columns.IdDichvukcb].Value,
                                                    -1);
             KcbDangkyKcb item = new Select().From(KcbDangkyKcb.Schema).Where(KcbDangkyKcb.Columns.IdDichvuKcb).IsEqualTo(_IdDichvukcb).ExecuteSingle <KcbDangkyKcb>();
             if (item != null)
             {
                 Utility.ShowMsg("Dịch vụ KCB bạn đang chọn xóa đã được áp dụng cho một số Bệnh nhân nên bạn không thể xóa");
                 return;
             }
             int record = new Delete().From(DmucDichvukcb.Schema)
                          .Where(DmucDichvukcb.Columns.IdDichvukcb).IsEqualTo(_IdDichvukcb).Execute();
             if (record > 0)
             {
                 DataRow[] arrDr = m_dtDmucDichvu_kcb.Select(DmucDichvukcb.Columns.IdDichvukcb + "=" + _IdDichvukcb);
                 if (arrDr.GetLength(0) > 0)
                 {
                     arrDr[0].Delete();
                 }
                 m_dtDmucDichvu_kcb.AcceptChanges();
             }
             else
             {
                 Utility.ShowMsg("Lỗi trong quá trình xóa thông tin");
             }
         }
     }
 }
 private void cmdSaveAll_Click(object sender, EventArgs e)
 {
     try
     {
         if (Utility.AcceptQuestion("Bạn có muốn lưu toàn bộ thông tin này không", "Thông báo", true))
         {
             foreach (DataRowView drv in dsTable.DefaultView)
             {
                 new Update(DmucDichvuclsChitiet.Schema)
                 .Set(DmucDichvuclsChitiet.Columns.SttHthi).EqualTo(
                     Utility.Int32Dbnull(drv[DmucDichvuclsChitiet.Columns.SttHthi], 1))
                 .Set(DmucDichvuclsChitiet.Columns.MaChitietdichvu).EqualTo(
                     Utility.sDbnull(drv[DmucDichvuclsChitiet.Columns.MaChitietdichvu], ""))
                 .Set(DmucDichvuclsChitiet.Columns.TenChitietdichvu).EqualTo(
                     Utility.sDbnull(drv[DmucDichvuclsChitiet.Columns.TenChitietdichvu], ""))
                 .Set(DmucDichvuclsChitiet.Columns.DonGia).EqualTo(
                     Utility.DecimaltoDbnull(drv[DmucDichvuclsChitiet.Columns.DonGia], 0))
                 .Set(DmucDichvuclsChitiet.Columns.MaDonvitinh).EqualTo(
                     Utility.DecimaltoDbnull(drv[DmucDichvuclsChitiet.Columns.MaDonvitinh], 0))
                 .Where(DmucDichvuclsChitiet.Columns.IdChitietdichvu).IsEqualTo(
                     Utility.Int32Dbnull(drv[DmucDichvuclsChitiet.Columns.IdChitietdichvu], -1)).Execute();
             }
             Utility.ShowMsg("Bạn thực hiện thành công", "Thông báo");
         }
     }
     catch (Exception)
     {
         ModifyCommand();
     }
 }
예제 #29
0
        private void cmdExcel_Click(object sender, System.EventArgs e)
        {
            string sFileName = "";

            try
            {
                SaveFileDialog SaveFileDlg = new SaveFileDialog();
                SaveFileDlg.Title  = "VSS-->Save to Excel file";
                SaveFileDlg.Filter = "Excel files|*.XLS";
                if (SaveFileDlg.ShowDialog() == DialogResult.OK)
                {
                    sFileName = SaveFileDlg.FileName;
                    if (sFileName.Contains(".XLS"))
                    {
                    }
                    else
                    {
                        sFileName += ".XLS";
                    }
                    this.Text = "Đang lưu dữ liệu ra file: " + sFileName;
                    RptDoc.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, sFileName);
                    this.Text = "In dữ liệu";
                    if (Utility.AcceptQuestion("Đã xuất dữ liệu thành công ra file Excel ở đường dẫn: " + sFileName + Constants.vbCrLf + "Bạn có muốn mở file Excel ra xem không?", "Thông báo", true))
                    {
                        System.Diagnostics.Process.Start(sFileName);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
예제 #30
0
 private void cmdMoKhoa_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Utility.AcceptQuestion("Bạn có chắc chắn muốn mở khóa bệnh nhân này không ?", "Xác nhận", true))
         {
             return;
         }
         int record = -1;
         record =
             new Update(TPatientExam.Schema).Set(TPatientExam.Columns.Locked).EqualTo(0).Where(
                 TPatientExam.Columns.PatientCode)
             .IsEqualTo(txtPatientCode.Text).Execute();
         if (record > 0)
         {
             Utility.ShowMsg("Đã cập nhật thông tin thành công");
             patientExam.Locked = 0;
             txtTrangthai.Text  = "Đã khóa";
         }
         else
         {
             Utility.ShowMsg("Chưa cập nhật được thông tin vào cơ sở dữ liệu");
         }
     }
     catch (Exception)
     {
         Utility.ShowMsg("Có lỗi trong quá trình cập nhật thông tin vào cơ sở dữ liệu");
     }
 }