Example #1
0
        public ActionResult RemovePick(int id, string cardName)
        {
            var member = GetAuthorizedMember();

            using (var sl = new SystemLogic())
            {
                if (!sl.IsMemberOfDraft(member.Id, id))
                {
                    return(RedirectToAction("Index"));
                }

                List <FuturePick> futurePicks = sl.GetMyFuturePicks(id, member.Id);

                foreach (var futurePick in futurePicks)
                {
                    var card = sl.GetCard(futurePick.Card.Id);
                    if (card.Name.Equals(cardName))
                    {
                        sl.RemoveMyFuturePick(futurePick.Id);
                        return(Json(new { dvm = GetDraftViewModel(id), success = true }, JsonRequestBehavior.AllowGet));
                    }
                }

                return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
            }
        }
Example #2
0
 public HomeController(PlanetLogic planetLogic, StarLogic starLogic, SystemLogic systemLogic, StatsLogic statsLogic)
 {
     this.planetLogic = planetLogic;
     this.starLogic   = starLogic;
     this.systemLogic = systemLogic;
     this.statsLogic  = statsLogic;
 }
Example #3
0
        //
        // GET: /Draft/Details/5
        public ActionResult Details(int id)
        {
            DraftViewModel dvm = GetDraftViewModel(id);

            if (dvm == null)
            {
                return(RedirectToAction("Index"));
            }

            var member = GetAuthorizedMember();

            if (member != null)
            {
                using (var sl = new SystemLogic())
                {
                    dvm.IsMemberOfDraft = sl.IsMemberOfDraft(member.Id, id);
                }
            }

            if (Request.IsAjaxRequest())
            {
                return(Json(dvm, JsonRequestBehavior.AllowGet));
            }

            return(View(dvm));
        }
Example #4
0
        public ActionResult Index()
        {
            var draftList = new List <DraftListViewModel>();

            using (var sl = new SystemLogic())
            {
                var authMember = GetAuthorizedMember();

                var drafts = sl.GetDraftList();
                foreach (var draft in drafts)
                {
                    var dlvm = new DraftListViewModel
                    {
                        CreatorId   = draft.Owner.Id,
                        CreatorName = sl.GetMember(draft.Owner.Id).FullName,
                        Id          = draft.Id,
                        Name        = draft.Name
                    };
                    if (authMember != null)
                    {
                        dlvm.AmIMemberOf = sl.IsMemberOfDraft
                                               (authMember.Id, draft.Id);
                    }

                    draftList.Add(dlvm);
                }
            }

            return(View(draftList));
        }
Example #5
0
        public ActionResult Start(int id)
        {
            using (var sl = new SystemLogic())
            {
                var authMember = GetAuthorizedMember();
                var draft      = sl.GetDraftById(id);

                if (draft.Owner.Id != authMember.Id || draft.Started || draft.Finished)
                {
                    return(RedirectToAction("Index"));
                }

                var startDraftVm = new StartDraftViewModel {
                    DraftName = draft.Name, DraftId = draft.Id
                };
                var draftMemberPositions = sl.GetDraftMembers(draft.Id);

                foreach (var dfs in draftMemberPositions)
                {
                    var member = sl.GetMember(dfs.Member.Id);
                    startDraftVm.DraftMembers.Add(new DraftMemberViewModel
                    {
                        DraftPosition = dfs.Position,
                        Email         = member.Email,
                        FullName      = member.FullName
                    });
                }

                return(View(startDraftVm));
            }
        }
