public ListModel(IPieService pieService, ICategoryService categoryService)
 {
     this.pieService      = pieService;
     this.categoryService = categoryService;
 }
 public HomeController(IPieService pieService)
 {
     // this ctor is an example of constructor injection
     _pieService = pieService;
 }
Exemplo n.º 3
0
 public PieStockController(IPieService pieService)
 {
     _pieService = pieService;
 }
Exemplo n.º 4
0
 public PieController(IPieService service)
 {
     _service = service;
 }
Exemplo n.º 5
0
 public ShoppingCartController(IShoppingCartService shoppingCartService, IPieService pieService, IMapper mapper)
 {
     this.shoppingCartService = shoppingCartService;
     this.pieService          = pieService;
     this.mapper = mapper;
 }
Exemplo n.º 6
0
 public PieDetailsViewModelManager(IPieService pieService)
 {
     _pieService = pieService;
 }
 public IndexModel(IBannerService bannerService, IPieService pieService)
 {
     this.bannerService = bannerService;
     this.pieService    = pieService;
 }
Exemplo n.º 8
0
 public PiesController(IPieService pieService, IMapper mapper)
 {
     this.pieService = pieService;
     this.mapper     = mapper;
 }
        /// <summary>
        /// Get the client up to date by comparing the version numbers and fetching the versions the client does not have.
        /// </summary>
        /// <returns>The latest, up-to-date version number for the client</returns>
        private int UpdateClient(IPieService service, ref IList<Conflict> conflicts)
        {
            var clientVersion = GetLatestVersionNumber();
            var serverVersion = service.GetCurrentVersionNumber(Root);

            // If the numbers are equal, set the client version number to the server's +1
            if (clientVersion == serverVersion)
            {
                return serverVersion + 1;
            }

            // Fetch any missing versions
            if (clientVersion < serverVersion)
            {
                var updatedClientVersion = clientVersion + 1;
                var versions = service.GetVersions(Root, updatedClientVersion, serverVersion);
                String[] currentVersionContent = ReadAllLines(FileSystem.VERSION_DIR + CurrentVersion + VersionExtension);
                bool conflict = false;
                // Save the changes without questions
                for (int i = 0; i < versions.Length; i++)
                {
                    string[] version = new string[0];
                    // Get the version
                    version = versions[i];

                    // Check for conflicts. If there is conflict between a document in version i and current, the changes will not be stored/persisted
                    foreach (String s in currentVersionContent)
                    {
                        if (s.StartsWith(AbstractChange.ItemCreationMark) ||
                            s.StartsWith(AbstractChange.ItemDeletionMark) ||
                            s.StartsWith(AbstractChange.ItemModificationMark))
                        {
                            if (version[0].Equals(s))
                            {
                                conflict = true;
                                break;
                            }
                        }
                    }
                    var changes = ChangeParser.ParseChanges(version).Where(f => f != null).ToArray();
                    if (conflict == false)
                    {
                        // If no conflicts, we store the changes normally.
                        foreach (var change in changes)
                        {
                            // Store the change in the file system (and cache)
                            Execute(change);
                        }
                    }
                    else
                    {
                        conflict = false;
                    }
                    // Store the changes
                    PersistVersion((i+1).ToString(), changes);
                    // increment the clients version number by one
                    updatedClientVersion++;
                }

                // Return the latest number
                return updatedClientVersion;
            }

            // If the client is ahead of the server we throw an exception - this should not happen
            throw new InvalidOperationException("The version number of the client (" + clientVersion + ") " +
                                                "is too large compared to the server's (" + serverVersion + ")");
        }
Exemplo n.º 10
0
 public PieListViewModelManager(IPieService pieService)
 {
     _pieService = pieService;
 }
Exemplo n.º 11
0
 public DetailModel(IPieService pieService)
 {
     this.pieService = pieService;
 }