private void butAdd_Click(object sender, EventArgs e) { FormSheetPicker FormS = new FormSheetPicker(); FormS.SheetType = SheetTypeEnum.PatientForm; FormS.HideKioskButton = true; FormS.ShowDialog(); if (FormS.DialogResult != DialogResult.OK) { return; } //Make sure each selected sheet contains FName, LName, and Birthdate. foreach (SheetDef selectedSheetDef in FormS.SelectedSheetDefs) //There will always only be one { if (!WebFormL.VerifyRequiredFieldsPresent(selectedSheetDef)) { return; } } Cursor = Cursors.WaitCursor; foreach (SheetDef selectedSheetDef in FormS.SelectedSheetDefs) { WebFormL.LoadImagesToSheetDef(selectedSheetDef); WebFormL.TryAddOrUpdateSheetDef(this, selectedSheetDef, true); } FillGrid(); Cursor = Cursors.Default; }
private void butUpdate_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length < 1) { MsgBox.Show(this, "Please select an item from the grid first."); return; } if (gridMain.SelectedIndices.Length > 1) { MsgBox.Show(this, "Please select one web form at a time."); return; } WebForms_SheetDef wf_sheetDef = gridMain.SelectedTag <WebForms_SheetDef>(); SheetDef sheetDef = SheetDefs.GetFirstOrDefault(x => x.SheetDefNum == wf_sheetDef.SheetDefNum); if (sheetDef == null) //This web form has never had a SheetDefNum assigned or the sheet has been deleted. { MsgBox.Show(this, "This Web Form is not linked to a valid Sheet. Please select the correct Sheet that this Web Form should be linked to."); FormSheetPicker FormS = new FormSheetPicker(); FormS.SheetType = SheetTypeEnum.PatientForm; FormS.HideKioskButton = true; FormS.ShowDialog(); if (FormS.DialogResult != DialogResult.OK || FormS.SelectedSheetDefs.Count == 0) { return; } sheetDef = FormS.SelectedSheetDefs.FirstOrDefault(); } else //sheetDef not null { SheetDefs.GetFieldsAndParameters(sheetDef); } if (!WebFormL.VerifyRequiredFieldsPresent(sheetDef)) { return; } Cursor = Cursors.WaitCursor; WebFormL.LoadImagesToSheetDef(sheetDef); WebFormL.TryAddOrUpdateSheetDef(this, sheetDef, false, new List <WebForms_SheetDef> { wf_sheetDef }); FillGrid(); Cursor = Cursors.Default; }