Example #6
0
        public ActionResult Pick(string cardName, int draftId)
        {
            var authMember = GetAuthorizedMember();

            using (var sl = new SystemLogic())
            {
                if (!sl.IsMemberOfDraft(authMember.Id, draftId))
                {
                    return(RedirectToAction("Index"));
                }

                var draftLogic = GetDraftLogic.FromDraftId(draftId);
                var card       = sl.GetCard(cardName);

                if (card == null)
                {
                    var likeList = sl.FindCard(cardName);
                    return(Json(new { pickresult = false, reason = "Card was not found!", alternatives = likeList }));
                }

                var pickSuccess = draftLogic.PickCard(draftId, authMember.Id, card.Id);

                if (!pickSuccess)
                {
                    return(Json(new { pickresult = false, reason = "Card was already picked, try another card!" }));
                }

                DraftViewModel dvm = GetDraftViewModel(draftId);

                return(Json(new { pickresult = true, updatedDvm = dvm }));
            }
        }
        /// <summary>
        /// Initializes the class. This includes loading application settings from the configuration file. The application name should be scoped within the system.
        /// For non web applications, this method must be called directly from the main executable assembly and not from a supporting library.
        ///
        /// To debug this method, create a folder called C:\AnyoneFullControl and give Everyone full control. A file will appear in that folder explaining how far
        /// it got in init.
        /// </summary>
        /// <param name="appName"></param>
        /// <param name="isClientSideProgram"></param>
        /// <param name="systemLogic"></param>
        /// <param name="mainDataAccessStateGetter">A method that returns the current main data-access state whenever it is requested, including during this
        /// AppTools.Init call. Do not allow multiple threads to use the same state at the same time. If you pass null, the data-access subsystem will not be
        /// available in the application.</param>
        public static void Init(string appName, bool isClientSideProgram, SystemLogic systemLogic, Func <DataAccessState> mainDataAccessStateGetter = null)
        {
            var initializationLog = "Starting init";

            try {
                if (initialized)
                {
                    throw new ApplicationException("This class can only be initialized once.");
                }

                if (systemLogic == null)
                {
                    throw new ApplicationException("The system must have a global logic class and you must pass an instance of it to AppTools.Init.");
                }

                // Initialize ConfigurationStatics, including the general provider, before the exception handling block below because it's reasonable for the exception
                // handling to depend on this.
                ConfigurationStatics.Init(systemLogic.GetType(), appName, isClientSideProgram, ref initializationLog);

                // Setting the initialized flag to true must be done before executing the secondary init block below so that exception handling works.
                initialized        = true;
                initializationLog += Environment.NewLine + "Succeeded in primary init.";
            }
            catch (Exception e) {
                initializationLog += Environment.NewLine + e;
                StandardLibraryMethods.EmergencyLog("Initialization log", initializationLog);
                throw;
            }

            try {
                var asposeLicense = ConfigurationStatics.SystemGeneralProvider.AsposeLicenseName;
                if (asposeLicense.Any())
                {
                    new Aspose.Pdf.License().SetLicense(asposeLicense);
                    new Aspose.Words.License().SetLicense(asposeLicense);
                }

                // This initialization could be performed using reflection. There is no need for AppTools to have a dependency on these classes.
                AppMemoryCache.Init();
                BlobFileOps.Init();
                DataAccessStatics.Init();
                DataAccessState.Init(mainDataAccessStateGetter);
                EncryptionOps.Init();
                HtmlBlockStatics.Init();
                InstallationSupportUtility.ConfigurationLogic.Init1();
                UserManagementStatics.Init();

                systemLogic.InitSystem();
            }
            catch (Exception e) {
                secondaryInitFailed = true;

                // Suppress all exceptions since they would prevent apps from knowing that primary initialization succeeded. EWF apps need to know this in order to
                // automatically restart themselves. Other apps could find this knowledge useful as well.
                try {
                    EmailAndLogError("An exception occurred during application initialization:", e);
                }
                catch {}
            }
        }
Example #8
0
        public ActionResult ListChat(int id)
        {
            var member = GetAuthorizedMember();

            using (var sl = new SystemLogic())
            {
                if (!sl.IsMemberOfDraft(member.Id, id))
                {
                    if (Request.IsAjaxRequest())
                    {
                        return(Json(new { success = false }));
                    }
                    return(RedirectToAction("Index"));
                }

                var chats = sl.GetChatList(id);

                var vmchats = ConvertToChatViewModelList(chats, member.Id);

                if (Request.IsAjaxRequest())
                {
                    return(Json(new { success = true, chats = vmchats }));
                }
                return(RedirectToAction("Details", new { id = id }));
            }
        }
 public bool ValidateUser(string userName, string password)
 {
     using (var sl = new SystemLogic())
     {
         return(sl.AuthenticateUser(userName, password));
     }
 }
Example #10
0
 public bool ChangePassword(string userName, string oldPassword, string newPassword)
 {
     using (var sl = new SystemLogic())
     {
         return(sl.ChangePassword(userName, oldPassword, newPassword));
     }
 }
