public void RendersButton() { var doc = new FormDocument <FormButtonTests>(); var contents = doc.ToPlainText(); Assert.AreEqual("\n $BT,\"Press me!\",H=\"HandleButton\"$\n", contents); }
public void RendersListField() { var doc = new FormDocument <EnumListFieldTests>(); var contents = doc.ToPlainText(); Assert.AreEqual($"$LS,A=\"My List Field\",TYPE=\"Enum\",SRC=\"{typeof(Values).AssemblyQualifiedName}\",PROP=\"MyEnumValue\"$\n", contents); }
void DocumentManager_DocCreated(FormDocument doc, EventArgs e) { ListFiles.BeginUpdate(); ListFiles.Items.Add(doc); ListFiles.SelectedItem = doc; ListFiles.EndUpdate(); }
void DocumentManager_DocChanged(FormDocument doc, EventArgs e) { if (doc != null) { ListFiles.SelectedItem = doc; } }
public void OnSubmit(FormDocument <TestForm> form) { Log.Information("Submitting form:"); Log.Information("FileName: {0}", FileName); Log.Information("Readonly: {0}", ReadOnly); Log.Information("Gender: {0}", Gender); }
/// <summary> /// Binds the forms. /// </summary> private void BindForms() { string className = MetaClassName; if (CanAddNewForm) { ddFormName.Items.Clear(); FormDocument[] mas = FormDocument.GetFormDocuments(className); foreach (FormDocument fd in mas) { ddFormName.Items.Add(new ListItem(CHelper.GetFormName(fd.Name), fd.Name)); } if (!String.IsNullOrEmpty(FormName)) { CHelper.SafeSelect(ddFormName, FormName); } FormName = (ddFormName.SelectedItem != null) ? ddFormName.SelectedValue : ""; } else { lblTempFormName.Text = FormName; } ddFormName.Visible = CanAddNewForm; lblTempFormName.Visible = !CanAddNewForm; BindRenderer(); }
public static void Main(string[] args) { var spriteBuilder = new SpriteBuilder(); spriteBuilder.Add(new Color(Editor.Core.EgaColor.Cyan)); spriteBuilder.Add(new Arrow(50, 100, 100, 200)); var sprite = spriteBuilder.Serialize(); var compositor = new Compositor <OpenGLNativeWindow>(); var window = compositor.NewWindow(); var obj = new TestForm(); var doc = new FormDocument <TestForm>(obj, new List <BinaryChunk>() { new BinaryChunk(1, 0, (uint)sprite.Length, 0, sprite) }); window.Show("Form Test", 1024, 768, doc); new Thread(() => { while (true) { if (obj.TimeFormat == TimeFormat.AmPm) { obj.TheTime = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss tt"); } else { obj.TheTime = DateTime.Now.ToString(); } Thread.Sleep(1000); } }).Start(); }
public FormDocument TransformClaimDocumentToFormDocument(ClaimDocument document) { FormDocument form = new FormDocument(); foreach (var claim in document.Claims) { if (claim.Type == ClaimTypeEnum.Professional) { var pages = _professionalTransformation.TransformClaimToClaimFormFoXml(claim); form.Pages.AddRange(pages); } else if (claim.Type == ClaimTypeEnum.Institutional) { var pages = _institutionalTransformation.TransformClaimToClaimFormFoXml(claim); form.Pages.AddRange(pages); } else { form.Pages.AddRange(_dentalTransformation.TransformClaimToClaimFormFoXml(claim)); } } return(form); }
private void BindRenderer() { FormDocumentData = null; try { FormDocumentData = FormDocument.Load(MetaClassName, FormName); if (FormDocumentData == null) { FormDocumentData = FormController.ReCreateFormDocument(MetaClassName, FormName); } if (MetaUIManager.MetaUITypeIsSystem(FormDocumentData.MetaClassName, FormDocumentData.MetaUITypeId) || FormName == FormDocumentData.MetaUITypeId) { lblFormName.Text = CHelper.GetFormName(FormName); } else { lblFormName.Text = String.Format("{0} ({1})", CHelper.GetFormName(FormName), CHelper.GetFormName(FormDocumentData.MetaUITypeId)); } } catch { } BindRendererInner(); }
public async Task <ActionResult> Create(QuestionCategoryViewModel questionCategory) { int docId = (int)TempData["FormDocumentId"]; try { using (var dbContext = new ApplicationDbContext()) { FormDocument document = dbContext.FormDocuments.Where(d => d.Id == docId).First(); foreach (var category in questionCategory.QuestionCategories) { foreach (var question in category.Questions) { Answer answer = new Answer(); answer.FormDocument = document; answer.Question = question; answer.AnswerValue = question.QuestionValue; dbContext.Answers.Add(answer); await dbContext.SaveChangesAsync(); } } } return(RedirectToAction("Index", "Documents")); } catch { return(View()); } }
/// <summary> /// Document created. /// </summary> /// <param name="doc"></param> private static void OnDocumentCreated(FormDocument doc) { if (DocCreated != null) { DocCreated(doc, e); } }
public void RendersCheckbox() { var doc = new FormDocument <CheckboxTests>(); var contents = doc.ToPlainText(); Assert.AreEqual("$CB,\"This is my checkbox\",PROP=\"MyCheckbox\"$\n", contents); }
/// <summary> /// Document changed /// </summary> /// <param name="doc"></param> public static void OnDocumentChanged(FormDocument doc) { if (DocChanged != null) { DocChanged(doc, e); } }
public void HandlesButtonClick() { var doc = new FormDocument <FormButtonTests>(this); doc.ButtonClicked(doc.Entries.OfType <Button>().Single()); Assert.IsTrue(buttonClicked); }
public void RendersHeaderAndFooter() { var doc = new FormDocument <FormHeaderFooterTests>(); var contents = doc.ToPlainText(); Assert.IsTrue(contents.StartsWith("HEADER")); Assert.IsTrue(contents.EndsWith("FOOTER")); }
public void ChecksValue() { var doc = new FormDocument <CheckboxTests>(this); var entry = doc.Entries.OfType <CheckBox>().Single(); entry.KeyPress(new ViewerState(null, doc, 100, 100), Key.SPACE, ' ', 0); Assert.IsTrue(MyCheckbox); }
public static void CloseDoc(this FormDocument doc) { try { OnDocumentClosed(doc); _Documents.Remove(doc); } catch { } }
public string GetValidationErrors(FormDocument <TodoForm> document) { if (validationError == null) { return(string.Empty); } return($"\n\n$BK,1$$FG,RED$$TX+CX+B,\"{validationError}\"$$FG$$BK,0$"); }
/// <summary> /// Binds a data source to the invoked server control and all its child controls. /// </summary> public override void DataBind() { string className = ""; if (DataItem != null) { MetaObject mo = null; if (DataItem is MetaObject) { mo = (MetaObject)DataItem; } else if (DataItem is BusinessObjectRequest) { mo = ((BusinessObjectRequest)DataItem).MetaObject; } className = mo.GetMetaType().Name; if (mo.GetCardMetaType() != null) { className = mo.GetCardMetaType().Name; } ViewState["ClassName"] = className; if (String.IsNullOrEmpty(FormName)) { if (DataItem is MetaObject) { FormName = FormController.BaseFormType; } else if (DataItem is BusinessObjectRequest) { FormName = FormController.CreateFormType; } } } else if (ViewState["ClassName"] != null) { className = ViewState["ClassName"].ToString(); } FormDocument doc = FormController.LoadFormDocument(className, FormName); if (doc != null) { _formExists = true; fRenderer.FormDocumentData = doc; fRenderer.FormType = FormType; fRenderer.PlaceName = PlaceName; if (DataItem != null) { fRenderer.DataItem = DataItem; } fRenderer.DataBind(); } }
private void ListFiles_Click(object sender, EventArgs e) { try { FormDocument doc = (FormDocument)ListFiles.SelectedItem; doc.BringToFront(); ListFiles.Focus(); } catch { } }
public static void Main(string[] args) { var compositor = new Compositor <OpenGLNativeWindow>(); var window = compositor.NewWindow(); var list = new TodoForm(); var document = new FormDocument <TodoForm>(list); window.Show("TempleTodo", 1024, 768, document); }
public FindItem(string name, string text, FormDocument document, string fileName, int startPos, int endPos, int colStart, int tabWidth) { Name = name; StartPos = startPos; EndPos = endPos; Document = document; FileName = fileName; Length = text.Length; ColStart = colStart; Text = text; TabWidth = tabWidth; }
public bool Insert(FormDocument formdocument) { int autonumber = 0; FormDocumentDAC formdocumentComponent = new FormDocumentDAC(); bool endedSuccessfuly = formdocumentComponent.InsertNewFormDocument(ref autonumber, formdocument.FormDocumentStatusID, formdocument.Title, formdocument.Description, formdocument.StartDate, formdocument.EndDate, formdocument.ConfirmationText, formdocument.CreatorID, formdocument.CreationDate, formdocument.SendEmail, formdocument.SendSMS, formdocument.AllowModify); if (endedSuccessfuly) { formdocument.FormDocumentID = autonumber; } return(endedSuccessfuly); }
public FindItem(string text, FormDocument document, string fileName, int startPos, int endPos, int colStart, int tabWidth) { Name = (document == null ? fileName : document.Text); StartPos = startPos; EndPos = endPos; ColStart = colStart; Document = document; FileName = fileName; Text = text; Length = text.Length; TabWidth = tabWidth; }
/// <summary> /// Transforms document to XML /// </summary> /// <param name="document">Document to be transformed</param> /// <returns>String XML representation of XML document</returns> /// <exception cref="ArgumentNullException">Thrown if document passed is null</exception> public string TransformClaimDocumentToFoXml(ClaimDocument document) { if (document == null) { throw new ArgumentNullException(nameof(document), Resources.InvalidClaimDocumentError); } var form = new FormDocument(); foreach (var claim in document.Claims) { IList <FormPage> pages; switch (claim.Type) { case ClaimType.Professional: pages = this.professionalTransformation.TransformClaimToClaimFormFoXml(claim); form.Pages.AddRange(pages); break; case ClaimType.Institutional: pages = this.institutionalTransformation.TransformClaimToClaimFormFoXml(claim); form.Pages.AddRange(pages); break; case ClaimType.Dental: pages = this.dentalTransformation.TransformClaimToClaimFormFoXml(claim); form.Pages.AddRange(pages); break; default: // If we get here, then something went extremely wrong throw new InvalidOperationException(Resources.InvalidClaimTypeError); } } string xml = form.Serialize(); Stream transformStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("X12.Hipaa.Claims.Services.Xsl.FormDocument-To-FoXml.xslt"); var transform = new XslCompiledTransform(); if (transformStream != null) { transform.Load(XmlReader.Create(transformStream)); } var outputStream = new MemoryStream(); transform.Transform(XmlReader.Create(new StringReader(xml)), new XsltArgumentList(), outputStream); outputStream.Position = 0; return(new StreamReader(outputStream).ReadToEnd()); }
public void ToggleDone(FormDocument <TodoForm> document, DocumentEntry entry) { var id = Guid.Parse(entry.GetArgument("LM")); var item = items.Find(i => i.Id == id); if (item == null) { return; } item.Done = !item.Done; document.Reload(); }
public void Delete(FormDocument <TodoForm> document, DocumentEntry entry) { var id = Guid.Parse(entry.GetArgument("LM")); var item = items.Find(i => i.Id == id); if (item == null) { return; } items.Remove(item); document.Reload(); }
protected void grdMain_DeleteCommand(object source, DataGridCommandEventArgs e) { string id = e.CommandArgument.ToString(); FormDocument fd = FormDocument.Load(mc.Name, id); fd.Delete(); if (id == FormController.GeneralViewFormType || id == FormController.GeneralViewHistoryFormType) { MetaDataWrapper.RemoveClassAttribute(mc, "HasCompositePage"); } CHelper.RequireDataBind(); }
public void Add(FormDocument <TodoForm> document) { if (string.IsNullOrWhiteSpace(Item)) { validationError = "PLEASE ENTER A VALUE!"; document.Reload(); return; } items.Add(new TodoItem(Guid.NewGuid(), IsDone, Item)); IsDone = false; Item = string.Empty; validationError = null; document.Reload(); }
public async Task <ActionResult> SubmitHouseHoldRegistration(FormDocumentViewModel model) { model.FormId = 1; model.ClinicId = Convert.ToInt32(Request.Form["Clinics"].ToString()); model.WardId = Convert.ToInt32(Request.Form["Wards"].ToString()); model.HouseholdId = Convert.ToInt32(Request.Form["Households"].ToString()); int chwId = Convert.ToInt32(TempData["CHW"].ToString()); if (ModelState.IsValid == false) { return(LoadHouseholdRegistration(null)); } FormDocument document = new FormDocument(); using (var dbContext = new ApplicationDbContext()) { document.Form = dbContext.Forms.Where(f => f.Id == model.FormId).First(); document.Clinic = dbContext.Clinics.Where(c => c.Id == model.ClinicId).First(); document.Ward = dbContext.Wards.Where(w => w.Id == model.WardId).First(); Visit visit = new Visit(); visit.CHW = dbContext.CHWs.Where(c => c.Id == chwId).First(); visit.VisitDate = DateTime.Now; if (visit.FormDocuments == null) { visit.FormDocuments = new List <FormDocument>(); } document.Household = dbContext.Households.Where(hh => hh.Id == model.HouseholdId).First(); document.Household.Visits.Add(visit); visit.FormDocuments.Add(document); await dbContext.SaveChangesAsync(); } TempData["FormId"] = model.FormId; TempData["FormDocumentId"] = document.Id; TempData["HouseholdId"] = document.Household.Id; return(RedirectToAction("Create", "Houses")); }
protected void Page_Load(object sender, EventArgs e) { if (String.IsNullOrEmpty(Request["class"])) throw new Exception("ClassName is required!"); if (!Page.IsPostBack) { if (!String.IsNullOrEmpty(uid)) { #region Edit lblTitle.Text = GetGlobalResourceObject("IbnFramework.MetaForm", "EditForm").ToString(); lblComments.Text = GetGlobalResourceObject("IbnFramework.MetaForm", "EditFormComment").ToString(); FormDocumentData = ((FormDocument)Session[uid]).Copy(); lblClass.Text = CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(FormDocumentData.MetaClassName).FriendlyName); ddClasses.Visible = false; if (MetaUIManager.MetaUITypeIsSystem(FormDocumentData.MetaClassName, FormDocumentData.MetaUITypeId) || FormDocumentData.Name == FormDocumentData.MetaUITypeId) lblForm.Text = CHelper.GetFormName(FormDocumentData.Name); else lblForm.Text = String.Format("{0} ({1})", CHelper.GetFormName(FormDocumentData.Name), CHelper.GetFormName(FormDocumentData.MetaUITypeId)); ddFormType.Visible = false; BindValues(); #endregion } else { #region Create lblTitle.Text = GetGlobalResourceObject("IbnFramework.MetaForm", "AddForm").ToString(); lblComments.Text = GetGlobalResourceObject("IbnFramework.MetaForm", "AddFormComment").ToString(); FormtypeLiteral.Text = GetGlobalResourceObject("IbnFramework.MetaForm", "FormType").ToString(); //Dictionary<int, string> dic = Mediachase.Ibn.Data.Meta.Management.SqlSerialization.MetaClassId.GetIds(); //List<string> list = new List<string>(dic.Values); List<string> list = new List<string>(); foreach (MetaClass mc in DataContext.Current.MetaModel.MetaClasses) list.Add(mc.Name); list.Sort(); ddClasses.DataSource = list; ddClasses.DataBind(); string metaclassName = Request["class"]; if (!String.IsNullOrEmpty(metaclassName)) CHelper.SafeSelect(ddClasses, metaclassName); //lblClass.Visible = false; ddClasses.Visible = false; lblClass.Visible = true; lblClass.Text = CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(ddClasses.SelectedValue).FriendlyName); ddFormType.Items.Clear(); MetaUITypeElement[] mas = MetaUIManager.GetCreatableUITypes(metaclassName, MetaUITypeElement.FormCategory); foreach (MetaUITypeElement elem in mas) ddFormType.Items.Add(new ListItem(CHelper.GetFormName(elem.Name), elem.Id)); txtCellPadding.Text = "5"; #endregion } // Ibn47 Lists if (ListManager.MetaClassIsList(Request["class"])) TableLabel.Text = GetGlobalResourceObject("IbnFramework.ListInfo", "List").ToString(); } lblError.Visible = false; btnSave.InnerText = GetGlobalResourceObject("IbnFramework.MetaForm", "Save").ToString(); btnCancel.InnerText = GetGlobalResourceObject("IbnFramework.MetaForm", "Cancel").ToString(); }
protected void btnSave_ServerClick(object sender, EventArgs e) { Page.Validate(); if (!Page.IsValid) return; if (!String.IsNullOrEmpty(uid)) { #region Edit string columns = FormDocumentData.FormTable.Columns; int colsCount = columns.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries).Length; bool needToAdd = false; if (!rb11.Disabled && rb11.Checked) columns = "50%;*"; if (!rb12.Disabled && rb12.Checked) columns = "35%;*"; if (!rb21.Disabled && rb21.Checked) columns = "*;35%"; if (!rb111.Disabled && rb111.Checked) { columns = "33%;33%;*"; if (colsCount < 3) needToAdd = true; } FormDocumentData.FormTable.Columns = columns; if (needToAdd) { foreach (FormRow row in FormDocumentData.FormTable.Rows) { bool needCell = false; foreach (FormCell cell in row.Cells) { if (cell.ColSpan > 1 && cell.ColSpan < 3) cell.ColSpan = 3; if (cell.ColSpan == 1) needCell = true; } if (needCell) { FormCell cell = new FormCell("cell_23", 1); row.Cells.Add(cell); } } } if (!String.IsNullOrEmpty(txtCellPadding.Text)) FormDocumentData.FormTable.CellPadding = int.Parse(txtCellPadding.Text); #endregion } else { #region Create string className = ddClasses.SelectedValue; try { string formName = ""; if (divTitle.Visible) formName = txtTitle.Text; else formName = ddFormType.SelectedValue; string columns = "50%;*"; if (rb11.Checked) columns = "50%;*"; else if (rb12.Checked) columns = "35%;*"; else if (rb21.Checked) columns = "*;35%"; else if (rb111.Checked) columns = "33%;33%;*"; //set columns int cellPadding = 5; if (!String.IsNullOrEmpty(txtCellPadding.Text)) cellPadding = int.Parse(txtCellPadding.Text); FormDocumentData = FormController.ReCreateFormDocument(className, formName, ddFormType.SelectedValue, columns, cellPadding); } catch { lblError.Visible = true; return; } #endregion } string newUid = Guid.NewGuid().ToString("N"); Session[newUid] = FormDocumentData; CloseAndRefresh(newUid); }