Пример #1
0
 public HomeModelAdapter(IModelAdapter <HeroModel> heroModelAdapter,
                         IModelAdapter <FooterHomeModel> footerModelAdapter
                         )
 {
     _heroModelAdapter   = heroModelAdapter;
     _footerModelAdapter = footerModelAdapter;
 }
 private void CollectAllRelated(IModelAdapter x, IInstance root)
 {
     foreach (uint related in root.RelatedInstances)
     {
         x.RelatedInstances.Add(CreateAdapter(im.Read(related)));
     }
 }
 public ContentPageController(IModelAdapter <MasterModel> masterModelAdapter,
                              IModelAdapter <InitialState> initialStateModelAdapter,
                              IModelAdapter <ContentPageModel> contentPageModelAdapter) : base(masterModelAdapter,
                                                                                               initialStateModelAdapter)
 {
     _contentPageModelAdapter = contentPageModelAdapter;
 }
Пример #4
0
 public PasswordDisplayProps(IModelAdapter <UserAccount> userAccount,
                             IModelAdapter <PasswordTracker> pwTracker,
                             IZipEncrypt zipEncrypt)
 {
     _userAccount = userAccount;
     _pwTracker   = pwTracker;
     _zipper      = zipEncrypt;
 }
 public static XElement Adapt(this MetaModel model, IModelAdapter adapter)
 {
     return(new XElement(Namespace + "Database",
                         new XAttribute("Name", adapter.AdaptDatabase(model.DatabaseName)),
                         new XAttribute("Provider", model.ProviderType.AssemblyQualifiedName),
                         model.GetTables().Select(table => table.Adapt(adapter)),
                         model.GetFunctions().Select(function => function.Adapt(adapter))
                         ));
 }
        internal IModelAdapter LoadBoard(uint boardId)
        {
            ModelAdapters = new List <IModelAdapter>();
            IInstance     board = im.Read(boardId);
            IModelAdapter temp  = CreateAdapter(board);

            CollectAllRelated(temp, board);
            return(temp);
        }
 public static XElement Adapt(this MetaFunction function, IModelAdapter adapter)
 {
     return(new XElement(Namespace + "Function",
                         new XAttribute("Name", function.Name),
                         new XAttribute("Method", adapter.AdaptFunction(function.Method.Name)),
                         new XAttribute("IsComposable", function.IsComposable.ToString()),
                         function.Parameters.Select(parameter => parameter.Adapt()),
                         (function.ReturnParameter == null ?
                          (object)function.ResultRowTypes.Select(resultType => resultType.Adapt()) :
                          function.ReturnParameter.AdaptAsReturnType())
                         ));
 }
 public static XElement Adapt(this MetaTable table, IModelAdapter adapter)
 {
     return(new XElement(Namespace + "Table",
                         new XAttribute("Name", adapter.AdaptTable(table.TableName)),
                         new XElement(Namespace + "Type",
                                      new XAttribute("Name", table.RowType.Name),
                                      table.RowType.DataMembers
                                      .Where(member => member.StorageMember != null)
                                      .Select(member => member.Adapt())
                                      )
                         ));
 }
Пример #9
0
        public AdaptingMappingSource(MappingSource mappingSource, IModelAdapter modelAdapter)
            : base()
        {
            if (mappingSource == null)
            {
                throw new ArgumentNullException("mappingSource");
            }
            if (modelAdapter == null)
            {
                throw new ArgumentNullException("modelAdapter");
            }

            UnderlyingMappingSource = mappingSource;
            ModelAdapter            = modelAdapter;
        }
Пример #10
0
 public Display(IDisplayProps props, IPasswordEncryption encryption,
                IZipEncrypt zipper, IModelAdapter <EmailAccount> email,
                IModelAdapter <UserAccount> userAccount,
                IModelAdapter <PasswordTracker> pwTracker,
                ITextFileReadWriter readerWriter) : this()
 {
     _props          = props;
     _pwTracker      = pwTracker;
     _email          = email;
     _userAccount    = userAccount;
     _zipper         = zipper;
     _encryptDecrypt = encryption;
     _readerWriter   = readerWriter;
     _loginForm      = new Login(_props, userAccount, _email);
 }
Пример #11
0
        public void SetEmailAccount(string emailAddress, IModelAdapter <EmailAccount> emailAccount)
        {
            var email = emailAccount.GetRecordById(emailAccount.Id);

            if (email == null)
            {
                email = new EmailAccount()
                {
                    Email  = emailAddress,
                    UserId = emailAccount.Id
                };
                emailAccount.InsertNewRecord(email);
            }
            else
            {
                emailAccount.EditEntry(email);
            }
        }
Пример #12
0
 public string GetPhotoLocationFromFile(IModelAdapter <EmailAccount> emailAccount, int userId)
 {
     try
     {
         var fileName = GetTextFile();
         if (!File.Exists(fileName))
         {
             return(DefaultFile);
         }
         var email = emailAccount.GetRecordById(userId);
         email.PhotoLocation = fileName;
         emailAccount.EditEntry(email);
         return(fileName);
     }
     catch (Exception)
     {
         MessageBox.Show("Help!");
         return(null);
     }
 }