Example #11
0
        public void CanDoSimple4PlayerDraft()
        {
            IDraftLogic draftLogic = new ModifiedRotisserieDraftLogic();
            var         draft      = draftLogic.CreateDraft("My Testdraft", _members[1].Id, 75, true);

            for (var i = 0; i < 4; i++)
            {
                draftLogic.AddMemberToDraft(draft.Id, _members[i].Id);
            }

            draftLogic.StartDraft(draft.Id, false);

            using (var sl = new SystemLogic())
            {
                var wasPicked = draftLogic.PickCard(draft.Id, _members[1].Id, _cards[1].Id);
                Assert.IsFalse(wasPicked, "Not Player Bs turn");

                // Card should end up in _member[1]s FuturePick.
                var futurePicks = sl.GetMyFuturePicks(draft.Id, _members[1].Id);
                Assert.AreEqual(1, futurePicks.Count);

                wasPicked = draftLogic.PickCard(draft.Id, _members[0].Id, _cards[0].Id);
                Assert.IsTrue(wasPicked, "Player A should be able to pick");

                // We should now have two picks total in this draft.
                var picks = sl.GetPickList(draft.Id);
                Assert.AreEqual(2, picks.Count);

                //And _member[1] should have no FuturePicks
                futurePicks = sl.GetMyFuturePicks(draft.Id, _members[1].Id);
                Assert.AreEqual(0, futurePicks.Count);

                Assert.IsTrue(draftLogic.IsMyTurn(draft.Id, _members[2].Id), "Should be Player Cs turn");

                wasPicked = draftLogic.PickCard(draft.Id, _members[2].Id, _cards[2].Id);
                Assert.IsTrue(wasPicked, "It should be Player C");

                wasPicked = draftLogic.PickCard(draft.Id, _members[3].Id, _cards[3].Id);
                Assert.IsTrue(wasPicked, "It should be Player D");

                wasPicked = draftLogic.PickCard(draft.Id, _members[3].Id, _cards[4].Id);
                Assert.IsTrue(wasPicked, "It should be Player D");

                wasPicked = draftLogic.PickCard(draft.Id, _members[2].Id, _cards[5].Id);
                Assert.IsTrue(wasPicked, "It should be Player C");

                wasPicked = draftLogic.PickCard(draft.Id, _members[1].Id, _cards[6].Id);
                Assert.IsTrue(wasPicked, "It should be Player B");

                wasPicked = draftLogic.PickCard(draft.Id, _members[0].Id, _cards[7].Id);
                Assert.IsTrue(wasPicked, "It should be Player A");

                wasPicked = draftLogic.PickCard(draft.Id, _members[1].Id, _cards[8].Id);
                Assert.IsTrue(wasPicked, "It should be Player B");
            }
        }
Example #12
0
        public FailsProcedures()
        {
            InitializeComponent();

            systemLogic    = new SystemLogic();
            procedureLogic = new ProcedureLogic();

            SetInitConfigWindow();
            GetData();
        }
Example #13
0
 public MembershipCreateStatus CreateUser(string userName, string password, string email, string fullName)
 {
     using (var sl = new SystemLogic())
     {
         var creationstatus = sl.CreateUser(userName, email, password, fullName);
         return(creationstatus
                    ? MembershipCreateStatus.Success
                    : MembershipCreateStatus.DuplicateUserName);
     }
 }
Example #14
0
        private void getworklist()
        {
            SearchModel model = new SearchModel()
            {
                PageIndex = Convert.ToInt32(GetFormValue("pageIndex", 1)),
                PageSize  = Convert.ToInt32(GetFormValue("pageSize", 50))
            };
            var data = SystemLogic.GetWorkReportList(model);

            json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.OK, data));
        }
Example #15
0
        /// <summary>
        /// 获取菜单
        /// </summary>
        private void GetMenuList()
        {
            ApiStatusCode   appCode    = ApiStatusCode.OK;
            SystemLeftModel resultData = new SystemLeftModel();

            if (CheckLogin(ref appCode))
            {
                resultData.menuData  = SystemLogic.GetMenuList(user.UserIndentity);
                resultData.userData  = user;
                resultData.authority = "";
            }
            json = JsonHelper.JsonSerializer(new ResultModel(appCode, resultData));
        }
Example #16
0
 public ActionResult MyLocation(string mylocation, string lnglat)
 {
     try
     {
         SystemLogic.AddMyLocation(GetAuthUserId(), mylocation, lnglat);
         return(Json(new ResultModel(ApiStatusCode.OK)));
     }
     catch (Exception ex)
     {
         LogHelper.Log(string.Format("MyLocation:message:{0},StackTrace:{1}", ex.Message, ex.StackTrace), LogHelperTag.ERROR);
         return(Json(new ResultModel(ApiStatusCode.SERVICEERROR)));
     }
 }
