コード例 #1
0
        public override void Update(IDatabase db, Court court, IEnumerable <JudgeModel> judges)
        {
            base.Update(db, court, judges);
            court.Name         = Name.Sanatize();
            court.BoardName    = BoardName.Sanatize();
            court.Mail         = Mail.Sanatize();
            court.BoardMail    = BoardMail.Sanatize();
            court.ReminderMode = ReminderMode.TryParseEnum(Model.ReminderMode.Standard);

            if (CourtKey.IsNullOrEmpty())
            {
                court.CourtKey = Rng.Get(16).ToHexString();
            }
            else
            {
                court.CourtKey = CourtKey.Sanatize();
            }

            if (BoardKey.IsNullOrEmpty())
            {
                court.BoardKey = Rng.Get(16).ToHexString();
            }
            else
            {
                court.BoardKey = BoardKey.Sanatize();
            }

            court.LastUpdate    = LastUpdate.ParseTimestamp();
            court.LastReminder  = LastReminder.ParseTimestamp();
            court.ReminderLevel = ReminderLevel.TryParseInt(0, 0, 9);

            if (Substitute == NullOption)
            {
                court.Substitute = null;
            }
            else
            {
                Guid substituteId = Guid.Empty;
                if (Guid.TryParse(Substitute, out substituteId))
                {
                    if (substituteId.Equals(Guid.Empty))
                    {
                        court.Substitute = null;
                    }
                    else
                    {
                        court.Substitute = db.Query <Court>(substituteId);
                    }
                }
            }
        }