Models: Add Entities/ folder
This commit is contained in:
		
							
								
								
									
										65
									
								
								Elwig/Models/Entities/AreaCom.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								Elwig/Models/Entities/AreaCom.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,65 @@
 | 
			
		||||
using Elwig.Helpers;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.ComponentModel.DataAnnotations.Schema;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
 | 
			
		||||
namespace Elwig.Models.Entities {
 | 
			
		||||
    [Table("area_commitment"), PrimaryKey("FbNr")]
 | 
			
		||||
    public class AreaCom {
 | 
			
		||||
        [Column("fbnr")]
 | 
			
		||||
        public int FbNr { get; set; }
 | 
			
		||||
 | 
			
		||||
        [Column("mgnr")]
 | 
			
		||||
        public int MgNr { get; set; }
 | 
			
		||||
 | 
			
		||||
        [Column("vtrgid")]
 | 
			
		||||
        public string VtrgId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [Column("cultid")]
 | 
			
		||||
        public string CultId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [Column("area")]
 | 
			
		||||
        public int Area { get; set; }
 | 
			
		||||
 | 
			
		||||
        [Column("kgnr")]
 | 
			
		||||
        public int KgNr { get; set; }
 | 
			
		||||
 | 
			
		||||
        [Column("gstnr")]
 | 
			
		||||
        public string GstNr { get; set; }
 | 
			
		||||
 | 
			
		||||
        [Column("rdnr")]
 | 
			
		||||
        public int? RdNr { get; set; }
 | 
			
		||||
 | 
			
		||||
        [Column("year_from")]
 | 
			
		||||
        public int YearFrom { get; set; }
 | 
			
		||||
 | 
			
		||||
        [Column("year_to")]
 | 
			
		||||
        public int? YearTo { get; set; }
 | 
			
		||||
 | 
			
		||||
        [Column("comment")]
 | 
			
		||||
        public string? Comment { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ForeignKey("MgNr")]
 | 
			
		||||
        public virtual Member Member { get; private set; }
 | 
			
		||||
 | 
			
		||||
        [ForeignKey("VtrgId")]
 | 
			
		||||
        public virtual AreaComType AreaComType { get; private set; }
 | 
			
		||||
 | 
			
		||||
        [ForeignKey("CultId")]
 | 
			
		||||
        public virtual WineCult WineCult { get; private set; }
 | 
			
		||||
 | 
			
		||||
        [ForeignKey("KgNr")]
 | 
			
		||||
        public virtual WbKg Kg { get; private set; }
 | 
			
		||||
 | 
			
		||||
        [ForeignKey("KgNr, RdNr")]
 | 
			
		||||
        public virtual WbRd? Rd { get; private set; }
 | 
			
		||||
 | 
			
		||||
        public int SearchScore(IEnumerable<string> keywords) {
 | 
			
		||||
            var list = new string?[] {
 | 
			
		||||
                WineCult.Name, Kg.AtKg.Name, Rd.Name, GstNr, Comment,
 | 
			
		||||
            }.ToList();
 | 
			
		||||
            return Utils.GetSearchScore(list, keywords);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user