コード例 #1
0
        public PlayerDetails Clone()
        {
            var newObject = new PlayerDetails
            {
                Id                    = Id,
                Handicap101           = Handicap101,
                Handicap201           = Handicap201,
                Handicap301           = Handicap301,
                Handicap401           = Handicap401,
                Handicap501           = Handicap501,
                HandicapCricket       = HandicapCricket,
                Name                  = Name,
                NickName              = NickName,
                IsDirty               = false,
                PlayerImageDefinition = new ImageDefinition()
            };

            if (PlayerImageDefinition != null)
            {
                newObject.PlayerImageDefinition.SourceBytes = PlayerImageDefinition.SourceBytes;
            }

            newObject.SelectedFlight = StandingData.GetFlights()[SelectedFlight.Index - 1];

            newObject.RegenerateImage();

            return(newObject);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: petersen65/CSharp-Projects
        private static void ReportStandingData(string sql, ref string[] lastAllIds)
        {
            StandingData standingData;
            var          msmqCapacity = int.Parse(ConfigurationManager.AppSettings[CONFIG_MSMQ_CAPACITY]);
            var          allIds       = StandingData.RetrieveAll(sql);

            Console.WriteLine("Retrieving Standing Data...\n");

            foreach (var id in allIds)
            {
                if (Array.BinarySearch(lastAllIds, id) >= 0)
                {
                    continue;
                }

                standingData = new StandingData(sql, long.Parse(id), msmqCapacity);
                standingData.Retrieve();

                Console.WriteLine("Retrieved SD from SQL ({0} bytes)", standingData.Length);
                Console.WriteLine(standingData);
                Console.WriteLine();
            }

            lastAllIds = allIds;
            Array.Sort(lastAllIds);

            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
        }
コード例 #3
0
        private void Navigate(Type view)
        {
            var type = view.Name;

            var standing = new StandingData
            {
                Driver      = _driverStanding,
                Constructor = _constructorStanding
            };

            SplitViewFrame.Navigate(view, standing);
            BackCommand.RaiseCanExecuteChanged();
        }
コード例 #4
0
        public async void RegenerateImage()
        {
            if (PlayerImageDefinition == null)
            {
                PlayerImageDefinition = new ImageDefinition();
            }

            if (PlayerImageDefinition != null)
            {
                PlayerImageDefinition.Source = await PlayerImageDefinition.SourceBytes.AsBitmapImageAsync();
            }

            SelectedFlight.Image = StandingData.GetFlights()[SelectedFlight.Index - 1].Image;
        }
コード例 #5
0
        private void Initialise()
        {
            Flights = StandingData.GetFlights();

            GamesForStatistics = Games;

            LoadCommands();

            CreateNewPlayer();

            LoadExistingPlayers();

            InitialiseSubscriptions();

            ShowPlayerView = true;
        }
コード例 #6
0
        // GET: /Report/Edit/n
        public IActionResult Edit(int?id, string commiterror = null)
        {
            string method = "Report/Edit";

            Log.Me.Debug(method + " - User: "******", PendingId: " + (id ?? 0).ToString());
            ApplicationVersion();

            if (NullId(id, "PendingId", method))
            {
                return(RedirectToAction("Error", "Home"));
            }

            try
            {
                PendingReport pr = null;
                if ((pr = Read(id.Value, method)) == null)
                {
                    return(RedirectToAction("Error", "Home"));
                }

                StandingData sd = _context.StandingDataRepo.Load();

                ViewData["RecipientMessage"] = "- " + _context.CirculationRepo.RecipientMessage(id.Value);
                if (commiterror != null)
                {
                    ViewData["CommitError"] = commiterror;
                }
                ViewData["UploadMax"] = ((int)((Config.Get("FileSizeLimit").ToLong()) / (1024 * 1024))).ToString() + "Mb";

                PendingReportViewModel report = new PendingReportViewModel(pr, sd);

                //Log.Me.Info("ReportType='" + report.ReportType + "'");
                //foreach (SelectListItem item in report.ReportTypes) Log.Me.Info("ReportTypeSelect: '" + item.Text + "' = '" + item.Value + "'");

                return(View(report));
            }
            catch (Exception ex)
            {
                Log.Me.Error("Exception in " + method + ": " + ex.Message);
                return(RedirectToAction("Error", "Home"));
            }
        }
コード例 #7
0
        public ActionResult Save(StandingDataModel model)
        {
            StandingData entity = new StandingData();

            ModelCopier.CopyModel(model, entity);


            if (model.Id == 0)
            {
                standingDataService.Add(entity);
            }
            else
            {
                standingDataService.Update(entity);
            }

            unitOfWork.Commit();

            return(PartialView());
        }
コード例 #8
0
        public void CopyFrom(PlayerDetails playerDetails)
        {
            Handicap101     = playerDetails.Handicap101;
            Handicap201     = playerDetails.Handicap201;
            Handicap301     = playerDetails.Handicap301;
            Handicap401     = playerDetails.Handicap401;
            Handicap501     = playerDetails.Handicap501;
            HandicapCricket = playerDetails.HandicapCricket;
            Name            = playerDetails.Name;
            NickName        = playerDetails.NickName;

            if (PlayerImageDefinition != null && playerDetails.PlayerImageDefinition != null)
            {
                PlayerImageDefinition.SourceBytes = playerDetails.PlayerImageDefinition.SourceBytes;
            }
            else
            {
                PlayerImageDefinition = new ImageDefinition();
            }

            SelectedFlight = StandingData.GetFlights()[playerDetails.SelectedFlight.Index - 1];

            RegenerateImage();
        }
コード例 #9
0
        public PendingReportViewModel(PendingReport pr, StandingData sd)
        {
            if (pr != null && sd != null)
            {
                this.Abstract      = pr.Abstract;
                this.Author        = pr.Author;
                this.Axess         = pr.Axess;
                this.CID           = pr.CID;
                this.CreationDate  = pr.CreationDate;
                this.DateSent      = pr.DateSent;
                this.Deleted       = pr.Deleted;
                this.eFileName     = pr.eFileName;
                this.eFilePath     = pr.eFilePath;
                this.JobNo         = pr.JobNo;
                this.RecipientID   = pr.RecipientID;
                this.ReportNo      = pr.ReportNo;
                this.ReportType    = pr.ReportType;
                this.ReportYear    = pr.ReportYear;
                this.SecurityLevel = pr.SecurityLevel;
                this.Software      = pr.Software;
                this.State         = pr.State;
                this.Title         = pr.Title;

                this.ReportTypes = new List <SelectListItem>();
                foreach (ReportType type in sd.ReportTypes)
                {
                    this.ReportTypes.Add(new SelectListItem(type.Code, type.Code));
                }

                this.SecurityLevels = new List <SelectListItem>();
                foreach (SecurityLevel level in sd.SecurityLevels)
                {
                    this.SecurityLevels.Add(new SelectListItem(level.Text, level.Code.ToString()));
                }
            }
        }
コード例 #10
0
        private void Navigate(Type view)
        {
            var type = view.Name;

            var standing = new StandingData
            {
                Driver = _driverStanding,
                Constructor = _constructorStanding
            };

            SplitViewFrame.Navigate(view, standing);
            BackCommand.RaiseCanExecuteChanged();
        }
コード例 #11
0
        static void Main(string[] args)
        {
            string sFail = "";

            // Define Test Data
            List <String> people = new List <string>()
            {
                "Aleshia Tomkiewicz", "Michell Throssell", "Dong Kopczynski", "Elinore Fulda"
            };
            string domain  = "@gmx.com";
            string address = "Acme Corporation,\nBBC Quay House,\nMediaCityUK,\nSalford,\nM50 2QH";

            Config.Setup("appsettings.json", Directory.GetCurrentDirectory(), null, "ReportDistDataTest");

            DbContextOptions <DataContext> options = new DbContextOptions <DataContext>();
            DataContext context = new DataContext(options);

            Log.Me.DebugOn = true;
            Log.Me.Debug("Testing Recipient");
            int rid = TestCRU <Recipient>(context.RecipientRepo, MakeRecipient(), CheckRecipient, "Name");

            if (rid == -1)
            {
                return;
            }

            Log.Me.Debug("Testing PendingReport");
            int pid = TestCRU <PendingReport>(context.PendingReportRepo, MakePendingReport(rid), CheckPendingReport, "eFileName");

            if (pid == -1)
            {
                return;
            }

            Log.Me.Debug("Testing ReportCirculation");
            int circid;

            foreach (Recipient r in FillRecipients(people, domain, address))
            {
                rid = context.RecipientRepo.Find(r.Email);
                if (rid == 0)
                {
                    rid = context.RecipientRepo.Create(r);
                }
                r.RecipientID = rid;
                circid        = context.CirculationRepo.Create(MakeCirculation(r, pid));
            }
            rid = context.RecipientRepo.Find(MakeEmail(people[1], domain));
            Recipient r2 = context.RecipientRepo.Read(rid);

            circid = TestCRU <Circulation>(context.CirculationRepo, MakeCirculation(r2, pid), CheckCirculation, "Email");
            if (circid == -1)
            {
                return;
            }

            Log.Me.Debug("Testing StandingData");
            StandingData sd = context.StandingDataRepo.Load();

            if (sd.Years.Count() != 5 || sd.Years.First() != DateTime.Now.Year.ToString())
            {
                sFail += "StandingData1 ";
            }
            if (sd.Companies.Count() != 4 || sd.Companies.Where(c => c.StartYear == 2011).First().Code != "ENT")
            {
                sFail += "StandingData2 ";
            }
            if (sd.ReportTypes.Count() != 3 || sd.ReportTypes.Where(r => r.Code == "R").First().Name != "Report (R)")
            {
                sFail += "StandingData3 ";
            }
            if (sd.SecurityLevels.Count() != 6 || sd.SecurityLevels.Where(r => r.Code == 100).First().Text != "Secret")
            {
                sFail += "StandingData4 ";
            }
            if (sd.AccessCodes.Count() != 8 || sd.AccessCodes.Where(a => a.Code == "UIN").First().Title != "Uniper Innovation")
            {
                sFail += "StandingData5 ";
            }

            if (context.PendingReportRepo.GetCID("UTG/20/ASF/AR/2/R") != null)
            {
                sFail += "GetCID1 ";
            }
            if (context.PendingReportRepo.GetCID("UTG/20/APC/CM/8/TIP") != 539282)
            {
                sFail += "GetCID2 ";
            }
            if (context.PendingReportRepo.GetCID("UTG/20/APC/CM/5/R") != 539281)
            {
                sFail += "GetCID3 ";
            }
            if (context.PendingReportRepo.GetCID("UTG/19/ASF/FP/543/R") != 539083)
            {
                sFail += "GetCID4 ";
            }

            if (sFail.Length == 0)
            {
                Console.WriteLine("**********************");
                Console.WriteLine("** All Tests passed **");
                Console.WriteLine("**********************");
            }
            else
            {
                Console.WriteLine("!!!!!!!!!!!!!!!!!!!");
                Console.WriteLine("!! Failed tests: " + sFail);
                Console.WriteLine("!!!!!!!!!!!!!!!!!!!");
            }
        }
コード例 #12
0
 public void Update(StandingData entity)
 {
     serviceRepository.Update(entity);
 }
コード例 #13
0
 public void Add(StandingData entity)
 {
     serviceRepository.Add(entity);
 }