private void FillGridCustomSheet() { SheetDefs.RefreshCache(); SheetFieldDefs.RefreshCache(); //If from Dashboard Setup, populate when SheetDef is a Dashboard type. //If from normal Sheet window, populate all Sheets except Dashboard types. _listSheetDefs = SheetDefs.GetDeepCopy(false).FindAll(x => SheetDefs.IsDashboardType(x) == _isOpenedFromDashboardSetup); gridCustomSheet.BeginUpdate(); gridCustomSheet.ListGridColumns.Clear(); GridColumn col = new GridColumn(Lan.g("TableSheetDef", "Description"), 170); gridCustomSheet.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableSheetDef", "Type"), 100); gridCustomSheet.ListGridColumns.Add(col); gridCustomSheet.ListGridRows.Clear(); GridRow row; foreach (SheetDef sheetDef in _listSheetDefs) { row = new GridRow(); row.Cells.Add(sheetDef.Description); row.Cells.Add(sheetDef.SheetType.ToString()); gridCustomSheet.ListGridRows.Add(row); } gridCustomSheet.EndUpdate(); }
private void FormLaboratoryEdit_Load(object sender, System.EventArgs e) { textDescription.Text = LabCur.Description; textPhone.Text = LabCur.Phone; textWirelessPhone.Text = LabCur.WirelessPhone; textAddress.Text = LabCur.Address; textCity.Text = LabCur.City; textState.Text = LabCur.State; textZip.Text = LabCur.Zip; textEmail.Text = LabCur.Email; textNotes.Text = LabCur.Notes; turnaroundList = LabTurnarounds.GetForLab(LabCur.LaboratoryNum); comboSlip.Items.Add(Lan.g(this, "Default")); comboSlip.SelectedIndex = 0; SlipList = SheetDefs.GetCustomForType(SheetTypeEnum.LabSlip); for (int i = 0; i < SlipList.Count; i++) { comboSlip.Items.Add(SlipList[i].Description); if (LabCur.Slip == SlipList[i].SheetDefNum) { comboSlip.SelectedIndex = i + 1; } } checkIsHidden.Checked = LabCur.IsHidden; FillGrid(); }
///<summary>Fills comboActionObject with the correct type of items based on the comboAction selection and sets labelActionObject text. ///Also handles setting combos/labels/texts visibility based on selected action.</summary> private void comboAction_SelectedIndexChanged(object sender, EventArgs e) { labelActionObject.Text = "Action Object"; //user should never see this text, just to help with troubleshooting in case of bug labelActionObject.Visible = false; comboActionObject.Visible = false; labelMessage.Visible = false; textMessage.Visible = false; if (comboAction.SelectedIndex < 0 || comboAction.SelectedIndex >= _listAutoActions.Count) { return; } comboActionObject.Items.Clear(); switch (_listAutoActions[comboAction.SelectedIndex]) { case AutomationAction.CreateCommlog: labelActionObject.Visible = true; labelActionObject.Text = Lan.g(this, "Commlog Type"); comboActionObject.Visible = true; _listCommLogTypeDefs.ForEach(x => comboActionObject.Items.Add(x.ItemName)); comboActionObject.SelectedIndex = _listCommLogTypeDefs.FindIndex(x => x.DefNum == AutoCur.CommType); labelMessage.Visible = true; textMessage.Visible = true; return; case AutomationAction.PopUp: case AutomationAction.PopUpThenDisable10Min: labelMessage.Visible = true; textMessage.Visible = true; return; case AutomationAction.SetApptStatus: labelActionObject.Visible = true; labelActionObject.Text = Lan.g(this, "Appointment Status"); comboActionObject.Visible = true; _listApptStatuses.ForEach(x => comboActionObject.Items.Add(x.ToString())); comboActionObject.SelectedIndex = _listApptStatuses.FindIndex(x => x == AutoCur.AptStatus); //can be -1; return; case AutomationAction.SetApptType: labelActionObject.Visible = true; labelActionObject.Text = Lan.g(this, "Appointment Type"); comboActionObject.Visible = true; //_listAppointmentType contains 'none' with AppointmentTypeNum of 0 at index 0, just add list to combo and FindIndex will always be valid _listAptTypes.ForEach(x => comboActionObject.Items.Add(x.AppointmentTypeName)); comboActionObject.SelectedIndex = _listAptTypes.FindIndex(x => AutoCur.AppointmentTypeNum == x.AppointmentTypeNum); //should always be >=0 return; case AutomationAction.PrintPatientLetter: case AutomationAction.PrintReferralLetter: case AutomationAction.ShowConsentForm: case AutomationAction.ShowExamSheet: labelActionObject.Visible = true; labelActionObject.Text = Lan.g(this, "Sheet Definition"); comboActionObject.Visible = true; List <SheetDef> listSheetDefs = SheetDefs.GetDeepCopy(); listSheetDefs.ForEach(x => comboActionObject.Items.Add(x.Description)); comboActionObject.SelectedIndex = listSheetDefs.FindIndex(x => AutoCur.SheetDefNum == x.SheetDefNum); //can be -1 return; } }
private void butPrint_Click(object sender, System.EventArgs e) { //only visible if sheet==null. if (comboSendStatus.SelectedIndex == (int)RxSendStatus.InElectQueue || comboSendStatus.SelectedIndex == (int)RxSendStatus.SentElect) { //do not change status } else { comboSendStatus.SelectedIndex = (int)RxSendStatus.Printed; } if (!SaveRx()) { return; } SheetDef sheetDef; List <SheetDef> customSheetDefs = SheetDefs.GetCustomForType(SheetTypeEnum.Rx); if (customSheetDefs.Count == 0) { sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.Rx); } else { sheetDef = customSheetDefs[0]; SheetDefs.GetFieldsAndParameters(sheetDef); } sheet = SheetUtil.CreateSheet(sheetDef, PatCur.PatNum); SheetParameter.SetParameter(sheet, "RxNum", RxPatCur.RxNum); SheetFiller.FillFields(sheet); SheetUtil.CalculateHeights(sheet, this.CreateGraphics()); SheetPrinting.PrintRx(sheet, RxPatCur.IsControlled); DialogResult = DialogResult.OK; }
private void butSlip_Click(object sender, EventArgs e) { int idx = gridMain.GetSelectedIndex(); if (idx == -1) { MsgBox.Show(this, "Please select a referral first"); return; } Referral referral = ReferralL.GetReferral(((RefAttach)gridMain.ListGridRows[idx].Tag).ReferralNum); if (referral == null) { return; } SheetDef sheetDef; if (referral.Slip == 0) { sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.ReferralSlip); } else { sheetDef = SheetDefs.GetSheetDef(referral.Slip); } Sheet sheet = SheetUtil.CreateSheet(sheetDef, PatNum); SheetParameter.SetParameter(sheet, "PatNum", PatNum); SheetParameter.SetParameter(sheet, "ReferralNum", referral.ReferralNum); SheetFiller.FillFields(sheet); SheetUtil.CalculateHeights(sheet); FormSheetFillEdit.ShowForm(sheet); }
private void butSlip_Click(object sender, EventArgs e) { int idx = gridMain.GetSelectedIndex(); if (idx == -1) { MsgBox.Show(this, "Please select a referral first"); return; } Referral referral = Referrals.GetReferral(RefAttachList[idx].ReferralNum); SheetDef sheetDef; if (referral.Slip == 0) { sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.ReferralSlip); } else { sheetDef = SheetDefs.GetSheetDef(referral.Slip); } Sheet sheet = SheetUtil.CreateSheet(sheetDef, PatNum); SheetParameter.SetParameter(sheet, "PatNum", PatNum); SheetParameter.SetParameter(sheet, "ReferralNum", referral.ReferralNum); SheetFiller.FillFields(sheet); SheetUtil.CalculateHeights(sheet, this.CreateGraphics()); FormSheetFillEdit FormS = new FormSheetFillEdit(sheet); FormS.ShowDialog(); //grid will not be refilled, so no need to reselect. }
private void listMain_DoubleClick(object sender, EventArgs e) { if (listMain.SelectedIndices.Count != 1) { return; } SelectedSheetDefs = new List <SheetDef>(); SheetDef sheetDef = listSheets[listMain.SelectedIndices[0]]; if (sheetDef.SheetDefNum != 0) { SheetDefs.GetFieldsAndParameters(sheetDef); } /* * if(sheetDef.SheetType==SheetTypeEnum.PatientForm && !showingInternalSheetDefs) { * SheetDefs.GetFieldsAndParameters(sheetDef); * } * if(sheetDef.SheetType==SheetTypeEnum.MedicalHistory && !showingInternalMed) { * SheetDefs.GetFieldsAndParameters(sheetDef); * }*/ SelectedSheetDefs.Add(sheetDef); TerminalSend = false; DialogResult = DialogResult.OK; }
///<summary></summary> public static void PrintAppointment(long aptNum) { SheetDef sheetDef; List <SheetDef> customSheetDefs = SheetDefs.GetCustomForType(SheetTypeEnum.LabelAppointment); if (customSheetDefs.Count == 0) { sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.LabelAppointment); } else { sheetDef = customSheetDefs[0]; SheetDefs.GetFieldsAndParameters(sheetDef); } Sheet sheet = SheetUtil.CreateSheet(sheetDef); SheetParameter.SetParameter(sheet, "AptNum", aptNum); SheetFiller.FillFields(sheet); try { SheetPrinting.Print(sheet); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void FormSheetFieldComboBox_Load(object sender, EventArgs e) { if (_isEditMobile) { textTabOrder.Enabled = false; } textUiLabelMobile.Visible = SheetDefs.IsMobileAllowed(_sheetDefCur.SheetType); labelUiLabelMobile.Visible = SheetDefs.IsMobileAllowed(_sheetDefCur.SheetType); textTabOrder.Text = SheetFieldDefCur.TabOrder.ToString(); textReportable.Text = SheetFieldDefCur.ReportableName; textUiLabelMobile.Text = SheetFieldDefCur.UiLabelMobile; if (SheetFieldDefCur.FieldValue != "") { _selectedOption = SheetFieldDefCur.FieldValue.Split(';')[0]; string[] arrayOptions = SheetFieldDefCur.FieldValue.Split(';')[1].Split('|'); foreach (string option in arrayOptions) { if (String.IsNullOrWhiteSpace(option)) { continue; } listboxComboOptions.Items.Add(option); } } }
private void butTerminal_Click(object sender, EventArgs e) { //only visible when used from patient forms window. if (listMain.SelectedIndices.Count == 0) { MsgBox.Show(this, "Please select at least one item first."); return; } if (SelectedSheetDefs == null) { SelectedSheetDefs = new List <SheetDef>(); } SheetDef sheetDef; foreach (int selectedIndex in listMain.SelectedIndices) { //test to make sure this sheetDef was not already added if (_listIndexesAdded.Contains(selectedIndex)) { continue; } _listIndexesAdded.Add(selectedIndex); sheetDef = listSheets[selectedIndex]; if (sheetDef.SheetDefNum > 0) { SheetDefs.GetFieldsAndParameters(sheetDef); } SelectedSheetDefs.Add(sheetDef); } TerminalSend = true; DialogResult = DialogResult.OK; }
private void butTerminal_Click(object sender, EventArgs e) { //only visible when used from patient forms window. if (listMain.SelectedIndices.Count == 0) { MsgBox.Show(this, "Please select at least one item first."); return; } if (SelectedSheetDefs == null) { SelectedSheetDefs = new List <SheetDef>(); } SheetDef sheetDef; for (int i = 0; i < listMain.SelectedIndices.Count; i++) { //test to make sure this sheetDef was not already added if (alreadyAdded.Contains(listMain.SelectedIndices[i])) { continue; } alreadyAdded.Add(listMain.SelectedIndices[i]); sheetDef = listSheets[listMain.SelectedIndices[i]]; if (sheetDef.SheetDefNum != 0) { SheetDefs.GetFieldsAndParameters(sheetDef); } SelectedSheetDefs.Add(sheetDef); } TerminalSend = true; DialogResult = DialogResult.OK; //for(int i=0;i<listMain.Items.Count;i++) { // listMain.SetSelected(i,false); //} }
///<summary>ClinicNum of 0 creates a default rule for all clinics.</summary> public static void CreateCustomSheet(SheetInternalType sheetInternalType, bool createEClipboardRule = true, long clinicNum = 0, int days = 30) { var sheetDef = SheetDefs.GetInternalOrCustom(sheetInternalType); sheetDef.IsNew = true; SheetDefs.InsertOrUpdate(sheetDef); if (!createEClipboardRule) { return; } var existingAll = EClipboardSheetDefs.Refresh(); var existingClinic = existingAll.FindAll(x => x.ClinicNum == clinicNum); int items = 0; existingClinic.ForEach(x => { x.ItemOrder = ++items; }); existingAll.Add(new EClipboardSheetDef() { ClinicNum = clinicNum, ResubmitInterval = TimeSpan.FromDays(days), SheetDefNum = sheetDef.SheetDefNum, ItemOrder = ++items, }); EClipboardSheetDefs.Sync(existingAll, EClipboardSheetDefs.Refresh()); SheetDefs.RefreshCache(); }
private void butCopy_Click(object sender, EventArgs e) { if (grid1.GetSelectedIndex() == -1) { MsgBox.Show(this, "Please select an internal sheet from the list above first."); return; } SheetDef sheetdef = internalList[grid1.GetSelectedIndex()].Copy(); sheetdef.IsNew = true; SheetDefs.InsertOrUpdate(sheetdef); if (sheetdef.SheetType == SheetTypeEnum.MedicalHistory && (sheetdef.Description == "Medical History New Patient" || sheetdef.Description == "Medical History Update")) { MsgBox.Show(this, "This is just a template, it may contain allergies and problems that do not exist in your setup."); } grid1.SetSelected(false); FillGrid2(); for (int i = 0; i < _listSheetDefs.Count; i++) { if (_listSheetDefs[i].SheetDefNum == sheetdef.SheetDefNum) { grid2.SetSelected(i, true); } } }
private void FillGrid() { List <SheetDef> listDashboardWidgets = SheetDefs.GetCustomForType(SheetTypeEnum.PatientDashboardWidget) .Where(x => Security.IsAuthorized(Permissions.DashboardWidget, x.SheetDefNum, true)).ToList(); List <SheetDef> listSelectedDashboards = gridMain.SelectedTags <SheetDef>(); gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); gridMain.ListGridColumns.Add(new GridColumn("Dashboard Name", 0, HorizontalAlignment.Left)); gridMain.ListGridRows.Clear(); foreach (SheetDef sheetDashboardWidget in listDashboardWidgets) { GridRow row = new GridRow(); row.Cells.Add(sheetDashboardWidget.Description); row.Tag = sheetDashboardWidget; gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); for (int i = 0; i < gridMain.ListGridRows.Count; i++) { if (((SheetDef)gridMain.ListGridRows[i].Tag).SheetDefNum.In(listSelectedDashboards.Select(x => x.SheetDefNum))) { gridMain.SetSelected(i, true); } } }
/// <summary>Specify a sheetDefNum of 0 for the internal Routing slip.</summary> private void PrintRoutingSlips(List <long> aptNums, long sheetDefNum) { SheetDef sheetDef; if (sheetDefNum == 0) { sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.RoutingSlip); } else { sheetDef = SheetDefs.GetSheetDef(sheetDefNum); //includes fields and parameters } List <Sheet> sheetBatch = SheetUtil.CreateBatch(sheetDef, aptNums); if (sheetBatch.Count == 0) { MsgBox.Show(this, "There are no routing slips to print."); return; } try { SheetPrinting.PrintBatch(sheetBatch); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
///<summary>Opens a SheetDefEdit window and returns the SheetDef.SheetDefNum. Returns -1 if user cancels or deletes the Dashboard.</summary> private long EditWidget(SheetDef sheetDefWidget = null) { if (sheetDefWidget == null) { sheetDefWidget = new SheetDef() { SheetType = SheetTypeEnum.PatientDashboardWidget, FontName = "Microsoft Sans Serif", FontSize = 9, Height = 800, Width = 400, }; FormSheetDef FormSD = new FormSheetDef(); FormSD.SheetDefCur = sheetDefWidget; FormSD.ShowDialog(); if (FormSD.DialogResult != DialogResult.OK) { return(-1); } sheetDefWidget.SheetFieldDefs = new List <SheetFieldDef>(); sheetDefWidget.IsNew = true; } SheetDefs.GetFieldsAndParameters(sheetDefWidget); FormSheetDefEdit FormS = new FormSheetDefEdit(sheetDefWidget); if (FormS.ShowDialog() == DialogResult.OK) { DataValid.SetInvalid(InvalidType.Sheets); return(sheetDefWidget.SheetDefNum); } return(-1); }
///<summary>Fills listEClipboardSheetsAvailable and small grid to its right.</summary> private void FillGridEClipboardSheetInUse() { //Fill the list of available sheets with the custom PatientForm and MedicalHist sheet defs List <SheetDef> listSheets = new List <SheetDef>(); listSheets.AddRange(SheetDefs.GetCustomForType(SheetTypeEnum.PatientForm)); listSheets.AddRange(SheetDefs.GetCustomForType(SheetTypeEnum.MedicalHistory)); listSheets.AddRange(SheetDefs.GetCustomForType(SheetTypeEnum.Consent)); //Clear any custom sheet defs that don't have a mobile layout listSheets.RemoveAll(x => !x.HasMobileLayout); //Get the list of in-memory eclipboard sheets long clinicNum = checkEClipboardUseDefaults.Checked?0:_clinicNumEClipboardTab; List <EClipboardSheetDef> listClinicSheets = _listEClipboardSheets.FindAll(x => x.ClinicNum == clinicNum); //Put the sheets that are not in use to the list of available sheets listEClipboardSheetsAvailable.Items.Clear(); listSheets.RemoveAll(x => listClinicSheets.Select(y => y.SheetDefNum).Contains(x.SheetDefNum)); foreach (SheetDef sheet in listSheets) { listEClipboardSheetsAvailable.Items.Add(new ODBoxItem <SheetDef>(sheet.Description, sheet)); } //Put the sheets that are in use into the grid of sheets in use gridEClipboardSheetsInUse.ListGridRows.Clear(); gridEClipboardSheetsInUse.ListGridColumns.Clear(); gridEClipboardSheetsInUse.BeginUpdate(); gridEClipboardSheetsInUse.AddColumn("Sheet Name", 120); gridEClipboardSheetsInUse.AddColumn("Frequency", 60); foreach (EClipboardSheetDef sheet in listClinicSheets.OrderBy(x => x.ItemOrder)) { gridEClipboardSheetsInUse.AddRow(tag: sheet, SheetDefs.GetDescription(sheet.SheetDefNum), sheet.ResubmitInterval.TotalDays.ToString()); } gridEClipboardSheetsInUse.EndUpdate(); }
private void PrintClickHelper(bool isPreviewMode) { Sheet sheet = SheetUtil.CreateSheet(SheetDefs.GetInternalOrCustom(SheetInternalType.ERA)); SheetParameter.GetParamByName(sheet.Parameters, "ERA").ParamValue = _x835; //Required param SheetFiller.FillFields(sheet); SheetPrinting.Print(sheet, isPreviewMode: isPreviewMode); }
private void FormSheetFieldSigBox_Load(object sender, EventArgs e) { textUiLabelMobile.Visible = SheetDefs.IsMobileAllowed(_sheetDefCur.SheetType); labelUiLabelMobile.Visible = SheetDefs.IsMobileAllowed(_sheetDefCur.SheetType); checkRequired.Checked = SheetFieldDefCur.IsRequired; textUiLabelMobile.Text = SheetFieldDefCur.UiLabelMobile; textName.Text = SheetFieldDefCur.FieldName; }
private void FillGridCustom(bool isSelectionMaintained = true, bool doRefreshCache = true) { if (doRefreshCache) { SheetDefs.RefreshCache(); SheetFieldDefs.RefreshCache(); } FillGrid(gridCustom, isSelectionMaintained, SheetDefs.GetCustomForType(SheetTypeEnum.PatientDashboardWidget).ToArray()); }
private void FillGrid() { Automations.RefreshCache(); _listAutomations = Automations.GetDeepCopy(); gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col = new GridColumn("Description", 200); gridMain.ListGridColumns.Add(col); col = new GridColumn("Trigger", 150); gridMain.ListGridColumns.Add(col); col = new GridColumn("Action", 150); gridMain.ListGridColumns.Add(col); col = new GridColumn("Details", 200); gridMain.ListGridColumns.Add(col); gridMain.ListGridRows.Clear(); UI.GridRow row; string detail; for (int i = 0; i < _listAutomations.Count; i++) { row = new OpenDental.UI.GridRow(); row.Cells.Add(_listAutomations[i].Description); if (_listAutomations[i].Autotrigger == AutomationTrigger.CompleteProcedure) { row.Cells.Add(_listAutomations[i].ProcCodes); } else { row.Cells.Add(_listAutomations[i].Autotrigger.ToString()); } row.Cells.Add(_listAutomations[i].AutoAction.ToString()); //details: detail = ""; if (_listAutomations[i].AutoAction == AutomationAction.CreateCommlog) { detail += Defs.GetName(DefCat.CommLogTypes, _listAutomations[i].CommType) + ". " + _listAutomations[i].MessageContent; } else if (_listAutomations[i].AutoAction == AutomationAction.PrintPatientLetter) { detail += SheetDefs.GetDescription(_listAutomations[i].SheetDefNum); } else if (_listAutomations[i].AutoAction == AutomationAction.PrintReferralLetter) { detail += SheetDefs.GetDescription(_listAutomations[i].SheetDefNum); } else if (_listAutomations[i].AutoAction == AutomationAction.ChangePatStatus) { detail += Lans.g("enum" + nameof(PatientStatus), _listAutomations[i].PatStatus.GetDescription()); } row.Cells.Add(detail); gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); }
private void FillListExamTypes() { listExamTypes.Items.Clear(); List <SheetDef> sheetDefs = SheetDefs.GetCustomForType(SheetTypeEnum.ExamSheet); for (int i = 0; i < sheetDefs.Count; i++) { listExamTypes.Items.Add(sheetDefs[i].Description); } }
private void grid2_CellDoubleClick(object sender, ODGridClickEventArgs e) { SheetDef sheetdef = grid2.SelectedTag <SheetDef>(); SheetDefs.GetFieldsAndParameters(sheetdef); FormSheetDefEdit FormS = new FormSheetDefEdit(sheetdef); FormS.ShowDialog(); FillGrid2(sheetdef.SheetDefNum); changed = true; }
private void butImport_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; OpenFileDialog openDlg = new OpenFileDialog(); string initDir = PrefC.GetString(PrefName.ExportPath); if (Directory.Exists(initDir)) { openDlg.InitialDirectory = initDir; } if (openDlg.ShowDialog() != DialogResult.OK) { Cursor = Cursors.Default; return; } try { //ImportCustomSheetDef(openDlg.FileName); SheetDef sheetdef = new SheetDef(); XmlSerializer serializer = new XmlSerializer(typeof(SheetDef)); if (openDlg.FileName != "") { if (!File.Exists(openDlg.FileName)) { throw new ApplicationException(Lan.g("FormSheetDefs", "File does not exist.")); } try { using (TextReader reader = new StreamReader(openDlg.FileName)) { sheetdef = (SheetDef)serializer.Deserialize(reader); } } catch { throw new ApplicationException(Lan.g("FormSheetDefs", "Invalid file format")); } } sheetdef.IsNew = true; SheetDefs.InsertOrUpdate(sheetdef); FillGrid2(); for (int i = 0; i < SheetDefC.Listt.Count; i++) { if (SheetDefC.Listt[i].SheetDefNum == sheetdef.SheetDefNum) { grid2.SetSelected(i, true); } } } catch (ApplicationException ex) { Cursor = Cursors.Default; MessageBox.Show(ex.Message); FillGrid2(); return; } Cursor = Cursors.Default; MsgBox.Show(this, "Imported."); }
private void FillFields() { string[] fieldArray = Enum.GetValues(typeof(StaticTextField)).Cast <StaticTextField>().Where(x => !x.IsStaticTextFieldObsolete()) //Not including patientPortalCredentials because simply viewing the dashboard would create a username and password for the patient .Where(x => !(SheetDefs.IsDashboardType(_sheetDefCur) && x == StaticTextField.patientPortalCredentials)) .Select(x => x.GetDescription()).ToArray(); listFields.Items.Clear(); for (int i = 0; i < fieldArray.Length; i++) { listFields.Items.Add(fieldArray[i]); } }
private void butExport_Click(object sender, EventArgs e) { if (gridCustomSheet.GetSelectedIndex() == -1) { MsgBox.Show(this, "Please select a sheet from the list first."); return; } SheetDef sheetdef = SheetDefs.GetSheetDef(_listSheetDefs[gridCustomSheet.GetSelectedIndex()].SheetDefNum); List <SheetFieldDef> listFieldDefImages = sheetdef.SheetFieldDefs .Where(x => x.FieldType == SheetFieldType.Image && x.FieldName != "Patient Info.gif") .ToList(); if (!listFieldDefImages.IsNullOrEmpty()) //Alert them of any images they need to copy if there are any. { string sheetImagesPath = ""; ODException.SwallowAnyException(() => { sheetImagesPath = SheetUtil.GetImagePath(); }); StringBuilder strBuilder = new StringBuilder(); strBuilder.AppendLine(Lan.g(this, "The following images will need to be manually imported with the same file name when importing this " + "sheet to a new environment.")); strBuilder.AppendLine(); listFieldDefImages.ForEach(x => strBuilder.AppendLine(ODFileUtils.CombinePaths(sheetImagesPath, x.FieldName))); MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(strBuilder.ToString()); msgBox.ShowDialog(); } XmlSerializer serializer = new XmlSerializer(typeof(SheetDef)); string filename = "SheetDefCustom.xml"; if (ODBuild.IsWeb()) { StringBuilder strbuild = new StringBuilder(); using (XmlWriter writer = XmlWriter.Create(strbuild)) { serializer.Serialize(writer, sheetdef); } ThinfinityUtils.ExportForDownload(filename, strbuild.ToString()); } else { SaveFileDialog saveDlg = new SaveFileDialog(); saveDlg.InitialDirectory = PrefC.GetString(PrefName.ExportPath); saveDlg.FileName = filename; if (saveDlg.ShowDialog() != DialogResult.OK) { return; } using (TextWriter writer = new StreamWriter(saveDlg.FileName)) { serializer.Serialize(writer, sheetdef); } } MsgBox.Show(this, "Exported"); }
private void FormSheetDef_Load(object sender, EventArgs e) { setHeightWidthMin(); if (IsReadOnly) { butOK.Enabled = false; } if (!IsInitial) { listSheetType.Enabled = false; checkHasMobileLayout.Enabled = SheetDefs.IsMobileAllowed(SheetDefCur.SheetType); } textDescription.Text = SheetDefCur.Description; Func <SheetTypeEnum, string> fItemToString = new Func <SheetTypeEnum, string>((sheetType) => { return(Lan.g("enumSheetTypeEnum", sheetType.GetDescription())); }); //not allowed to change sheettype once created. listSheetType.SetItems( Enum.GetValues(typeof(SheetTypeEnum)).Cast <SheetTypeEnum>() //MedLabResults not allowed here. .Where(x => !x.In(SheetTypeEnum.None, SheetTypeEnum.MedLabResults) && !SheetDefs.IsDashboardType(x) ) //Order alphabetical. .OrderBy(x => fItemToString(x)), //Text displayed for each item. fItemToString, //Only select an item if this is a previously saved SheetDef. new Func <SheetTypeEnum, bool>((sheetType) => { return(!IsInitial && sheetType == SheetDefCur.SheetType); })); InstalledFontCollection fColl = new InstalledFontCollection(); for (int i = 0; i < fColl.Families.Length; i++) { comboFontName.Items.Add(fColl.Families[i].Name); } checkBypassLockDate.Checked = (SheetDefCur.BypassGlobalLock == BypassLockStatus.BypassAlways); comboFontName.Text = SheetDefCur.FontName; textFontSize.Text = SheetDefCur.FontSize.ToString(); textWidth.Text = SheetDefCur.Width.ToString(); textHeight.Text = SheetDefCur.Height.ToString(); checkIsLandscape.Checked = SheetDefCur.IsLandscape; checkHasMobileLayout.Checked = SheetDefCur.HasMobileLayout; //Load is done. It is now safe to register for the selection change event. listSheetType.SelectedIndexChanged += new EventHandler(listSheetType_SelectedIndexChanged); if (SheetDefs.IsDashboardType(SheetDefCur)) { labelSheetType.Visible = false; listSheetType.Visible = false; checkBypassLockDate.Visible = false; checkIsLandscape.Visible = false; checkHasMobileLayout.Visible = false; } }
private void gridOtherLayouts_CellDoubleClick(object sender, ODGridClickEventArgs e) { SheetDef sheetDef = _listOtherSheetDefs[e.Row]; if (sheetDef.SheetDefNum != 0) //Is not the internal sheet. { SheetDefs.GetFieldsAndParameters(sheetDef); //Other user custom sheetdefs need their fields filled. } FormSheetDefEdit formSheetDefEdit = new FormSheetDefEdit(sheetDef); formSheetDefEdit.IsInternal = true; //So the current user cannot edit, including custom sheets for other users. formSheetDefEdit.ShowDialog(); }
private void FormScreenSetup_Load(object sender, EventArgs e) { checkUsePat.Checked = PrefC.GetBool(PrefName.PublicHealthScreeningUsePat); listSheets = SheetDefs.GetCustomForType(SheetTypeEnum.ExamSheet); for (int i = 0; i < listSheets.Count; i++) { comboExamSheets.Items.Add(listSheets[i].Description); if (PrefC.GetLong(PrefName.PublicHealthScreeningSheet) == listSheets[i].SheetDefNum) { comboExamSheets.SelectedIndex = i; } } }
///<summary>Reloads the control with any new sheet layouts available. ///This should only be called if a dynamic sheetDef was added/modified/deleted, the SheetLayoutMode has changed, or a new user signed in.</summary> public void ReloadSheetLayout(SheetFieldLayoutMode sheetFieldLayoutMode, Dictionary <string, Control> dictionaryControls) { long practiceDefaultSheetDefNum = PrefC.GetLong(PrefName.SheetsDefaultChartModule); ListSheetDefsLayout = SheetDefs.GetCustomForType(_sheetType); ListSheetDefsLayout.Add(SheetsInternal.GetSheetDef(SheetsInternal.GetInternalType(_sheetType))); //Internal at bottom of list. UI reflects this too. ListSheetDefsLayout = ListSheetDefsLayout .OrderBy(x => x.SheetDefNum != practiceDefaultSheetDefNum) //practice default sheetdef should be at the top of the list .ThenBy(x => x.SheetDefNum == 0) //if the internal sheetdef is not the default it should be last .ThenBy(x => x.Description) //order custom sheetdefs by description .ThenBy(x => x.SheetDefNum).ToList(); //then by SheetDefNum to be deterministic order InitLayoutForSheetDef(GetLayoutForUser(), sheetFieldLayoutMode, dictionaryControls, true); //Force refresh in case they edit current layout. }