Example #17
0
 //
 // GET: /Draft/
 private Member GetAuthorizedMember()
 {
     using (var sl = new SystemLogic())
     {
         if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var userName = System.Web.HttpContext.Current.User.Identity.Name;
             var member   = sl.GetMember(userName);
             if (member != null)
             {
                 return(member);
             }
         }
         return(null);
     }
 }
Example #18
0
        public ActionResult Start(StartDraftViewModel model)
        {
            using (var sl = new SystemLogic())
            {
                var authMember = GetAuthorizedMember();
                var draft      = sl.GetDraftById(model.DraftId);

                if (draft.Owner.Id != authMember.Id || draft.Started || draft.Finished)
                {
                    return(RedirectToAction("Index"));
                }

                var dl = GetDraftLogic.FromDraft(draft);
                dl.StartDraft(draft.Id, model.RandomizeSeats);

                return(RedirectToAction("Details", new { id = draft.Id }));
            }
        }
Example #19
0
        public ActionResult Create(CreateDraftViewModel model)
        {
            try
            {
                IDraftLogic draftLogic = GetDraftLogic.DefaultDraftLogic();

                using (var sl = new SystemLogic())
                {
                    var draft = draftLogic.CreateDraft(model.DraftName, GetAuthorizedMember().Id, model.MaximumNumberOfPicks, model.IsPublic);

                    return(RedirectToAction("Start", new { id = draft.Id }));
                }
            }
            catch
            {
                return(View());
            }
        }
Example #20
0
        public void TestGetSystem()
        {
            Mock <IRepository <Planet> >        planetRepo = new Mock <IRepository <Planet> >();
            Mock <IRepository <Star> >          starRepo   = new Mock <IRepository <Star> >();
            Mock <IRepository <Models.System> > systemRepo = new Mock <IRepository <Models.System> >();

            systemRepo.Setup(r => r.Read(It.IsAny <string>())).Returns(new Models.System()
            {
                SystemID = "TEST_ID"
            });
            SystemLogic logic = new SystemLogic(planetRepo.Object, starRepo.Object, systemRepo.Object);

            Models.System result = logic.GetSystem("TEST_ID");

            Assert.That(result, Is.EqualTo(new Models.System()
            {
                SystemID = "TEST_ID"
            }));
            systemRepo.Verify(r => r.Read(It.IsAny <string>()), Times.Once);
        }
Example #21
0
        private List <ChatViewModel> ConvertToChatViewModelList(IEnumerable <Chat> chatlist, int currentMemberId)
        {
            using (var sl = new SystemLogic())
            {
                var vmchats = new List <ChatViewModel>();
                foreach (Chat chat in chatlist)
                {
                    var chatmember = sl.GetMember(chat.Member.Id);
                    var cvm        = new ChatViewModel
                    {
                        ChatId     = chat.Id,
                        DateTime   = chat.CreatedDate.ToString("HH:mm"),
                        MemberName = currentMemberId == chatmember.Id ? "Me" : chatmember.FullName,
                        Text       = chat.Text
                    };
                    vmchats.Add(cvm);
                }

                return(vmchats);
            }
        }
Example #22
0
        public void CreateDebugData()
        {
            using (SystemLogic sl = new SystemLogic())
            {
                sl.CreateUser("Snidd", "*****@*****.**", "magnus", "Magnus Kjellberg");
                sl.CreateUser("Mats", "*****@*****.**", "mats", "Mats Törnros");
                sl.CreateUser("Rikard", "*****@*****.**", "rikard", "Rikard Stenlund");

                var dl = GetDraftLogic.DefaultDraftLogic();

                var member1 = sl.FindMember("Snidd");
                var member2 = sl.FindMember("Mats");
                var member3 = sl.FindMember("Rikard");

                var draft = dl.CreateDraft("Min draft", member1.Id, 75, true);

                dl.AddMemberToDraft(draft.Id, member1.Id, 1);
                dl.AddMemberToDraft(draft.Id, member2.Id, 2);
                dl.AddMemberToDraft(draft.Id, member3.Id, 3);

                dl.StartDraft(draft.Id, false);
            }
        }