Пример #13
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            NinjectConfig.CreateKernel();
            var kernel = NinjectConfig.Kernel;

            IPasswordEncryption          encryption  = kernel.Get <IPasswordEncryption>();
            IZipEncrypt                  zipper      = kernel.Get <IZipEncrypt>();
            IModelAdapter <EmailAccount> email       = kernel.Get <IModelAdapter <EmailAccount> >();
            IModelAdapter <UserAccount>  userAccount =
                kernel.Get <IModelAdapter <UserAccount> >();
            IModelAdapter <PasswordTracker> pwTracker =
                kernel.Get <IModelAdapter <PasswordTracker> >();
            ITextFileReadWriter reader  = kernel.Get <ITextFileReadWriter>();
            IDisplayProps       props   = kernel.Get <IDisplayProps>();
            ISubscriberTracker  tracker = kernel.Get <ISubscriberTracker>();

            tracker.Subscribe(email);
            tracker.Subscribe(pwTracker);
            Application.Run(new Display(props, encryption, zipper, email, userAccount, pwTracker, reader));
        }
Пример #14
0
 /// <summary>
 /// Creates an DecoratorModelAdapter by decorating the underlying decorated IModelAdapter
 /// </summary>
 /// <param name="decoratedModel">The IModelAdapter to decorate</param>
 protected BaseDecoratorModelAdapter(IModelAdapter decoratedModel)
     : this()
 {
     DecoratedModel = decoratedModel;
 }
Пример #15
0
 public ProductsController(IModelAdapter <MasterModel> masterModelAdapter,
                           IModelAdapter <InitialState> initialStateModelAdapter,
                           IModelAdapter <ProductsModel> productsModelAdapter) : base(masterModelAdapter, initialStateModelAdapter)
 {
     _productsModelAdapter = productsModelAdapter;
 }
 public ProductsModelAdapter(IModelAdapter <ProductModel> productModelAdapter)
 {
     _productModelAdapter = productModelAdapter;
 }
Пример #17
0
 public MasterModelAdapter(IModelAdapter <MetaData> metaDataModelAdapter)
 {
     _metaDataModelAdapter = metaDataModelAdapter;
 }
Пример #18
0
 /// <summary>
 /// Instantiates a TablePrefixModelAdapter using the given prefix AND decorates the passed-in
 /// IModelAdapter
 /// </summary>
 /// <param name="prefix">The prefix to use during adaptation</param>
 /// <param name="decoratedModel">The IModelAdapter to decorate</param>
 public TablePrefixModelAdapter(string prefix, IModelAdapter decoratedModel)
     : base(decoratedModel)
 {
     Prefix = prefix;
 }
Пример #19
0
 public HomeController(IModelAdapter <MasterModel> masterModelAdapter,
                       IModelAdapter <InitialState> initialStateModelAdapter,
                       IModelAdapter <HomeModel> homeModelAdapter) : base(masterModelAdapter, initialStateModelAdapter)
 {
     _homeModelAdapter = homeModelAdapter;
 }
 public DotNetNukeDataContext(IDbConnection connection, MappingSource mapping, IModelAdapter adapter)
     : base(connection, mapping, adapter)
 {
 }
Пример #21
0
 public PeopleModelAdapter(IModelAdapter <PersonModel> personModelAdapter)
 {
     _personModelAdapter = personModelAdapter;
 }
 public InitialStateModelAdapter(IModelAdapter <MetaData> metaModelAdapter,
                                 IModelAdapter <RequestModel> requestModelAdapter)
 {
     _metaModelAdapter    = metaModelAdapter;
     _requestModelAdapter = requestModelAdapter;
 }
Пример #23
0
 public ModelAdapter(uint tid, uint id, IModelAdapter parent)
 {
     Tid    = tid;
     Id     = id;
     Parent = parent;
 }
Пример #24
0
 public BlogpostController(IModelAdapter <MasterModel> masterModelAdapter,
                           IModelAdapter <InitialState> initialStateModelAdapter,
                           IModelAdapter <BlogPostModel> blogpostModelAdapter) : base(masterModelAdapter, initialStateModelAdapter)
 {
     _blogpostModelAdapter = blogpostModelAdapter;
 }
 public DotNetNukeDataContext(MappingSource mapping, IModelAdapter adapter)
     : this(DotNetNuke.Common.Utilities.Config.GetConnectionString(), mapping, adapter)
 {
 }
Пример #26
0
 /// <summary>
 /// Instantiates a TableSuffixModelAdapter using the given suffix AND decorates the passed-in
 /// IModelAdapter
 /// </summary>
 /// <param name="suffix">The suffix to use during adaptation</param>
 /// <param name="decoratedModel">The IModelAdapter to decorate</param>
 public TableSuffixModelAdapter(string suffix, IModelAdapter decoratedModel)
     : base(decoratedModel)
 {
     Suffix = suffix;
 }
Пример #27
0
 public AdaptingDataContext(IDbConnection connection, MappingSource mapping, IModelAdapter adapter)
     : base(adapter.AdaptConnection(connection), new AdaptingMappingSource(mapping, adapter))
 {
 }
Пример #28
0
 public ServiceVerbatized(IRepository repository, IModelAdapter <TEntity, TEntityDto> adapter)
 {
     Repository = repository;
     Adapter    = adapter;
 }
Пример #29
0
 public AdaptingDataContext(string fileOrServerConnection, MappingSource mapping, IModelAdapter adapter)
     : base(adapter.AdaptConnection(fileOrServerConnection), new AdaptingMappingSource(mapping, adapter))
 {
 }
 public DotNetNukeDataContext(string fileOrServerConnection, MappingSource mapping, IModelAdapter adapter)
     : base(fileOrServerConnection, mapping, adapter)
 {
 }