Example #1
0
        /// <summary>
        /// Stores the working values into the a record.
        /// </summary>
        public void Store()
        {
            EditableFieldStoringCallbackArgs fieldStoringCallbackArgs = new EditableFieldStoringCallbackArgs();
            if (this.FieldStoringCallback != null)
                this.FieldStoringCallback(this, fieldStoringCallbackArgs);

            if (this.Status == FieldStatus.New)
            {
                if (!fieldStoringCallbackArgs.FileId.HasValue)
                    throw new NotSupportedException("Cannot save a new field without a file id provided by the field storing callback method");
                int fileid = fieldStoringCallbackArgs.FileId.Value;

                this.FormRecord = Formrecord.CreateNew(fileid, this.FormField.Id);
                if (this.FormRecord == null)
                    throw new NotSupportedException("Cannot store a new field without first creating the associated record");                
                this.Status = FieldStatus.Modified;
            }
            
            if (this.Status == FieldStatus.Modified)
            {
                this.FormRecord.Storedvalue = this.TextValue;
                this.FormRecord.Codeid = null; //default
                if (this.Type == FieldType.SingleOption)
                {
                    /// For single option we actually set the code value
                    this.FormRecord.Codeid = this.CodeValue;
                    if (this.CodeValue.HasValue &&
                        this.LookupCodes.Count(lookup => lookup.Id == this.CodeValue.Value) > 0)
                        this.FormRecord.Storedvalue = this.LookupCodes.Where(Formcode.Columns.Id, this.FormRecord.Codeid.Value)[0].Label;                    
                }
                this.FormRecord.Save(Utility.GetActiveUsername());
                this.Status = FieldStatus.Unmodified;
            }
        }
Example #2
0
        /// <summary>
        /// Stores the working values into the a record.
        /// </summary>
        public void Store()
        {
            EditableFieldStoringCallbackArgs fieldStoringCallbackArgs = new EditableFieldStoringCallbackArgs();

            if (this.FieldStoringCallback != null)
            {
                this.FieldStoringCallback(this, fieldStoringCallbackArgs);
            }

            if (this.Status == FieldStatus.New)
            {
                if (!fieldStoringCallbackArgs.FileId.HasValue)
                {
                    throw new NotSupportedException("Cannot save a new field without a file id provided by the field storing callback method");
                }
                int fileid = fieldStoringCallbackArgs.FileId.Value;

                this.FormRecord = Formrecord.CreateNew(fileid, this.FormField.Id);
                if (this.FormRecord == null)
                {
                    throw new NotSupportedException("Cannot store a new field without first creating the associated record");
                }
                this.Status = FieldStatus.Modified;
            }

            if (this.Status == FieldStatus.Modified)
            {
                this.FormRecord.Storedvalue = this.TextValue;
                this.FormRecord.Codeid      = null; //default
                if (this.Type == FieldType.SingleOption)
                {
                    /// For single option we actually set the code value
                    this.FormRecord.Codeid = this.CodeValue;
                    if (this.CodeValue.HasValue &&
                        this.LookupCodes.Count(lookup => lookup.Id == this.CodeValue.Value) > 0)
                    {
                        this.FormRecord.Storedvalue = this.LookupCodes.Where(Formcode.Columns.Id, this.FormRecord.Codeid.Value)[0].Label;
                    }
                }
                this.FormRecord.Save(Utility.GetActiveUsername());
                this.Status = FieldStatus.Unmodified;
            }
        }
Example #3
0
 /// <summary>
 /// Handles the editable field storing callback to assign the file id value.
 /// </summary>
 public void HandleEditableFieldStoring(object sender, EditableFieldStoringCallbackArgs e)
 {
     e.FileId = this.FormFile.Id;
 }
Example #4
0
 /// <summary>
 /// Handles the editable field storing callback to assign the file id value.
 /// </summary>
 public void HandleEditableFieldStoring(object sender, EditableFieldStoringCallbackArgs e)
 {
     e.FileId = this.FormFile.Id;
 }