コード例 #1
0
 public MainModel(IFactoryLogic factoryLogic)
 {
     logic = factoryLogic ?? throw new ArgumentNullException(nameof(factoryLogic));
     db    = Context.GetContext();
     if (db == null)
     {
         throw new ArgumentNullException(nameof(db));
     }
 }
コード例 #2
0
        public KeyFeatureModel(IFactoryLogic factoryLogic)
        {
            this.factoryLogic = factoryLogic ?? throw new ArgumentNullException(nameof(factoryLogic));

            db = Context.GetContext();
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }

            featLogic       = this.factoryLogic.CreateFeature(db);
            keyFeatureLogic = this.factoryLogic.CreateKeyFeature(db);
        }
コード例 #3
0
ファイル: FeatureModel.cs プロジェクト: Aborvalov/Hasp
        public FeatureModel(IFactoryLogic factoryLogic)
        {
            if (factoryLogic == null)
            {
                throw new ArgumentNullException(nameof(factoryLogic));
            }

            db = Context.GetContext();
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }
            featLogic = factoryLogic.CreateFeature(db);
        }
コード例 #4
0
ファイル: HaspKeyModel.cs プロジェクト: Aborvalov/Hasp
        public HaspKeyModel(IFactoryLogic factoryLogic)
        {
            if (factoryLogic == null)
            {
                throw new ArgumentNullException(nameof(factoryLogic));
            }

            db = Context.GetContext(); if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }

            keyLogic = factoryLogic.CreateHaspKey(db);
        }
コード例 #5
0
        public ClientModel(IFactoryLogic factoryLogic)
        {
            if (factoryLogic == null)
            {
                throw new ArgumentNullException(nameof(factoryLogic));
            }

            db = Context.GetContext();
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }

            clientLogic = factoryLogic.CreateClient(db);
        }
コード例 #6
0
        public List <ModelViewMain> GetAll()
        {
            try
            {
                using (db = Context.GetContext())
                {
                    if (db == null)
                    {
                        throw new ArgumentNullException(nameof(db));
                    }

                    List <KeyFeatureClient> keyFeatureClients = logic.CreateKeyFeatureClient(db).GetAll();
                    List <KeyFeature>       keyFeatures       = logic.CreateKeyFeature(db).GetAll();
                    List <Client>           clients           = logic.CreateClient(db).GetAll();
                    List <Feature>          features          = logic.CreateFeature(db).GetAll();
                    List <HaspKey>          haspKeys          = logic.CreateHaspKey(db).GetByActive();;

                    var item = from keyFeatCl in keyFeatureClients
                               join keyFeat in keyFeatures
                               on keyFeatCl.IdKeyFeature equals keyFeat.Id
                               join cl in clients
                               on keyFeatCl.IdClient equals cl.Id
                               join feature in features
                               on keyFeat.IdFeature equals feature.Id
                               join key in haspKeys
                               on keyFeat.IdHaspKey equals key.Id
                               where keyFeat.EndDate >= date
                               select new ModelViewMain
                    {
                        Client = cl.Name + (string.IsNullOrEmpty(cl.Address)
                                                            ? string.Empty : " - " + cl.Address),
                        IdClient  = cl.Id,
                        EndDate   = keyFeat.EndDate,
                        Feature   = feature.Name,
                        NumberKey = key.InnerId.ToString() + " - \"" + key.Number + "\"",
                    };

                    return(item
                           .OrderBy(x => x.Client)
                           .ToList());
                }
            }
            catch
            {
                throw;
            }
        }
コード例 #7
0
 public DbKeyFeatureClientDAO(IEntitesContext db)
 {
     this.db = (EntitesContext)db ?? throw new ArgumentNullException(nameof(db));
 }
コード例 #8
0
 public DbHaspKeyDAO(IEntitesContext db)
 {
     this.db = (EntitesContext)db ?? throw new ArgumentNullException(nameof(db));
 }
コード例 #9
0
ファイル: Logics.cs プロジェクト: Aborvalov/Hasp
 public IFeatureLogic CreateFeature(IEntitesContext db) => new FeatureLogic(new DbFeatureDAO(db));
コード例 #10
0
ファイル: Logics.cs プロジェクト: Aborvalov/Hasp
 public IClientLogic CreateClient(IEntitesContext db) => new ClientLogic(new DbClientDAO(db));
コード例 #11
0
ファイル: Logics.cs プロジェクト: Aborvalov/Hasp
 public IKeyFeatureClientLogic CreateKeyFeatureClient(IEntitesContext db) => new KeyFeatureClientLogic(new DbKeyFeatureClientDAO(db));
コード例 #12
0
ファイル: Logics.cs プロジェクト: Aborvalov/Hasp
 public IKeyFeatureLogic CreateKeyFeature(IEntitesContext db) => new KeyFeatureLogic(new DbKeyFeatureDAO(db));
コード例 #13
0
ファイル: Logics.cs プロジェクト: Aborvalov/Hasp
 public IHaspKeyLogic CreateHaspKey(IEntitesContext db) => new HaspKeyLogic(new DbHaspKeyDAO(db));