/// <summary> /// Reloads the field records /// </summary> private void ReloadFields() { /// pre-populate all the fields, along with any existing records FormfieldCollection allFields = new FormfieldCollection().Where(Formfield.Columns.Formid, this.Form.Id).Load(); if (this.relatedFields == null) this.relatedFields = new List<DesignableField>(); foreach (DesignableField field in this.relatedFields) field.FieldDeleted -= this.HandleFieldDeleted; //make sure it's unhooked if it's there this.relatedFields.Clear(); for (int i = 0; i < allFields.Count; i++) { DesignableField field = new DesignableField(allFields[i], this); this.relatedFields.Add(field); field.FieldDeleted += new EventHandler(HandleFieldDeleted); } /// First sort the fields based on the information we have this.SortFields(); /// Now reset their FieldOrder ID if it's not right for (int i = 0; i < this.relatedFields.Count; i++) { if (this.relatedFields[i].Metadata.FieldOrder != i) { this.relatedFields[i].Metadata.FieldOrder = i; this.relatedFields[i].Store(); } } }
public FormfieldCollection FetchAll() { FormfieldCollection coll = new FormfieldCollection(); Query qry = new Query(Formfield.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return coll; }
public EditableFile(Formfile formFile) : base(formFile) { //pre-populate all the fields, along with any existing records FormfieldCollection allFields = new FormfieldCollection().Where(Formfield.Columns.Formid, this.SymanticForm.Form.Id).Load(); this.relatedFields = new List <EditableField>(); for (int i = 0; i < allFields.Count; i++) { Formrecord candidateRecord = this.FormFile.Formrecords().FirstOrDefault <Formrecord>(record => record.Fieldid == allFields[i].Id); EditableField field; if (candidateRecord != null) { field = new EditableField(candidateRecord); } else { field = new EditableField(allFields[i]); } field.FieldStoringCallback += new EventHandler <EditableFieldStoringCallbackArgs>(HandleEditableFieldStoring); this.relatedFields.Add(field); } /// Sort the fields in field order this.relatedFields = this.relatedFields.OrderBy(field => field.Metadata.FieldOrder).ToList(); }
/// <summary> /// Reloads the field records /// </summary> private void ReloadFields() { /// pre-populate all the fields, along with any existing records FormfieldCollection allFields = new FormfieldCollection().Where(Formfield.Columns.Formid, this.Form.Id).Load(); if (this.relatedFields == null) { this.relatedFields = new List <DesignableField>(); } foreach (DesignableField field in this.relatedFields) { field.FieldDeleted -= this.HandleFieldDeleted; //make sure it's unhooked if it's there } this.relatedFields.Clear(); for (int i = 0; i < allFields.Count; i++) { DesignableField field = new DesignableField(allFields[i], this); this.relatedFields.Add(field); field.FieldDeleted += new EventHandler(HandleFieldDeleted); } /// First sort the fields based on the information we have this.SortFields(); /// Now reset their FieldOrder ID if it's not right for (int i = 0; i < this.relatedFields.Count; i++) { if (this.relatedFields[i].Metadata.FieldOrder != i) { this.relatedFields[i].Metadata.FieldOrder = i; this.relatedFields[i].Store(); } } }
public ViewableFileCollection(SymanticForm form) { this.EncapsulatedForm = form; //pre-populate all the fields, along with any existing records FormfieldCollection allFields = new FormfieldCollection().Where(Formfield.Columns.Formid, this.EncapsulatedForm.Form.Id).Load(); ///get the related fields this.relatedFields = new List <SymanticField>(); for (int i = 0; i < allFields.Count; i++) { EditableField field = new EditableField(allFields[i]); this.relatedFields.Add(field); } /// Sort the fields in field order this.relatedFields = this.relatedFields.OrderBy(field => field.Metadata.FieldOrder).ToList(); }
public EditableFile(Formfile formFile) :base(formFile) { //pre-populate all the fields, along with any existing records FormfieldCollection allFields = new FormfieldCollection().Where(Formfield.Columns.Formid, this.SymanticForm.Form.Id).Load(); this.relatedFields = new List<EditableField>(); for (int i = 0; i < allFields.Count; i++) { Formrecord candidateRecord = this.FormFile.Formrecords().FirstOrDefault<Formrecord>(record => record.Fieldid == allFields[i].Id); EditableField field; if (candidateRecord != null) field = new EditableField(candidateRecord); else field = new EditableField(allFields[i]); field.FieldStoringCallback += new EventHandler<EditableFieldStoringCallbackArgs>(HandleEditableFieldStoring); this.relatedFields.Add(field); } /// Sort the fields in field order this.relatedFields = this.relatedFields.OrderBy(field => field.Metadata.FieldOrder).ToList(); }
public FormfieldCollection FetchByQuery(Query qry) { FormfieldCollection coll = new FormfieldCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return coll; }
public FormfieldCollection FetchByID(object Id) { FormfieldCollection coll = new FormfieldCollection().Where("id", Id).Load(); return coll; }