private void initConfig() { fEdit = new Font(ic.iniC.grdViewFontName, ic.grdViewFontSize, FontStyle.Regular); fEditB = new Font(ic.iniC.grdViewFontName, ic.grdViewFontSize, FontStyle.Bold); //C1ThemeController.ApplicationTheme = ic.iniC.themeApplication; theme1.Theme = ic.iniC.themeApplication; theme1.SetTheme(sB, "BeigeOne"); txtDateEnd.Value = System.DateTime.Now; txtDateStart.Value = System.DateTime.Now; sB1.Text = ""; bg = txtHn.BackColor; fc = txtHn.ForeColor; ff = txtHn.Font; stt = new C1SuperTooltip(); sep = new C1SuperErrorProvider(); lbReq = new LabRequest(); //btnNew.Click += BtnNew_Click; int timerlab = 0; int.TryParse(ic.iniC.timerlabreqaccept, out timerlab); btnSearch.Click += BtnSearch_Click; timer = new Timer(); timer.Interval = timerlab * 1000; timer.Tick += Timer_Tick; timer.Enabled = true; initGrfReq(); setGrfReq(); }
public JsonResult AddLabItem() { LabResponse response = new LabResponse(); FormExamineLabModel _model = new FormExamineLabModel(); if (Request.Form["FormMedicalID"] != null) { _model.FormMedicalID = Convert.ToInt64(Request.Form["FormMedicalID"].ToString()); } if (Request.Form["LabItems"] != null) { _model.LabItemsId = JsonConvert.DeserializeObject <List <int> >(Request.Form["LabItems"]); } if (Session["UserLogon"] != null) { _model.Account = (AccountModel)Session["UserLogon"]; } if (Session["QueuePoliId"] != null) { if (_model.LoketData == null) { _model.LoketData = new LoketModel(); } _model.LoketData.Id = Convert.ToInt64(Session["QueuePoliId"].ToString()); } var request = new LabRequest { Data = _model }; new LabValidator(_unitOfWork, _context).Validate(request, out response); return(Json(new { Status = response.Status, Message = response.Message }, JsonRequestBehavior.AllowGet)); }
public LabResponse GetLabForInput(LabRequest request) { List <FormExamineLabModel> lists = new List <FormExamineLabModel>(); dynamic qry = null; var searchPredicate = PredicateBuilder.New <FormExamineLab>(true); var _getQueuePoliData = _unitOfWork.RegistrationRepository.GetById(request.Data.LoketData.Id); searchPredicate = searchPredicate.And(x => x.FormMedicalID == _getQueuePoliData.FormMedicalID && x.LabType == Constants.NameConstant.Laboratorium); qry = _unitOfWork.FormExamineLabRepository.Get(searchPredicate, null); foreach (var item in qry) { var prData = Mapper.Map <FormExamineLab, FormExamineLabModel>(item); lists.Add(prData); } int totalRequest = lists.Count(); var data = lists; var response = new LabResponse { Draw = request.Draw, RecordsFiltered = totalRequest, RecordsTotal = totalRequest, Data = data }; return(response); }
public ActionResult GetLabItemForInput() { var _draw = Request.Form.GetValues("draw").FirstOrDefault(); var _start = Request.Form.GetValues("start").FirstOrDefault(); var _length = Request.Form.GetValues("length").FirstOrDefault(); var _searchValue = Request.Form.GetValues("search[value]").FirstOrDefault(); int _pageSize = _length != null?Convert.ToInt32(_length) : 0; int _skip = _start != null?Convert.ToInt32(_start) : 0; var request = new LabRequest { Draw = _draw, SearchValue = _searchValue, PageSize = _pageSize, Skip = _skip, }; if (request.Data == null) { request.Data = new FormExamineLabModel(); } request.Data.LoketData = new LoketModel { Id = Convert.ToInt64(Session["QueuePoliId"]) }; var response = new LabHandler(_unitOfWork, _context).GetLabForInput(request); return(Json(new { data = response.Data, recordsFiltered = response.RecordsFiltered, recordsTotal = response.RecordsTotal, draw = response.Draw }, JsonRequestBehavior.AllowGet)); }
public ActionResult CreateItemLab() { LabResponse response = new LabResponse(); if (Request.QueryString["id"] != null) { var request = new LabRequest { Data = new FormExamineLabModel { LoketData = new LoketModel { Id = long.Parse(Request.QueryString["id"].ToString()), }, } }; if (Session["UserLogon"] != null) { request.Data.Account = (AccountModel)Session["UserLogon"]; } LabResponse resp = new LabHandler(_unitOfWork).GetDetailPatient(request.Data.LoketData.Id); FormExamineLabModel _model = resp.Entity; Session["QueuePoliId"] = resp.Entity.LoketData.Id; _model.LabItemsId = LabHandler.GetSelectedLabItem(request.Data.LoketData.Id); return(View(_model)); } ViewBag.LabCategory = BindLabCategory(Constants.NameConstant.Laboratorium); return(View()); }
public void Validate(LabRequest request, out LabResponse response) { bool isHavePrivilege = true; response = new LabResponse(); try { if (request.Data.FormMedicalID == 0) { errorFields.Add("Form Medical ID"); } if (request.Data.LabItemsId.Count == 0) { errorFields.Add("Lab Item"); } if (errorFields.Any()) { response.Status = false; response.Message = string.Format(Messages.ValidationErrorFields, String.Join(",", errorFields)); } //cek is lab item inside form nedical Id already filled var _qryFormExamineLab = _unitOfWork.RegistrationRepository.GetFirstOrDefault(x => x.FormMedicalID == request.Data.FormMedicalID); if (_qryFormExamineLab != null) { if (_qryFormExamineLab.Status == (int)RegistrationStatusEnum.Finish) { response.Status = false; response.Message = Messages.LabItemCannotChange; } } isHavePrivilege = IsHaveAuthorization(ADD_PRIVILEGE_NAME, request.Data.Account.Privileges.PrivilegeIDs); if (!isHavePrivilege) { response.Status = false; response.Message = Messages.UnauthorizedAccess; } } catch (Exception ex) { response.Status = false; response.Message = ex.Message; } if (response.Status) { response = new LabHandler(_unitOfWork, _context).CreateOrEdit(request); } }
public async Task <IActionResult> UpsertLab([ModelBinder(typeof(JsonWithFilesFormDataModelBinder), Name = "json")] LabRequest labRequest) { await DatabaseContext.Database.BeginTransactionAsync(); var lab = Map <Lab>(labRequest); if (!GetUser().CanEditModules()) { return(Forbid("You are not allowed to edit labs")); } var module = await DatabaseContext.Modules.Where(m => m.Id == lab.ModuleId).FirstOrDefaultAsync(); // prevent someone from editing another user's module unless they are admin. if (lab.Id != 0 && module.OwnerId != GetUser().Id&& !GetUser().IsAdmin()) { return(Forbid("You are not allowed to edit this module")); } lab.LinkBridgeTemplates(); if (lab.Id == 0) { await DatabaseContext.Labs.AddAsync(lab); } else { await lab.DeleteMissingProperties(DatabaseContext); DatabaseContext.Labs.Update(lab); } await DatabaseContext.SaveChangesAsync(); if (labRequest.Topology != null) { var stream = System.IO.File.Open(lab.GetTopologyPath(), FileMode.Create); await labRequest.Topology.CopyToAsync(stream); stream.Close(); } if (labRequest.Readme != null) { var stream = System.IO.File.Open(lab.GetReadmePath(), FileMode.Create); await labRequest.Readme.CopyToAsync(stream); stream.Close(); } DatabaseContext.Database.CommitTransaction(); lab.DetectAttachments(); return(Ok(lab)); }
private void initConfig() { theme1 = new C1.Win.C1Themes.C1ThemeController(); theme1.Theme = "Office2013Red"; stt = new C1SuperTooltip(); sep = new C1SuperErrorProvider(); lbReq = new LabRequest(); txtReqDate.Value = System.DateTime.Now.Year + "-" + System.DateTime.Now.ToString("MM-dd HH:mm:ss"); btnReq.Image = Resources.Ticket_24; ic.ivfDB.itmDB.setCboItem(cboLabReq, ""); ic.ivfDB.dtrOldDB.setCboDoctor(cboDoctor, ""); btnSearch.Click += BtnSearch_Click; btnReq.Click += BtnReq_Click; }
public void ValidateAddResult(LabRequest request, out LabResponse response) { bool isHavePrivilege = true; response = new LabResponse(); try { if (request.Data.FormMedicalID == 0) { errorFields.Add("Form Medical ID"); } if (request.Data.LabItemCollsJs.Count == 0) { errorFields.Add("Lab Result"); } if (errorFields.Any()) { response.Status = false; response.Message = string.Format(Messages.ValidationErrorFields, String.Join(",", errorFields)); } isHavePrivilege = IsHaveAuthorization(ADD_RESULT_PRIVILEGE_NAME, request.Data.Account.Privileges.PrivilegeIDs); if (!isHavePrivilege) { response.Status = false; response.Message = Messages.UnauthorizedAccess; } } catch (Exception ex) { response.Status = false; response.Message = ex.Message; } if (response.Status) { response = new LabHandler(_unitOfWork, _context).CreateLabResult(request); } }
public ActionResult InputLabResult() { LabResponse response = new LabResponse(); var _model = new FormExamineLabModel { }; if (Request.QueryString["id"] != null) { var request = new LabRequest { Data = new FormExamineLabModel { LoketData = new LoketModel { Id = long.Parse(Request.QueryString["id"].ToString()), }, } }; if (Session["UserLogon"] != null) { request.Data.Account = (AccountModel)Session["UserLogon"]; } LabResponse resp = new LabHandler(_unitOfWork).GetDetailPatient(request.Data.LoketData.Id); _model = resp.Entity; LabResponse resp2 = new LabHandler(_unitOfWork).GetDataExamine(request.Data.LoketData.Id); if (_model.FormExamine == null) { _model.FormExamine = new FormExamineModel(); } _model.FormExamine.Result = resp2.Entity.FormExamine.Result; _model.FormExamine.DoctorID = resp2.Entity.FormExamine.DoctorID; Session["QueuePoliId"] = resp.Entity.LoketData.Id; } ViewBag.DoctorList = BindDropDownDokter(); return(View(_model)); }
private void acceptLabOPUAdd(String reqid, String name, String vn, String dtrid, String remark, String hn, Boolean flagOpen, String dobfemale, String itmcode) { ic.cStf.staff_id = ""; FrmPasswordConfirm frm = new FrmPasswordConfirm(ic); frm.ShowDialog(this); if (!ic.cStf.staff_id.Equals("")) { lbReq = ic.ivfDB.setLabRequest(name, vn, dtrid, remark, hn, dobfemale, reqid, itmcode, "", "", "", "", "", ""); String re = ic.ivfDB.lbReqDB.insertLabRequest(lbReq, ""); long chk1 = 0; if (long.TryParse(re, out chk1)) { String re1 = ic.ivfDB.lbReqDB.UpdateStatusRequestAccept(re, ic.cStf.staff_id); String re4 = ic.ivfDB.lbReqDB.UpdateStatusRequestProcess(re, ic.cStf.staff_id); String re2 = ic.ivfDB.lbReqDB.UpdateStatusRequestAcceptOld(reqid, re); if (long.TryParse(re2, out chk1)) { //LabOpu opu = new LabOpu(); //LabRequest lbreq = new LabRequest(); //lbreq = ic.ivfDB.lbReqDB.selectByPk1(reqId); //opu.opu_id = ""; //opu.opu_code = ic.ivfDB.copDB.genOPUDoc(); //opu.embryo_freez_stage = ""; //opu.embryoid_freez_position = ""; //opu.hn_male = ""; //opu.hn_female = lbreq.hn_female; //opu.name_male = ""; //opu.name_female = lbreq.name_female; //opu.remark = ""; //opu.dob_female = ""; //opu.dob_male = ""; //opu.doctor_id = lbreq.doctor_id; //opu.proce_id = ""; //opu.opu_date = DateTime.Now.Year.ToString()+"-"+ System.DateTime.Now.ToString("MM-dd"); //opu.req_id = reqId; LabOpu opu = ic.ivfDB.setOPU(re); String re3 = ic.ivfDB.opuDB.insert(opu, ic.cStf.staff_id); if (long.TryParse(re3, out chk1)) { setGrfReq(); if (flagOpen) { if (itmcode.Equals("112")) { FrmLabOPUAdd2 frm1 = new FrmLabOPUAdd2(ic, "", re3); String txt = ""; if (!name.Equals("")) { txt = "ป้อน LAB OPU " + name; } else { txt = "ป้อน LAB OPU ใหม่ "; } frm1.FormBorderStyle = FormBorderStyle.None; menu.AddNewTab(frm1, txt); } else if (itmcode.Equals("160")) { FrmLabFetAdd3 frm1 = new FrmLabFetAdd3(ic, "", re3); String txt = ""; if (!name.Equals("")) { txt = "ป้อน LAB OPU " + name; } else { txt = "ป้อน LAB OPU ใหม่ "; } frm1.FormBorderStyle = FormBorderStyle.None; menu.AddNewTab(frm1, txt); } } } else { MessageBox.Show("Error gen OPU", ""); } } else { MessageBox.Show("ไม่สามารถ update status accept", "error"); } } //int chk = 0; } }
private void setControl() { lFormDay1 = ic.ivfDB.lformDay1DB.selectByPk1(lformDay1Id); vs = ic.ivfDB.vsDB.selectByPk1(vsid); ptt = ic.ivfDB.pttDB.selectByPk1(pttid); if (lFormDay1.form_day1_id.Equals("")) { lFormDay1 = ic.ivfDB.lformDay1DB.selectByVsId(vs.t_visit_id); } if (!lFormDay1.form_day1_id.Equals("")) // found { LabRequest req = new LabRequest(); //opu = ic.ivfDB.opuDB.selectByReqID(req.req_id); setControl1(); } else// Not found { ovs = ic.ivfDB.ovsDB.selectByPk1(vsidOld); txtHnFeMale.Value = ptt.patient_hn; txtNameFeMale.Value = ptt.Name; txtDobFeMale.Value = ptt.AgeString(); txtHnMale.Value = ptt.patient_hn_couple; txtNameMale.Value = ptt.patient_couple_firstname; txtPttId.Value = ptt.t_patient_id; txtVsId.Value = vs.t_visit_id; txtAgent.Value = ic.ivfDB.oAgnDB.getAgentNameById(ptt.agent); ic.setC1Combo(cboDoctor, vs.doctor_id); txtFormDay1Date.Value = DateTime.Now.Year.ToString() + "-" + DateTime.Now.ToString("MM-dd"); if (ic.iniC.statusAppDonor.Equals("1")) { if (ptt.f_sex_id.Equals("1"))//male { Patient ptt1 = new Patient(); ptt1 = ic.ivfDB.pttDB.selectByHn(ptt.patient_hn_1); txtHnMale.Value = ptt.patient_hn; txtNameMale.Value = ptt.Name; txtHnFeMale.Value = ptt.patient_hn_1; txtNameFeMale.Value = ptt1.Name; txtDobFeMale.Value = ptt1.patient_birthday; txtDobMale.Value = ptt.patient_birthday; } else if (ptt.f_sex_id.Equals("2")) //female { if (!ptt.patient_hn_1.Equals("") && !ptt.patient_hn_2.Equals("")) // record donor { txtHnFeMale.Value = ptt.patient_hn_1; txtHnMale.Value = ptt.patient_hn_2; txtHnDonor.Value = ptt.patient_hn; txtNameDonor.Value = ptt.Name; Patient ptt1 = new Patient(); ptt1 = ic.ivfDB.pttDB.selectByHn(ptt.patient_hn_1); txtNameFeMale.Value = ptt1.Name; Patient ptt2 = new Patient(); ptt2 = ic.ivfDB.pttDB.selectByHn(ptt.patient_hn_2); txtNameMale.Value = ptt2.Name; txtDobFeMale.Value = ptt1.patient_birthday; txtDobMale.Value = ptt2.patient_birthday; } else if (ptt.patient_hn_1.Equals("") && !ptt.patient_hn_2.Equals("")) // record female { Patient ptt1 = new Patient(); ptt1 = ic.ivfDB.pttDB.selectByHn(ptt.patient_hn_2); txtHnMale.Value = ptt.patient_hn_2; txtNameMale.Value = ptt1.Name; txtHnFeMale.Value = ptt.patient_hn; txtNameFeMale.Value = ptt.Name; txtDobMale.Value = ptt1.patient_birthday; txtDobFeMale.Value = ptt.patient_birthday; } } } else { if (ptt.f_sex_id.Equals("1"))//male { Patient ptt1 = new Patient(); ptt1 = ic.ivfDB.pttDB.selectByHn(ptt.patient_hn_1); txtHnMale.Value = ptt.patient_hn; txtNameMale.Value = ptt.Name; txtHnFeMale.Value = ptt.patient_hn_1; txtNameFeMale.Value = ptt1.Name; txtDobMale.Value = ptt.patient_birthday; txtDobFeMale.Value = ptt1.patient_birthday; } else if (ptt.f_sex_id.Equals("2"))//female { Patient ptt2 = new Patient(); ptt2 = ic.ivfDB.pttDB.selectByHn(ptt.patient_hn_2); txtHnMale.Value = ptt.patient_hn_2; txtNameMale.Value = ptt2.Name; txtHnFeMale.Value = ptt.patient_hn; txtNameFeMale.Value = ptt.Name; txtDobMale.Value = ptt2.patient_birthday; txtDobFeMale.Value = ptt.patient_birthday; } } } }
public LabResponse CreateOrEdit(LabRequest request) { int result = 0; var response = new LabResponse { }; var _getDataLabPoli = _unitOfWork.LabItemRepository.Get(x => x.RowStatus == 0); #region ::DELETE FIRST:: var _deleteFormExamineLab = _unitOfWork.FormExamineLabRepository.Get(x => x.FormMedicalID == request.Data.FormMedicalID && x.LabType == Constants.NameConstant.Laboratorium); foreach (var item1 in _deleteFormExamineLab) { _unitOfWork.FormExamineLabRepository.Delete(item1.ID); } var poliId = PoliHandler.GetPoliIDBasedOnName(Constants.NameConstant.Laboratorium); var _deleteFormExamine = _unitOfWork.FormExamineRepository.GetFirstOrDefault(x => x.FormMedicalID == request.Data.FormMedicalID && x.PoliID == poliId); if (_deleteFormExamine != null) { _unitOfWork.FormExamineRepository.Delete(_deleteFormExamine.ID); } int deleteResult = _unitOfWork.Save(); #endregion //insert to Form Examine try { var _formExamine = new FormExamine { FormMedicalID = request.Data.FormMedicalID, PoliID = PoliHandler.GetPoliIDBasedOnName(Constants.NameConstant.Laboratorium), TransDate = DateTime.Now, CreatedBy = request.Data.Account.UserName, CreatedDate = DateTime.Now }; _unitOfWork.FormExamineRepository.Insert(_formExamine); foreach (var _id in request.Data.LabItemsId) { var _formExamineLabEntity = new FormExamineLab { FormMedicalID = request.Data.FormMedicalID, LabType = _getDataLabPoli.Where(x => x.ID == _id).FirstOrDefault().LabItemCategory.LabType, LabItemID = (Int32)_id, CreatedBy = request.Data.Account.UserName, CreatedDate = DateTime.Now }; _unitOfWork.FormExamineLabRepository.Insert(_formExamineLabEntity); } result = _unitOfWork.Save(); if (result > 0) { var _editQueuePoli = _unitOfWork.RegistrationRepository.GetById(request.Data.LoketData.Id); if (_editQueuePoli != null) { _editQueuePoli.Status = (int)RegistrationStatusEnum.Hold; _editQueuePoli.ModifiedBy = request.Data.Account.UserName; _editQueuePoli.ModifiedDate = DateTime.Now; _unitOfWork.RegistrationRepository.Update(_editQueuePoli); _unitOfWork.Save(); } } response.Status = true; response.Message = string.Format(Messages.LabItemAdded, result, request.Data.FormMedicalID); } catch (Exception ex) { response.Status = false; response.Message = Messages.GeneralError; } return(response); }
public LabResponse CreateLabResult(LabRequest request) { var response = new LabResponse { }; FormExamineLabModel model = new FormExamineLabModel(); if (model.LabItemColls == null) { model.LabItemColls = new List <FormExamineLabModel>(); } try { foreach (var item in request.Data.LabItemCollsJs.Where(x => x.name.StartsWith("Result_"))) { string[] temp = item.name.Split('_'); if (temp[0].ToLower() == "result") { //pertama Id FormExLab kedua Lab Item string[] _ids = temp[1].Split('|'); long _Id = Convert.ToInt64(_ids[0]); int _LabItemID = Convert.ToInt32(_ids[1]); string _result = item.value; string _resultIndicator = request.Data.LabItemCollsJs.Where(x => x.name == "ResultIndicator_" + temp[1]).FirstOrDefault().value; var _existing = _unitOfWork.FormExamineLabRepository.Get(x => x.ID == _Id && x.LabItemID == _LabItemID).FirstOrDefault(); if (_existing != null) { _existing.Result = _result; _existing.ResultIndicator = _resultIndicator; _existing.ModifiedBy = request.Data.Account.UserName; _existing.ModifiedDate = DateTime.Now; _unitOfWork.FormExamineLabRepository.Update(_existing); } } } var _existingExam = _unitOfWork.FormExamineRepository.GetFirstOrDefault(x => x.FormMedicalID == request.Data.FormMedicalID); if (_existingExam != null) { _existingExam.Result = request.Data.FormExamine.Result; _existingExam.DoctorID = request.Data.FormExamine.DoctorID; _existingExam.ModifiedBy = request.Data.Account.UserName; _existingExam.ModifiedDate = DateTime.Now; _unitOfWork.FormExamineRepository.Update(_existingExam); } var _editQueuePoli = _unitOfWork.RegistrationRepository.GetById(request.Data.LoketData.Id); if (_editQueuePoli != null) { _editQueuePoli.Status = (int)RegistrationStatusEnum.Finish; _editQueuePoli.ModifiedBy = request.Data.Account.UserName; _editQueuePoli.ModifiedDate = DateTime.Now; _unitOfWork.RegistrationRepository.Update(_editQueuePoli); } int result_affected = _unitOfWork.Save(); if (result_affected > 0) { response.Status = true; response.Message = Messages.LabResultUpdated; } } catch (Exception ex) { response.Status = false; response.Message = Messages.GeneralError; } return(response); }
public LabResponse RemoveData(LabRequest request) { throw new NotImplementedException(); }
public LabResponse GetDetail(LabRequest request) { throw new NotImplementedException(); }
private void ContextMenu_sticker(object sender, System.EventArgs e) { String chk1 = "", name = "", id = "", vsid = "", resid = "", re3 = ""; if (grfReq.Row < 0) { return; } id = grfReq[grfReq.Row, colReqId] != null ? grfReq[grfReq.Row, colReqId].ToString() : ""; vsid = grfReq[grfReq.Row, colReqVsId] != null ? grfReq[grfReq.Row, colReqVsId].ToString() : ""; if (id.Length <= 0) { return; } SetDefaultPrinter(ic.iniC.printerSticker); DataTable dt = new DataTable(); dt.Columns.Add("hn", typeof(String)); dt.Columns.Add("name", typeof(String)); dt.Columns.Add("age", typeof(String)); dt.Columns.Add("vn", typeof(String)); dt.Columns.Add("path_barcode", typeof(String)); LabRequest lbreq = new LabRequest(); lbreq = ic.ivfDB.lbReqDB.selectByPk1(id); Visit vs = new Visit(); vs = ic.ivfDB.vsDB.selectByPk1(vsid); Patient ptt = new Patient(); ptt = ic.ivfDB.pttDB.selectByPk1(vs.t_patient_id); Lis lis = new Lis(); lis.lis_id = ""; lis.barcode = ""; lis.req_id = id; lis.visit_vn = vs.visit_vn; lis.patient_name = ptt.Name; lis.visit_hn = ptt.patient_hn; lis.visit_id = vs.t_visit_id; lis.message_lis = ""; lis.active = ""; lis.remark = ""; lis.date_create = ""; lis.date_modi = ""; lis.date_cancel = ""; lis.user_create = ""; lis.user_modi = ""; lis.user_cancel = ""; lis.statis_lis = ""; lis.date_time_receive = ""; lis.date_time_finish = ""; lis.lab_id = lbreq.lab_id; re3 = ic.ivfDB.lisDB.insertLis(lis, ic.cStf.staff_id); String re = "", re1 = "", re2 = ""; long chk = 0, chk2 = 0; Lis lis1 = new Lis(); lis1 = ic.ivfDB.lisDB.selectByPk(re3); DataRow row11 = dt.NewRow(); row11["hn"] = vs.visit_hn; row11["name"] = ptt.Name; row11["age"] = "Age " + ptt.AgeStringShort() + " [" + ic.datetoShow(ptt.patient_birthday) + "]"; row11["vn"] = lis1.barcode; row11["path_barcode"] = System.IO.Directory.GetCurrentDirectory() + "\\report\\" + lis1.barcode + ".jpg"; dt.Rows.Add(row11); if (!Directory.Exists("report")) { Directory.CreateDirectory("report"); } if (!File.Exists(System.IO.Directory.GetCurrentDirectory() + "\\report\\" + lis1.barcode + ".jpg")) { File.Delete(System.IO.Directory.GetCurrentDirectory() + "\\report\\" + lis1.barcode + ".jpg"); } C1BarCode barc = new C1BarCode(); if (ic.iniC.lisBarcode.Equals("Code_128_B")) { barc.CodeType = C1.BarCode.CodeType.Code_128_B; } else if (ic.iniC.lisBarcode.Equals("Code_128_A")) { barc.CodeType = C1.BarCode.CodeType.Code_128_A; } else if (ic.iniC.lisBarcode.Equals("Code_128_C")) { barc.CodeType = C1.BarCode.CodeType.Code_128_C; } else if (ic.iniC.lisBarcode.Equals("Code_128auto")) { barc.CodeType = C1.BarCode.CodeType.Code_128auto; } else if (ic.iniC.lisBarcode.Equals("Code_128auto")) { //barc.CodeType = C1.BarCode.CodeType.en; } else { } barc.Size = new Size(100, 60); barc.BarHeight = 60; barc.Text = lis1.barcode; Bitmap bitm = new Bitmap(100, 40); //bitm = barc.Image; Image img = barc.Image; //img.Size = new Size(100, 40); img.Save(System.IO.Directory.GetCurrentDirectory() + "\\report\\" + lis1.barcode + ".jpg", ImageFormat.Jpeg); FrmReport frm = new FrmReport(ic); frm.setStickerPatientThemalLIS(dt); frm.ShowDialog(this); }
private void ContextMenu_edit(object sender, System.EventArgs e) { String chk1 = "", name = "", id = "", vsid = "", resid = ""; if (grfReq.Row < 0) { return; } id = grfReq[grfReq.Row, colReqId] != null ? grfReq[grfReq.Row, colReqId].ToString() : ""; vsid = grfReq[grfReq.Row, colReqVsId] != null ? grfReq[grfReq.Row, colReqVsId].ToString() : ""; if (id.Length <= 0) { return; } ic.cStf.staff_id = ""; FrmPasswordConfirm frm1 = new FrmPasswordConfirm(ic); frm1.ShowDialog(this); if (!ic.cStf.staff_id.Equals("")) { LabRequest req = new LabRequest(); req = ic.ivfDB.lbReqDB.selectByPk1(id); if (req.status_req.Equals("2") || req.status_req.Equals("4")) { // มีคนอื่น double click รับ request ไปแล้ว ที่ ดัก status เพราะ กัน รับ request แล้ว เกิด record ซ้อนกัน 2 record } else { DataTable dtVs = new DataTable(); dtVs = ic.ivfDB.lbReqDB.selectLabBloodByVsid(vsid); foreach (DataRow rowVs in dtVs.Rows) { String id1 = ""; id1 = rowVs[ic.ivfDB.lbReqDB.lbReq.req_id].ToString(); LabRequest lbreq = new LabRequest(); lbreq = ic.ivfDB.lbReqDB.selectByPk1(id1); if (lbreq.req_id.Length <= 0) { continue; } Lis lis = new Lis(); lis.lis_id = ""; lis.barcode = ""; lis.req_id = lbreq.req_id; lis.visit_vn = lbreq.vn; if (lbreq.name_female.Length > 0) { lis.patient_name = lbreq.name_female; lis.visit_hn = lbreq.hn_female; } else { lis.patient_name = lbreq.name_male; lis.visit_hn = lbreq.hn_male; } lis.visit_id = lbreq.visit_id; lis.message_lis = ""; lis.active = ""; lis.remark = ""; lis.date_create = ""; lis.date_modi = ""; lis.date_cancel = ""; lis.user_create = ""; lis.user_modi = ""; lis.user_cancel = ""; lis.statis_lis = ""; lis.date_time_receive = ""; lis.date_time_finish = ""; lis.lab_id = lbreq.item_id; String re = "", re1 = "", re2 = ""; long chk = 0, chk2 = 0; re1 = ic.ivfDB.lisDB.insertLis(lis, ic.cStf.staff_id); if (long.TryParse(re1, out chk)) { LabResult lbRes = new LabResult(); OldLabItem labi = new OldLabItem(); labi = ic.ivfDB.oLabiDB.selectByPk1(lbreq.item_id); lbRes.result_id = ""; lbRes.lis_id = re1; lbRes.req_id = lbreq.req_id; lbRes.visit_id = lbreq.visit_id; lbRes.patient_id = ""; lbRes.lab_id = lbreq.item_id; lbRes.result = ""; lbRes.method = ""; lbRes.active = ""; lbRes.remark = ""; lbRes.date_create = ""; lbRes.date_modi = ""; lbRes.date_cancel = ""; lbRes.user_create = ""; lbRes.user_modi = ""; lbRes.user_cancel = ""; lbRes.unit = ""; lbRes.sort1 = ""; lbRes.staff_id_result = ""; lbRes.staff_id_approve = ""; lbRes.date_time_result = ""; lbRes.date_time_approve = ""; lbRes.normal_value = labi.normal_vaule; lbRes.interpret = ""; lbRes.status_result = "1"; lbRes.row1 = "0"; DateTime date1 = new DateTime(); DateTime.TryParse(lbreq.req_time, out date1); //lbRes.req_date_time = date1.Year+"-"+ date1.ToString("MM-dd")+" " + date1.ToString("HH:mm:ss"); lbRes.req_date_time = lbreq.req_time; lbRes.date_time_receive = System.DateTime.Now.Year + "-" + System.DateTime.Now.ToString("MM-dd HH:mm:ss"); lbRes.doctor_id = lbreq.doctor_id; lbRes.date_time_collect = lbRes.req_date_time; lbRes.remark_nurse = lbreq.remark; re2 = ic.ivfDB.lbresDB.insertLabResult(lbRes, ic.cStf.staff_id); if (long.TryParse(re2, out chk2)) { resid = re2; re = ic.ivfDB.lbReqDB.UpdateStatusRequestAccept(lbreq.req_id, ic.cStf.staff_id); chk = 0; if (long.TryParse(re, out chk)) { // ยังไม่ได้ต่อ LIS 62-08-03 //try //{ // SetDefaultPrinter(ic.iniC.printerSticker); // Lis lis1 = new Lis(); // lis1 = ic.ivfDB.lisDB.selectByPk(re1); // Visit vs = new Visit(); // vs = ic.ivfDB.vsDB.selectByVn(lis1.visit_vn); // Patient ptt = new Patient(); // ptt = ic.ivfDB.pttDB.selectByPk1(vs.t_patient_id); // DataTable dt = new DataTable(); // dt.Columns.Add("hn", typeof(String)); // dt.Columns.Add("name", typeof(String)); // dt.Columns.Add("age", typeof(String)); // dt.Columns.Add("vn", typeof(String)); // DataRow row11 = dt.NewRow(); // row11["hn"] = lis1.visit_hn; // row11["name"] = lis1.patient_name; // row11["age"] = "Age " + ptt.AgeStringShort() + " [" + ic.datetoShow(ptt.patient_birthday) + "]"; // row11["vn"] = lis1.barcode; // dt.Rows.Add(row11); // FrmReport frm = new FrmReport(ic); // frm.setStickerPatientThemalLIS(dt); // frm.ShowDialog(this); // SetDefaultPrinter(ic.iniC.printerSticker); //} //catch (Exception ex) //{ // MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // return; //} // ยังไม่ได้ต่อ LIS 62-08-03 } } } } } } //String id = ""; //id = grfProc[grfProc.Row, colRsId] != null ? grfProc[grfProc.Row, colRsId].ToString() : ""; FrmLabBloodAdd frm = new FrmLabBloodAdd(ic, resid); frm.ShowDialog(this); setGrfReq(); //chk = grfReq[grfReq.Row, colRqReqNum] != null ? grfReq[grfReq.Row, colRqReqNum].ToString() : ""; //name = grfReq[grfReq.Row, colRqName] != null ? grfReq[grfReq.Row, colRqName].ToString() : ""; ////if (MessageBox.Show("ต้องการ ป้อน LAB OPU \n req number " + chk+" \n name "+ name, "", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK) ////{ ////grfReq.Rows.Remove(grfReq.Row); //Cursor curOld; //curOld = this.Cursor; //this.Cursor = Cursors.WaitCursor; //openLabOPUNew(id, name); //setGrfReq(); //setGrfProc(""); //this.Cursor = curOld; //} }