private void cmdRegister_Click(object sender, EventArgs e) { if (!CheckValidData()) return; _ACtrl = new ProjectionControl(txtCode.Text.Trim(), txtVnName.Text.Trim(), txtEngName.Text.Trim(), Convert.ToInt32(txtSTT.Text.Trim()), false); DoctorController _Ctrl = new DoctorController(); ActionResult _ActionResult; if (Act == action.Insert) _ActionResult = _Ctrl.InsertProjection(_ACtrl.Code, _ACtrl.Vn_Name, _ACtrl.En_Name, _ACtrl.STT); else _ActionResult = _Ctrl.UpdateProjection(_ACtrl.Code, _ACtrl.Vn_Name, _ACtrl.En_Name, _ACtrl.STT); if (_ActionResult == ActionResult.Success) { this.DialogResult = DialogResult.OK; this.Close(); } if (_ActionResult == ActionResult.ExistedRecord) { errorProvider1.SetError(txtCode, "Đã tồn tại vị trí chụp có mã " + _ACtrl.Code + ". Đề nghị bạn nhập lại mã khác!"); Utility.FocusAndSelectAll(txtCode); } }
private void GetData() { try { DataTable dtPhysician = new DoctorController().GetAllData().Tables[0]; dtPhysician.DefaultView.Sort = "Pos"; cboPhysician.DataSource = dtPhysician.DefaultView; cboPhysician.DisplayMember = "Doctor_Name"; cboPhysician.ValueMember = "Doctor_Code"; if (cboPhysician.Items.Count > 0) cboPhysician.SelectedIndex = 0; } catch { } }
private void ExecuteAction() { //Kiểm tra tính hợp lệ của dữ liệu trước khi thêm mới if (!IsValidData()) { return; } //Gán DoctorEntity vào DataEntity SetValueforEntity(); //Khởi tạo BusinessRule để xử lý nghiệp vụ DoctorInfor Infor = new DoctorInfor(); Utility.MapValueFromEntityIntoObjectInfor(Infor, DoctorEntity); DoctorController _BusRule = new DoctorController(Infor); switch (Act) { case action.Insert: //Gọi nghiệp vụ Insert dữ liệu ActionResult InsertResult = _BusRule.Insert(); if (InsertResult == ActionResult.Success)//Nếu thành công { //Thêm mới một dòng vào Datasource để cập nhật lại dữ liệu trên DataGridView //phải đảm bảo Datasource và DoctorEntity có cấu trúc giống nhau mới dùng hàm này DataRow dr = Utility.CopyData(DoctorEntity.Rows[0], DataSource); if (dr != null)//99.99% là sẽ !=null { DataSource.Rows.Add(dr); DataSource.AcceptChanges(); } //Return to the InitialStatus Act = action.FirstOrFinished; //Nhảy đến bản ghi vừa thêm mới trên lưới. Do txtID chưa bị reset nên dùng luôn Utility.GotoNewRow(grdList, "colDoctorCode", txtCode.Text.Trim()); mdlStatic.SetMsg(lblMsg,"Thêm mới dữ liệu thành công!",false); SetControlStatus(); CurrentCellChanged(); } else//Có lỗi xảy ra { switch (InsertResult) { case ActionResult.ExistedRecord: mdlStatic.SetMsg(lblMsg, "Đã tồn tại Bác sĩ có mã: " + txtCode.Text.Trim() + ". Đề nghị bạn xem lại",true); break; default: mdlStatic.SetMsg(lblMsg,"Lỗi trong quá trình thêm mới Bác sĩ. Liên hệ với VBIT",true); break; } } break; case action.Update: //Gọi Business cập nhật dữ liệu ActionResult UpdateResult = _BusRule.Update(); if (UpdateResult == ActionResult.Success)//Nếu thành công { //Cập nhật số thứ tự cho bản ghi tráo số thứ tự với bản ghi đang được cập nhật(nếu có)? foreach (DataRow drUpdatePos in DataSource.Rows) { if (Utility.Int16Dbnull(drUpdatePos["Pos"]) == Convert.ToInt16(txtPos.Text)) { drUpdatePos["Pos"] = OldPos; break; // TODO: might not be correct. Was : Exit For } } DataSource.AcceptChanges(); //Cập nhật dòng hiện thời trong Datasource để cập nhật lại dữ liệu trên DataGridView DataRow dr = Utility.GetDataRow(DataSource, "Doctor_Code", txtCode.Text.Trim()); if (dr != null) { Utility.CopyData(DoctorEntity.Rows[0], ref dr); DataSource.AcceptChanges(); } //Return to the InitialStatus Act = action.FirstOrFinished; //Nhảy đến bản ghi vừa cập nhật trên lưới. Do txtID chưa bị reset nên dùng luôn Utility.GotoNewRow(grdList, "colDoctorCode", txtCode.Text.Trim()); mdlStatic.SetMsg(lblMsg,"Cập nhật dữ liệu thành công.",false); SetControlStatus(); CurrentCellChanged(); } else//Có lỗi xảy ra { switch (UpdateResult) { case ActionResult.Error: mdlStatic.SetMsg(lblMsg,"Lỗi khi cập nhật Bác sĩ. Liên hệ với VBIT",true); break; default: mdlStatic.SetMsg(lblMsg,"Lỗi khi cập nhật Bác sĩ. Liên hệ với VBIT",true); break; } } break; case action.Delete: if (Utility.AcceptQuestion("Bạn có muốn xóa Bác sĩ đang chọn hay không?", "Xác nhận xóa", true)) { string Doctor_Code = txtCode.Text.Trim(); //Gọi nghiệp vụ xóa dữ liệu ActionResult DeleteResult = _BusRule.Delete(); if (DeleteResult == ActionResult.Success)//Nếu xóa thành công trong CSDL { //Xóa dòng dữ liệu vừa chọn trong Datasource để cập nhật lại dữ liệu trên DataGridView DataRow dr = Utility.GetDataRow(DataSource, "Doctor_Code", Doctor_Code); if (dr != null) { DataSource.Rows.Remove(dr); DataSource.AcceptChanges(); } //Return to the InitialStatus Act = action.FirstOrFinished; mdlStatic.SetMsg(lblMsg,"Đã xóa Bác sĩ có mã: " + Doctor_Code + " ra khỏi hệ thống.",false); SetControlStatus(); CurrentCellChanged(); } else//Có lỗi xảy ra { switch (DeleteResult) { case ActionResult.DataHasUsedinAnotherTable: mdlStatic.SetMsg(lblMsg,"Bác sĩ có mã: " + Doctor_Code + " đã được sử dụng trong bảng khác nên bạn không thể xóa!",true); break; default: mdlStatic.SetMsg(lblMsg,"Lỗi khi xóa Bác sĩ. Liên hệ với VBIT",true); break; } } } break; default: break; } }
private void cmdSaveParam_Click(object sender, EventArgs e) { try { string ErrMsg = ""; foreach (Control ctr in pnlProjectionList.Controls) { ProjectionControl _Projection = ctr as ProjectionControl; if (_Projection.isPressed) { string errMsg = ""; int AutoFlipV = chkAutoVFlip.ImageIndex == 0 ? 1 : 0; int AutoFlipH = chkAutoHFlip.ImageIndex == 0 ? 1 : 0; int FILM_HD = CHK_FILMHD.ImageIndex == 0 ? 1 : 0; ActionResult actResult = new DoctorController().InsertAPParam(_Anatomy.Code, _Projection.Code, cboBodySize.SelectedValue.ToString(), nmrKVP.Value, (int)nmrMA.Value, (int)nmrMAS.Value,FILM_HD, txtRadCode.Text.Trim(), CurrDevice_ID,AutoFlipV,AutoFlipH, ref errMsg); if ( actResult== ActionResult.Success) { UpdateAPDataTable(_Anatomy.Code, _Projection.Code, AutoFlipV, AutoFlipH, txtRadCode.Text); InsertParamDataTable(_Anatomy.Code, _Projection.Code, cboBodySize.SelectedValue.ToString(), nmrKVP.Value, (int)nmrMA.Value, (int)nmrMAS.Value, FILM_HD); _Projection.RAD_Code = txtRadCode.Text.Trim(); DataRow[] arrDR = AP_DataSource.Select("ANATOMY_CODE='" + _Anatomy.Code + "' AND PROJECTION_CODE='"+_Projection.Code+"' AND DEVICE_ID=" + CurrDevice_ID.ToString()); if (arrDR.Length > 0) arrDR[0]["RAD_Code"] = _Projection.RAD_Code; AP_DataSource.AcceptChanges(); } else if (actResult == ActionResult.ExistedRecord) { if (errMsg != "") { new frm_LargeMsgBoxOK("Báo lỗi", errMsg, "OK", "CANCEL").ShowDialog(); txtRadCode.Focus(); } } else { ErrMsg += "(" + _Anatomy.Code + "+" + _Projection.Code + "+" + cboBodySize.SelectedValue.ToString() + "," + nmrKVP.Value.ToString() + "," + nmrMA.Value.ToString() + "," + nmrMAS.Value.ToString() + "\n"; } } } if (ErrMsg != "") { new frm_LargeMsgBoxOK("THÔNG BÁO LỖI", ErrMsg.Substring(0, ErrMsg.Length - 1), "OK", "CANCEL").ShowDialog(); } } catch { } finally { cmdDelProjection.Enabled = HasSelectedProjection(); cmdMakeAsEmerency.Enabled = cmdDelProjection.Enabled; pnlParams.Enabled = cmdDelProjection.Enabled; } }
/// <summary> /// Trả về đối tượng Infor dựa vào Primary key của nó /// </summary> /// <param name="ID"></param> /// <returns></returns> public static DoctorInfor GetInfor(string ID) { DataSet ds = new DoctorController().GetData("Doctor_Code='" + ID+"'"); DoctorInfor Infor = new DoctorInfor(); if (ds != null) { if (ds.Tables.Count>0 && ds.Tables[0].Rows.Count > 0) { Infor.Doctor_Code = Utility.sDbnull(ds.Tables[0].Rows[0]["Doctor_Code"]); Infor.Doctor_Name = Utility.sDbnull(ds.Tables[0].Rows[0]["Doctor_Name"]); Infor.Pos = Utility.Int16Dbnull(ds.Tables[0].Rows[0]["Pos"]); Infor.IsEmerency = Utility.Int16Dbnull(ds.Tables[0].Rows[0]["IsEmerency"]); Infor.Desc = Utility.sDbnull(ds.Tables[0].Rows[0]["Desc"]); return Infor; } else { return null; } } else { return null; } }
void AddProcSearchedFromMWL(string Patient_Code) { try { DataTable APParams_DataSource = new DoctorController().GetAnatomyProjectionParams().Tables[0]; if (m_dtAcquisitionDataSource == null || m_dtAcquisitionDataSource.Columns.Count <= 0 || m_dtAcquisitionDataSource.Rows.Count <= 0) { m_dtAcquisitionDataSource = new RegDetailController().GetAllData(-1).Tables[0]; } DataRow dr; m_dtAcquisitionDataSource.Rows.Clear(); if (m_dtAcquisitionDataSource.Rows.Count > 0) { dr = m_dtAcquisitionDataSource.Rows[0]; if (dr["reg_id"].ToString() == "-1") dr["REG_ID"] = currREGID; } else { dr = m_dtAcquisitionDataSource.NewRow(); dr["STATUS"] = 0; dr["IMGNAME"] = ""; dr["PRINTCOUNT"] = 0; dr["EXPOSURECOUNT"] = 0; dr["HOST"] = "127.0.0.1"; dr["UsingGrid"] = 0; dr["IMGDATA"] = DBNull.Value; dr["REG_NUMBER"] = txtRegNumber2.Text.Trim(); dr["REG_ID"] = currREGID; } DataTable dtAP = new DoctorController().GetAnatomyProjection(-1).Tables[0]; DataTable dtDefaultAP = new ProcedureController().GetEmerencyData().Tables[0]; //Lọc chỉ các dịch vụ được gửi từ worklistServer dtAP = GetAPfromMWL(dtAP, Patient_Code); if (dtAP != null && dtDefaultAP != null && dtAP.Columns.Count > 0 && dtDefaultAP.Columns.Count > 0) { try { foreach (DataRow drDefaultAP in dtDefaultAP.Rows) { if (dtAP.Select("ANATOMY_CODE='" + drDefaultAP["ANATOMY_CODE"].ToString() + "' AND PROJECTION_CODE='" + drDefaultAP["PROJECTION_CODE"].ToString() + "'").Length <= 0) dtAP.ImportRow(drDefaultAP); } } catch { } } DataRow newdr = m_dtAcquisitionDataSource.NewRow(); Utility.CopyData(dr, ref newdr); if (dtAP != null) { string SeriesInstanceUID = ""; foreach (DataRow drAP in dtAP.Rows) { RegDetailInfor infor = new RegDetailInfor(); int NextSeriesInstanceUID = MaxSeriesInstanceUID + 1; SeriesInstanceUID = CurrStudyInstanceUID + "." + NextSeriesInstanceUID.ToString(); MaxSeriesInstanceUID = NextSeriesInstanceUID; newdr["DETAIL_ID"] = -1; //SeriesInstanceUID=StudyInstanceUID+Số thứ tự dịch vụ trong lần đăng ký đó newdr["SeriesInstanceUID"] = SeriesInstanceUID; //SOPInstanceUID=SeriesInstanceUID+Số lần chụp của dịch vụ đó. //SOPInstanceUID chỉ thay đổi khi dịch vụ này đang có ảnh và lại được chụp lại newdr["SOPInstanceUID"] = SeriesInstanceUID + ".1"; newdr["REG_ID"] = dr["REG_ID"]; newdr["ANATOMY_CODE"] = drAP["ANATOMY_CODE"]; newdr["BODYSIZE_CODE"] = BODYSIZE_CODE; newdr["UsingGrid"] = 0; newdr["PROJECTION_CODE"] = drAP["PROJECTION_CODE"]; newdr["DISPLAY_NAME"] = drAP["ANATOMY_CODE"]; newdr["STANDARD_NAME"] = drAP["ANATOMY_CODE"]; newdr["DirectionCapture"] = 0; newdr["STATUS"] = 0; newdr["STATUS_NAME"] = ""; Utility.MapValueFromEntityIntoObjectInfor(infor, newdr); if (new RegDetailController(infor).Insert() == ActionResult.Success) { newdr["DETAIL_ID"] = infor.DETAIL_ID; decimal _kVp = 0M; int _mA = 0; int _mAs = 0; GetAPParams(APParams_DataSource, infor.ANATOMY_CODE, infor.PROJECTION_CODE, infor.BODYSIZE_CODE, ref _kVp, ref _mA, ref _mAs); //Add new Scheduled Control ScheduledControl _Scheduled = new ScheduledControl(txtImgDir.Text.Trim() + @"\" + txtRegNumber2.Text.Trim() + "_" + infor.DETAIL_ID.ToString(), (int)infor.REG_ID, (int)infor.DETAIL_ID, CurrStudyInstanceUID, SeriesInstanceUID, newdr["SOPInstanceUID"].ToString(), infor.ANATOMY_CODE, infor.PROJECTION_CODE, infor.BODYSIZE_CODE, Utility.sDbnull(drAP["VN_ANATOMY_NAME"], ""), Utility.sDbnull(drAP["EN_ANATOMY_NAME"], ""), Utility.sDbnull(drAP["VN_PROJECTION_NAME"], ""), Utility.sDbnull(drAP["EN_PROJECTION_NAME"], ""), BODYSIZE_NAME, BODYSIZE_NAME, _kVp, _mA, _mAs, Utility.Int32Dbnull(drAP["A_STT"], 0), Utility.Int32Dbnull(drAP["P_STT"], 0), Utility.Int32Dbnull(dr["PRINTCOUNT"], 0), 0); _Scheduled._OnClick += new ScheduledControl.OnClick(_ScheduledControl__OnClick); _Scheduled.ContextMenuStrip = ctx; _Scheduled._OnNewScheduleClick += new ScheduledControl.OnNewScheduleClick(_ScheduledControl__OnNewScheduleClick); _Scheduled._OnRejectScheduleClick += new ScheduledControl.OnRejectScheduleClick(_ScheduledControl__OnRejectScheduleClick); _Scheduled._OnDelScheduleClick += new ScheduledControl.OnDelScheduleClick(_ScheduledControl__OnDelScheduleClick); _Scheduled._OnNewScheduleDoubleClick += new ScheduledControl.OnNewScheduleDoubleClick(_ScheduledControl__OnNewScheduleDoubleClick); _Scheduled._OnRejectScheduleDoubleClick += new ScheduledControl.OnRejectScheduleDoubleClick(_ScheduledControl__OnRejectScheduleDoubleClick); _Scheduled._OnDelScheduleDoubleClick += new ScheduledControl.OnDelScheduleDoubleClick(_ScheduledControl__OnDelScheduleDoubleClick); _Scheduled._OnKeyDown += new ScheduledControl.OnKeyDown(_ScheduledControl__OnKeyDown); pnlScheduled.Controls.Add(_Scheduled); } m_dtAcquisitionDataSource.Rows.Add(newdr); m_dtAcquisitionDataSource.AcceptChanges(); newdr = m_dtAcquisitionDataSource.NewRow(); } } if (!AcquisitionFromWL) { //string[] Img = Utility.sDbnull(currentStudyRow["Img"]).Split('/'); //currentStudyRow["Img"] = Img[0] + "/" + (Convert.ToInt64(Img[1]) + _newForm.arrProc.Count).ToString(); //currentStudyRow["Img1"] = currentStudyRow["Img"]; } //Update Procedure List to DB and Datasource string ProcedureList = GetProcedureList(); new RegDetailController().UpdateProcedureList(Convert.ToInt64(dr["REG_ID"]), ProcedureList); //Update Dataset DataRow[] drWL = m_dtWLDataSource.Select("Reg_ID=" + Convert.ToInt64(dr["REG_ID"])); DataRow[] drST = m_dtStudyListDataSource.Select("Reg_ID=" + Convert.ToInt64(dr["REG_ID"])); if (drWL.Length > 0) drWL[0]["ProcedureList"] = ProcedureList; if (drST.Length > 0) drST[0]["ProcedureList"] = ProcedureList; m_dtWLDataSource.AcceptChanges(); m_dtStudyListDataSource.AcceptChanges(); } catch { } }
public void CreateEmerency() { try { action Act = action.Insert; DataTable dtPhysician = new DoctorController().GetAllData().Tables[0]; if (dtPhysician == null || dtPhysician.Rows.Count <= 0) { new frm_LargeMsgBoxOK(MultiLanguage.GetText(globalVariables.DisplayLanguage, "Thông báo", "Warning"), MultiLanguage.GetText(globalVariables.DisplayLanguage, "Đề nghị tạo danh mục bác sĩ trước khi thêm BN cấp cứu!", "Pls create Doctor list before add Emerency"), MultiLanguage.GetText(globalVariables.DisplayLanguage, "ĐỒNG Ý", "I see"), MultiLanguage.GetText(globalVariables.DisplayLanguage, "HỦY BỎ", "Cancel")).ShowDialog(); return; } DataSet dsEmerencyDataEntity = new DataSet(); DataTable EmerencyPatientEntity = new PatientEntity.PatientEntityDataTable(); DataTable EmerencyRegEntity = new RegEntity.RegEntityDataTable(); DataTable EmerencyRegDetailEntity = new RegDetailEntity.RegDetailEntityDataTable(); Utility.ResetEntity(ref dsEmerencyDataEntity); Utility.ResetEntity(ref EmerencyPatientEntity); Utility.ResetEntity(ref EmerencyRegDetailEntity); Utility.ResetEntity(ref EmerencyRegEntity); //Create new Row string PID = Utility.GetYYYYMMDDHHMMSS(DateTime.Now); DataRow dr0 = EmerencyPatientEntity.NewRow(); dr0["Patient_ID"] = -1; dr0["Age"] = 20; dr0["PATIENT_CODE"] = Utility.GetValue(PID, false); dr0["Patient_Name"] = "Bệnh nhân cấp cứu vào lúc " + PID; dr0["Birth_Date"] = DateTime.Now.AddYears(-20); dr0["sBirth_Date"] = DateTime.Now.AddYears(-20).ToString("dd/MM/yyyy"); //dr0["Doctor_Name"] = cboPhysician.Text; dr0["Sex"] = 0;//Mặc định là Male dr0["EMERGENCY"] = 1;//BN cấp cứu EmerencyPatientEntity.Rows.Add(dr0); EmerencyPatientEntity.AcceptChanges(); //Tao thong tin dang ky chup DataRow dr1 = EmerencyRegEntity.NewRow(); dr1["REG_ID"] = -1; //dr1["REGSTATUS"] = 1; dr1["REG_NUMBER"] = dr0["PATIENT_CODE"]; dr1["PATIENT_ID"] = dr0["Patient_ID"]; //dr1["DESC"] = Utility.GetValue("Bệnh nhân cấp cứu cần chụp ngay", false); DataTable dtAP = new ProcedureController().GetEmerencyData().Tables[0]; DataSet dsEmerencyDoctor = new DoctorController().GetEmerencyData(); ArrayList Emerency_arrProc = new ArrayList(); string ProcList = ""; int totalProc = 0; if (dtAP == null || dtAP.Rows.Count <= 0) { frm_Choose_Anotomy_Projection _Choose_Anotomy_Projection = new frm_Choose_Anotomy_Projection(-1); if (_Choose_Anotomy_Projection.ShowDialog() == DialogResult.OK) { dtAP = _Choose_Anotomy_Projection.AP_DataSource.Select("CHON=1").CopyToDataTable(); ProcList = GetProcedureEmerency(dtAP); dr1["PROCEDURELIST"] = ProcList; } } else { //Update Procedure List to DB and Datasource ProcList = GetProcedureEmerency(dtAP); dr1["PROCEDURELIST"] = ProcList; } //Tự động gán bác sĩ cấp cứu if (dsEmerencyDoctor != null && dsEmerencyDoctor.Tables.Count > 0 && dsEmerencyDoctor.Tables[0].Rows.Count > 0) dr1["PHYSICIAN"] = dsEmerencyDoctor.Tables[0].Rows[0]["DOCTOR_CODE"].ToString(); else dr1["PHYSICIAN"] = dtPhysician.Rows[0]["DOCTOR_CODE"].ToString(); dr1["CREATED_DATE"] = DateTime.Now; EmerencyRegEntity.Rows.Add(dr1); EmerencyRegEntity.AcceptChanges(); //Tao thong tin dang ky chup chi tiet if (dtAP != null) { foreach (DataRow drAP in dtAP.Rows) { DataRow dr2 = EmerencyRegDetailEntity.NewRow(); dr2["DETAIL_ID"] = -1; dr2["REG_ID"] = dr1["REG_ID"]; dr2["ANATOMY_CODE"] = drAP["ANATOMY_CODE"]; dr2["PROJECTION_CODE"] = drAP["PROJECTION_CODE"]; dr2["STATUS"] = 0; totalProc += 1; EmerencyRegDetailEntity.Rows.Add(dr2); EmerencyRegDetailEntity.AcceptChanges(); } } dsEmerencyDataEntity.Tables.Add(EmerencyPatientEntity); dsEmerencyDataEntity.Tables.Add(EmerencyRegEntity); dsEmerencyDataEntity.Tables.Add(EmerencyRegDetailEntity); //Now AutoSave Emerency Patient WLRules _BusRule = new WLRules(); //Gọi nghiệp vụ Insert dữ liệu PatientInfor _PatientInfor = new PatientInfor(); RegInfor _RegInfor = new RegInfor(); ActionResult InsertResult = _BusRule.Insert(dsEmerencyDataEntity, _PatientInfor, _RegInfor); if (InsertResult == ActionResult.Success)//Nếu thành công { //Thêm mới một dòng vào Datasource để cập nhật lại dữ liệu trên DataGridView //phải đảm bảo Datasource và RoomEntity có cấu trúc giống nhau mới dùng hàm này DataRow newRow = m_dtWLDataSource.NewRow(); newRow["Patient_ID"] = _PatientInfor.Patient_ID; newRow["PATIENT_CODE"] = Utility.GetValue(PID, false); newRow["Patient_Name"] = "Bệnh nhân cấp cứu vào lúc " + PID; newRow["Birth_Date"] = DateTime.Now.AddYears(-20); newRow["sBirth_Date"] = DateTime.Now.AddYears(-20).ToShortDateString(); newRow["Sex"] = 0; newRow["Age"] = 0; newRow["EMERGENCY"] = 20; newRow["REG_ID"] = _RegInfor.REG_ID; newRow["REG_NUMBER"] = newRow["PATIENT_CODE"]; newRow["REGSTATUS"] = 1; newRow["PROCEDURELIST"] = ProcList; if (dsEmerencyDoctor != null && dsEmerencyDoctor.Tables.Count > 0 && dsEmerencyDoctor.Tables[0].Rows.Count > 0) { newRow["PHYSICIAN"] = dsEmerencyDoctor.Tables[0].Rows[0]["DOCTOR_CODE"].ToString(); newRow["Doctor_Name"] = dsEmerencyDoctor.Tables[0].Rows[0]["DOCTOR_Name"].ToString(); } else { newRow["PHYSICIAN"] = dtPhysician.Rows[0]["DOCTOR_CODE"].ToString(); newRow["Doctor_Name"] = dtPhysician.Rows[0]["DOCTOR_Name"].ToString(); } newRow["CREATED_DATE"] = DateTime.Now; newRow["sCREATED_DATE"] = DateTime.Now.ToShortDateString(); newRow["SEX_NAME"] = "Male"; newRow["CanDel"] = 1; newRow["HasProcessed"] = 0; newRow["NoneProcessed"] = 1; newRow["TotalProc"] = totalProc; if (newRow != null)//99.99% là sẽ !=null { m_dtWLDataSource.Rows.Add(newRow); m_dtWLDataSource.AcceptChanges(); } //Return to the InitialStatus Act = action.FirstOrFinished; //Tự động Suspending Bệnh nhân đang được chọn ở mục Acquisition SuspendCurrentPatient(); //Nhảy đến bản ghi vừa thêm mới trên lưới. Do txtID chưa bị reset nên dùng luôn Utility.GotoNewRow(grdWorkList, "colPatient_ID", _PatientInfor.Patient_ID.ToString()); //Tự động chuyển BN cấp cứu vào phần Acquisition BeginExam(); } else//Có lỗi xảy ra { switch (InsertResult) { case ActionResult.ExistedRecord: mdlStatic.SetMsg(lblMsg, "Lỗi trong khi tạo Bệnh nhân cấp cứu!\nĐã tồn tại Bệnh nhân có mã: " + _PatientInfor.Patient_Code + ". Đề nghị bạn xem lại", true); //Utility.FocusAndSelectAll(txtID); break; default: mdlStatic.SetMsg(lblMsg, "Lỗi trong quá trình thêm mới Bệnh nhân cấp cứu. Liên hệ với VBIT", true); break; } } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }
private void cmdSaveParam_VN_Click(object sender, EventArgs e) { try { ScheduledControl _ScheduledControl = GetSelectedScheduled(); if (_ScheduledControl != null) { string errMsg = ""; ActionResult actResult = new DoctorController().InsertAPParam_Acq(_ScheduledControl.A_Code, _ScheduledControl.P_Code, BODYSIZE_CODE, lblKvpVal.Value, (int)lblmAVal.Value, (int)lblmAsVal.Value, "", m_intCurrDevice1, 0, 0, ref errMsg); if (actResult == ActionResult.Success) { SetText(lblResult, "Save OK"); } else SetText(lblResult, "Save failed"); } } catch { } }
void AutomaticDetect3Params() { try { ScheduledControl _selectedItem = GetSelectedScheduled(); if (_selectedItem == null) { return; } DataSet ds = new DoctorController().GetAPParams(_selectedItem.A_Code, _selectedItem.P_Code, BODYSIZE_CODE); if (ds == null || ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0) { return; } DataRow dr = ds.Tables[0].Rows[0]; kVp = Utility.DecimaltoDbnull(dr["kVp"], MinKvp); mA = Utility.Int32Dbnull(dr["mA"], MinmA); mAs = Utility.Int32Dbnull(dr["mAs"], MinmAs); if (kVp < MinKvp) kVp = MinKvp; if (kVp > MaxKvp) kVp = MaxKvp; if (mA < MinmA) mA = MinmA; if (mA > MaxmA) mA = MaxmA; if (mAs < MinmAs) mAs = MinmAs; if (mAs > MaxmAs) mAs = MaxmAs; if (!isGCOM_VN) { SetValueNumeric(lblKvpVal, kVp); SetValueNumeric(lblmAVal, mA); SetValueNumeric(lblmAsVal, mAs); } else { SetValueNumeric(lblAMEC_KvpVal, kVp); SetValueNumeric(lblAMEC_mAVal, mA); SetValueNumeric(lblAMEC_timeVal, mAs); } } catch { } }
private void cmdDel_Click(object sender, EventArgs e) { try { if (new frm_LargeMsgBox("Xác nhận xóa vị trí chụp", "Bạn có muốn xóa vị trí chụp có mã " + _currA.Code + "(" + _currA.Vn_Name + ") không?", "Đồng ý xóa", "Không xóa").ShowDialog() == DialogResult.OK) { DoctorController _DoctorController = new DoctorController(); if (_DoctorController.AnatomyHasUsed(_currA.Code) != ActionResult.Success) { new frm_LargeMsgBoxOK("Thông báo", "Vị trí chụp này đã được sử dụng trong bảng khác nên bạn không thể xóa. Đề nghị bạn kiểm tra lại", "Đồng ý", "").ShowDialog(); return; } foreach (Control ctr in pnlAnatomyList.Controls) { AnatomyControl _Anatomy = ctr as AnatomyControl; if (_Anatomy.isPressed && _Anatomy.Code == _currA.Code) { if (_DoctorController.DeleteAnatomy(_currA.Code) == ActionResult.Success) { pnlAnatomyList.Controls.Remove(_Anatomy); new frm_LargeMsgBoxOK("Thông báo", "Đã xóa thành công vị trí chụp có mã " + _currA.Code + "(" + _currA.Vn_Name + ")", "Đồng ý", "").ShowDialog(); } } } } } catch { } finally { cmdDel.Enabled = HasSelectedAnatomy(); cmdUpdate.Enabled = cmdDel.Enabled; } }