Example #23
0
        public ActionResult AddMember(string memberIdentification, int id)
        {
            using (var sl = new SystemLogic())
            {
                var authMember = GetAuthorizedMember();
                var draft      = sl.GetDraftById(id);

                if (draft.Owner.Id != authMember.Id)
                {
                    return(RedirectToAction("Index"));
                }

                var dl = GetDraftLogic.FromDraft(draft);

                var member = sl.FindMember(memberIdentification);
                if (member != null)
                {
                    dl.AddMemberToDraft(draft.Id, member.Id);
                }

                return(RedirectToAction("Start", new { id = draft.Id }));
            }
        }
Example #24
0
        public ActionResult Chat(int draftId, string message, int chatTempId)
        {
            var member = GetAuthorizedMember();

            using (var sl = new SystemLogic())
            {
                if (!sl.IsMemberOfDraft(member.Id, draftId))
                {
                    if (Request.IsAjaxRequest())
                    {
                        return(Json(new { success = false }));
                    }
                    return(RedirectToAction("Index"));
                }

                var chat = sl.AddChat(message, draftId, member.Id);

                if (Request.IsAjaxRequest())
                {
                    return(Json(new { success = true, chatId = chat.Id, oldChatId = chatTempId }));
                }
                return(RedirectToAction("Details", new { id = draftId }));
            }
        }
 static partial void initGlobalLogic(ref SystemLogic globalLogic)
 {
     globalLogic = new GlobalLogic();
 }
 static partial void initGlobalLogic( ref SystemLogic globalLogic ) {
   globalLogic = new YourGlobalLogicClass();
 }
Example #27
0
 public void DeleteEntity <T>(T listing, int id)
     where T : IListing
 {
     SystemLogic.DeleteItem <T>(listing, id);
 }
Example #28
0
        /// <summary>
        /// Call this from Application_Start in your Global.asax.cs file. Besides this call, there should be no other code in the method.
        /// </summary>
        // We could save people the effort of calling this by using trick #1 in
        // http://www.paraesthesia.com/archive/2011/02/08/dynamic-httpmodule-registration-in-asp-net-4-0.aspx, but that would probably require making this a static
        // method and would probably also cause this method to run at start up time in *all* web applications that reference the Standard Library, even the ones
        // that don't want to use EWF.
        protected void ewfApplicationStart(SystemLogic systemLogic)
        {
            // This is a hack to support data-access state in WCF services.
            var wcfDataAccessState = new ThreadLocal <DataAccessState>(() => new DataAccessState());

            // Initialize system.
            var initTimeDataAccessState = new ThreadLocal <DataAccessState>(() => new DataAccessState());

            try {
                AppTools.Init(
                    Path.GetFileName(Path.GetDirectoryName(HttpRuntime.AppDomainAppPath)),
                    false,
                    systemLogic,
                    mainDataAccessStateGetter: () => {
                    // We must use the Instance property here to prevent this logic from always returning the request state of the *first* EwfApp instance.
                    return(Instance != null
                                                               ? Instance.RequestState != null ? Instance.RequestState.DataAccessState : initTimeDataAccessState.Value
                                                               : System.ServiceModel.OperationContext.Current != null ? wcfDataAccessState.Value : null);
                });
            }
            catch {
                // Suppress all exceptions since there is no way to report them.
                return;
            }
            ewlInitialized = true;

            // Initialize web application.
            if (!AppTools.SecondaryInitFailed)
            {
                executeWithBasicExceptionHandling(
                    () => {
                    EwfConfigurationStatics.Init();

                    // Prevent MiniProfiler JSON exceptions caused by pages with hundreds of database queries.
                    MiniProfiler.Settings.MaxJsonResponseSize = int.MaxValue;

                    GlobalType       = GetType().BaseType;
                    MetaLogicFactory =
                        GlobalType.Assembly.CreateInstance("RedStapler.StandardLibrary.EnterpriseWebFramework." + GlobalType.Namespace + ".MetaLogicFactory") as
                        AppMetaLogicFactory;
                    if (MetaLogicFactory == null)
                    {
                        throw new ApplicationException("Meta logic factory not found.");
                    }

                    // This initialization could be performed using reflection. There is no need for EwfApp to have a dependency on these classes.
                    if (systemLogic != null)
                    {
                        CssPreprocessingStatics.Init(systemLogic.GetType().Assembly, GlobalType.Assembly);
                    }
                    else
                    {
                        CssPreprocessingStatics.Init(GlobalType.Assembly);
                    }
                    EwfUiStatics.Init(GlobalType);

                    initializeWebApp();

                    initTimeDataAccessState = null;
                    initialized             = true;
                },
                    false,
                    false);
            }

            // If initialization failed, unload and restart the application after a reasonable delay.
            if (!initialized)
            {
                const int unloadDelay = 60000;                 // milliseconds
                initFailureUnloadTimer = new Timer(
                    state => executeWithBasicExceptionHandling(
                        () => {
                    if (AppTools.IsDevelopmentInstallation)
                    {
                        return;
                    }
                    HttpRuntime.UnloadAppDomain();

                    // Restart the application by making a request. Idea from Rick Strahl:
                    // http://weblog.west-wind.com/posts/2013/Oct/02/Use-IIS-Application-Initialization-for-keeping-ASPNET-Apps-alive.
                    //
                    // Disable server certificate validation so that this request gets through even for web sites that don't use a certificate that is trusted by
                    // default. There is no security risk since we're not sending any sensitive information and we're not using the response.
                    NetTools.ExecuteWithResponse(IisConfigurationStatics.GetFirstBaseUrlForCurrentSite(false), response => { }, disableCertificateValidation: true);
                },
                        false,
                        false),
                    null,
                    unloadDelay,
                    Timeout.Infinite);
            }
        }
