Example #1
0
        /// <summary>
        /// Adds a lookup code to this field.
        /// </summary>
        /// <param name="label">A unique label for this code.</param>
        public void AddLookupCode(string label)
        {
            ///If this label is already used, then don't add it
            if (this.LookupCodes.Where <Formcode>(code => code.Label.Equals(label, StringComparison.InvariantCultureIgnoreCase)).Count() > 0)
            {
                return;
            }

            Formcode newCode = new Formcode();

            newCode.Formfield = this.FormField;
            newCode.Label     = label;
            newCode.Save(Utility.GetActiveUsername());
            this.LookupCodes.Add(newCode);
        }
Example #2
0
 /// <summary>
 /// Deletes the field (and all codes, and all records) from the form
 /// </summary>
 public void Delete()
 {
     foreach (Formrecord record in this.FormField.Formrecords())
     {
         Formrecord.Delete(record.Id);
     }
     foreach (Formcode code in this.FormField.Formcodes())
     {
         Formcode.Delete(code.Id);
     }
     Formfield.Delete(this.FormField.Id);
     if (this.FieldDeleted != null)
     {
         this.FieldDeleted(this, EventArgs.Empty);
     }
 }
Example #3
0
	    public void Insert(int Fieldid,string Label,bool? Deleted,DateTime? Createdon,DateTime? Modifiedon,string Createdby,string Modifiedby)
	    {
		    Formcode item = new Formcode();
		    
            item.Fieldid = Fieldid;
            
            item.Label = Label;
            
            item.Deleted = Deleted;
            
            item.Createdon = Createdon;
            
            item.Modifiedon = Modifiedon;
            
            item.Createdby = Createdby;
            
            item.Modifiedby = Modifiedby;
            
	    
		    item.Save(UserName);
	    }
Example #4
0
	    public void Update(int Id,int Fieldid,string Label,bool? Deleted,DateTime? Createdon,DateTime? Modifiedon,string Createdby,string Modifiedby)
	    {
		    Formcode item = new Formcode();
	        item.MarkOld();
	        item.IsLoaded = true;
		    
			item.Id = Id;
				
			item.Fieldid = Fieldid;
				
			item.Label = Label;
				
			item.Deleted = Deleted;
				
			item.Createdon = Createdon;
				
			item.Modifiedon = Modifiedon;
				
			item.Createdby = Createdby;
				
			item.Modifiedby = Modifiedby;
				
	        item.Save(UserName);
	    }
Example #5
0
 /// <summary>
 /// Deletes a lookup code for this field. It is marked deleted, records that reference it will continue to hold their reference to the old code.
 /// </summary>
 /// <param name="code">The code to remove.</param>
 public void RemoveLookCode(Formcode code)
 {
     code.Deleted = true;
     code.Save(Utility.GetActiveUsername());
     this.ReloadLookupCodes();
 }
Example #6
0
 /// <summary>
 /// Deletes a lookup code for this field. It is marked deleted, records that reference it will continue to hold their reference to the old code.
 /// </summary>
 /// <param name="code">The code to remove.</param>
 public void RemoveLookCode(Formcode code)
 {
     code.Deleted = true;
     code.Save(Utility.GetActiveUsername());
     this.ReloadLookupCodes();
 }
Example #7
0
        /// <summary>
        /// Adds a lookup code to this field. 
        /// </summary>
        /// <param name="label">A unique label for this code.</param>
        public void AddLookupCode(string label)
        {
            ///If this label is already used, then don't add it
            if (this.LookupCodes.Where<Formcode>(code => code.Label.Equals(label, StringComparison.InvariantCultureIgnoreCase)).Count() > 0)
                return;

            Formcode newCode = new Formcode();
            newCode.Formfield = this.FormField;
            newCode.Label = label;
            newCode.Save(Utility.GetActiveUsername());
            this.LookupCodes.Add(newCode);
        }