/// <summary>
 /// 创建 ContestDetailModel 类的新实例。
 /// </summary>
 public ContestDetailModel()
 {
     ContestId             = 0;
     Title                 = string.Empty;
     Creator               = string.Empty;
     UsergroupName         = UsergroupConvert.ConvertToString(UserGroup.Standard);
     CreationTime          = DateTime.Now;
     StartTimeString       = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
     EndTimeString         = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
     ParticipationModeName = ContestParticipationModeConvert.ConvertToString(ContestParticipationMode.Both);
     AuthorizationModeName = ContestAuthorizationModeConvert.ConvertToString(ContestAuthorizationMode.Protected);
     Password              = string.Empty;
 }
        /// <summary>
        /// 从给定的比赛句柄创建 ContestDetailModel 类的新实例。
        /// </summary>
        /// <param name="handle">比赛句柄。</param>
        /// <returns>从给定的比赛句柄创建的比赛详细信息数据模型对象。</returns>
        /// <exception cref="ArgumentNullException"/>
        public static ContestDetailModel FromContestHandle(ContestHandle handle)
        {
            if (handle == null)
            {
                throw new ArgumentNullException(nameof(handle));
            }

            ContestDetailModel model = new ContestDetailModel();

            using (ContestDataProvider data = ContestDataProvider.Create(handle, true))
            {
                model.ContestId             = data.ContestId;
                model.Title                 = data.Title;
                model.Creator               = data.Creator;
                model.UsergroupName         = UsergroupConvert.ConvertToString(data.AuthorizationGroup);
                model.CreationTime          = data.CreationTime;
                model.StartTimeString       = data.StartTime.ToString("yyyy-MM-dd HH:mm:ss");
                model.EndTimeString         = data.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
                model.AuthorizationModeName = ContestAuthorizationModeConvert.ConvertToString(data.AuthorizationMode);
                model.ParticipationModeName = ContestParticipationModeConvert.ConvertToString(data.ParticipationMode);
            }

            return(model);
        }