Example #29
0
        private DraftViewModel GetDraftViewModel(int draftId)
        {
            var draftLogic  = GetDraftLogic.FromDraftId(draftId);
            var systemLogic = new SystemLogic();

            if (!draftLogic.IsDraftAvailable(draftId))
            {
                return(null);
            }

            var draft = systemLogic.GetDraftById(draftId);

            using (var sl = new SystemLogic())
            {
                var picks = systemLogic.GetPickList(draftId);
                var dvm   = new DraftViewModel
                {
                    Id = draftId,
                    MaximumNumberOfPicks = draft.MaximumPicksPerMember,
                    Name                 = draft.Name,
                    Owner                = sl.GetMember(draft.Owner.Id).FullName,
                    CreationDate         = draft.CreatedDate,
                    CurrentPickPosition  = draftLogic.CurrentPickPosition(draftId),
                    CurrentNumberOfPicks = picks.Count
                };

                var members = systemLogic.GetDraftMembers(draftId);

                foreach (var draftMemberPositions in members)
                {
                    var member        = sl.GetMember(draftMemberPositions.Member.Id);
                    var draftMemberVm = new DraftMemberVm
                    {
                        DisplayName = member.FullName,
                        Id          = member.Id,
                    };

                    dvm.Members.Add(draftMemberVm);
                }

                var pickCount  = picks.Count;
                var startIndex = pickCount - draft.DraftSize;
                if (startIndex < 0)
                {
                    startIndex = 0;
                }

                for (int i = startIndex; i < pickCount; i++)
                {
                    var pick = picks[i];

                    var member = sl.GetMember(pick.Member.Id);
                    var card   = sl.GetCard(pick.Card.Id);

                    var pvm = new PickViewModel {
                        CardId = pick.Card.Id, MemberId = pick.Member.Id, PickTime = PickTime.History, CardName = card.Name, MemberName = member.FullName
                    };
                    dvm.Picks.Add(pvm);
                }

                var currentPick = new PickViewModel()
                {
                    MemberId   = draft.CurrentTurn.Id,
                    MemberName = sl.GetMember(draft.CurrentTurn.Id).FullName,
                    PickTime   = PickTime.Current,
                };
                dvm.Picks.Add(currentPick);

                for (int i = 0; i < draft.DraftSize; i++)
                {
                    var nextDraftPosition = draftLogic.GetNextPickPosition(pickCount + 1 + i, draft.DraftSize);
                    var nextMember        = dvm.Members[nextDraftPosition - 1];
                    var nextPick          = new PickViewModel
                    {
                        MemberName = nextMember.DisplayName,
                        MemberId   = nextMember.Id,
                        PickTime   = PickTime.Future
                    };

                    dvm.Picks.Add(nextPick);
                }

                var authMember = GetAuthorizedMember();
                if (authMember != null)
                {
                    foreach (FuturePick fp in sl.GetMyFuturePicks(draftId, authMember.Id))
                    {
                        Card card = sl.GetCard(fp.Card.Id);
                        dvm.FuturePicks.Add(card.Name);
                    }
                }

                return(dvm);
            }
        }
Example #30
0
 public SystemController(SystemLogic systemLogic)
 {
     this.systemLogic = systemLogic;
 }