Beispiel #1
0
 /// <summary>指定した日付と同日の身体測定データ(自分自身は除く)が
 /// 存在するかを返します。</summary>
 /// <param name="value">存在をチェックする日付を表すDateTime?。</param>
 /// <param name="target">チェックで除外する身体測定データを表すPhysicalInformation。</param>
 /// <returns>指定した日付と同日の身体測定データが存在するかを表すbool。</returns>
 public bool HasPhysicalKey(System.DateTime?value, PhysicalInformation target)
 {
     return(value.HasValue
         ? this.Physicals
            .Where(p => p.MeasurementDate.Value.HasValue)
            .FirstOrDefault((p) => p.MeasurementDate.Value.Value.Date == value.Value.Date && p.Id != target.Id) != null
         : this.Physicals.FirstOrDefault(p => !p.MeasurementDate.Value.HasValue) != null);
 }
Beispiel #2
0
 /// <summary>
 /// 新規dataを作成・登録する
 /// </summary>
 /// <typeparam name="T">作成するdataの型</typeparam>
 /// <returns>作成した新規data</returns>
 public T Create <T>() where T : class
 {
     if (typeof(T) == typeof(PhysicalInformation))
     {
         var temp = new PhysicalInformation(this._publishPhysicalId());
         this.Physicals.Add(temp);
         return(temp as T);
     }
     else if (typeof(T) == typeof(TestPointInformation))
     {
         var temp = new TestPointInformation(this._publishTestPointId(), "新しい試験日");
         this.TestPoints.Add(temp);
         return(temp as T);
     }
     else
     {
         return(null);
     }
 }