private void btnSave_Click(object sender, EventArgs e) { lblMsg.Text = ""; try { DateTime dateNow = Program.GetServerDateTime(); DataBinding_trn_doctor_exam.EndEdit(); var other = DataBinding_trn_doctor_exam.OfType <trn_doctor_exam>().FirstOrDefault(); if (other.trxm_create_date == null) { other.trxm_create_date = dateNow; } other.trxm_update_date = dateNow; try { trn_patient_book_result bookResult = dbc.trn_patient_book_results .Where(x => x.tpr_id == Program.CurrentRegis.tpr_id && x.tpbr_radiology == "OE") .FirstOrDefault(); if (bookResult == null) { bookResult = new trn_patient_book_result() { tpr_id = Program.CurrentRegis.tpr_id, tpbr_radiology = "OE", tpbr_create_by = Program.CurrentUser.mut_username, tpbr_create_date = dateNow }; dbc.trn_patient_book_results.InsertOnSubmit(bookResult); } bookResult.tpbr_flag_saved = true; bookResult.tpbr_show_sections = true; bookResult.tpbr_show_summary = true; bookResult.tpbr_not_show_report = false; bookResult.tpbr_active = true; bookResult.tpbr_update_by = Program.CurrentUser.mut_username; bookResult.tpbr_update_date = dateNow; dbc.SubmitChanges(); } catch (System.Data.Linq.ChangeConflictException) { foreach (System.Data.Linq.ObjectChangeConflict occ in dbc.ChangeConflicts) { dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object); } dbc.SubmitChanges(); } } catch (Exception ex) { lblMsg.Text = ex.Message; } lblMsg.Text = "Save Data Completed."; }
private void SaveLAB() { try { try { DateTime dateNow = Program.GetServerDateTime(); trn_patient_book_result bookResult = dbc.trn_patient_book_results .Where(x => x.tpr_id == Program.CurrentRegis.tpr_id && x.tpbr_radiology == "LB") .FirstOrDefault(); if (bookResult == null) { bookResult = new trn_patient_book_result() { tpr_id = Program.CurrentRegis.tpr_id, tpbr_radiology = "LB", tpbr_create_by = Program.CurrentUser.mut_username, tpbr_create_date = dateNow }; dbc.trn_patient_book_results.InsertOnSubmit(bookResult); } bookResult.tpbr_flag_saved = true; bookResult.tpbr_show_sections = true; bookResult.tpbr_show_summary = true; bookResult.tpbr_not_show_report = false; bookResult.tpbr_active = true; bookResult.tpbr_update_by = Program.CurrentUser.mut_username; bookResult.tpbr_update_date = dateNow; dbc.SubmitChanges(); lbAlertMsg.Text = "Save Data Complete."; } catch (System.Data.Linq.ChangeConflictException) { foreach (System.Data.Linq.ObjectChangeConflict occ in dbc.ChangeConflicts) { dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object); } dbc.SubmitChanges(); } } catch (ChangeConflictException) { foreach (ObjectChangeConflict occ in dbc.ChangeConflicts) { dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object); } dbc.SubmitChanges(); } }
private void btnSave_Click(object sender, EventArgs e) { try { tabPhyExamUC1.EndEdit(); try { DateTime dateNow = Program.GetServerDateTime(); trn_patient_book_result bookResult = dbc.trn_patient_book_results .Where(x => x.tpr_id == this._tpr_id && x.tpbr_radiology == "PE") .FirstOrDefault(); if (bookResult == null) { bookResult = new trn_patient_book_result() { tpr_id = (int)this._tpr_id, tpbr_radiology = "PE", tpbr_create_by = Program.CurrentUser.mut_username, tpbr_create_date = dateNow }; dbc.trn_patient_book_results.InsertOnSubmit(bookResult); } bookResult.tpbr_flag_saved = true; bookResult.tpbr_show_sections = true; bookResult.tpbr_show_summary = true; bookResult.tpbr_not_show_report = false; bookResult.tpbr_active = true; bookResult.tpbr_update_by = Program.CurrentUser.mut_username; bookResult.tpbr_update_date = dateNow; dbc.SubmitChanges(); } catch (System.Data.Linq.ChangeConflictException) { foreach (System.Data.Linq.ObjectChangeConflict occ in dbc.ChangeConflicts) { dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object); } dbc.SubmitChanges(); } lbAlertMsg.Text = "Save Data Complete."; btnSendToDocscan.Enabled = true; } catch (Exception ex) { Program.MessageError(this.Name, "btnSave_Click", ex, false); lbAlertMsg.Text = "โปรดลองอีกครั้ง"; } }
private void btnSave_Click(object sender, EventArgs e) { try { lblMsg.Text = ""; DateTime dateNow = Program.GetServerDateTime(); string user = Program.CurrentUser == null ? "" : Program.CurrentUser.mut_username; trn_patient_book_result bookResult = cdc.trn_patient_book_results .Where(x => x.tpr_id == (int)_tpr_id && x.tpbr_radiology == _trxr_type) .FirstOrDefault(); if (bookResult == null) { bookResult = new trn_patient_book_result() { tpr_id = (int)_tpr_id, tpbr_radiology = _trxr_type, tpbr_create_by = user, tpbr_create_date = dateNow }; cdc.trn_patient_book_results.InsertOnSubmit(bookResult); } bookResult.tpbr_flag_saved = true; bookResult.tpbr_show_sections = true; bookResult.tpbr_show_summary = true; bookResult.tpbr_not_show_report = false; bookResult.tpbr_active = true; bookResult.tpbr_update_by = user; bookResult.tpbr_update_date = dateNow; var xray = DoctorXrayBS.OfType <trn_doctor_xray>().FirstOrDefault(); if (xray.trxr_create_date == null) { xray.trxr_create_by = user; xray.trxr_create_date = dateNow; } xray.trxr_update_by = user; xray.trxr_update_date = dateNow; cdc.trn_doctor_xray_images.DeleteAllOnSubmit(xray.trn_doctor_xray_images); for (int i = 0; i < listViewImgChest.Items.Count; i++) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); ListImage[i].Save(ms, System.Drawing.Imaging.ImageFormat.Png); xray.trn_doctor_xray_images.Add(new trn_doctor_xray_image { trxm_image = ms.ToArray(), trxm_sel_image = listViewImgChest.Items[i].Checked ? 'S' : 'N', trxm_status = 'A', trxm_create_by = user, trxm_create_date = dateNow, trxm_update_by = user, trxm_update_date = dateNow }); } var retri = cdc.trn_patient_retrieves.Where(x => x.tpr_id == _tpr_id && x.tpr_image_type == _trxr_type).FirstOrDefault(); if (retri == null) { retri = new trn_patient_retrieve(); retri.tpr_id = _tpr_id; retri.tpr_image_type = _trxr_type; cdc.trn_patient_retrieves.InsertOnSubmit(retri); } retri.tpr_flag_retrieve = false; cdc.SubmitChanges(); lblMsg.Text = "Save Data Completed."; } catch (Exception ex) { lblMsg.Text = "Please try again."; } }