コード例 #1
0
ファイル: TypoRepository.cs プロジェクト: Hobbitron/WheelMUD
 public void Update(TypoRecord typo)
 {
     using (IDbCommand session = Helpers.OpenSession())
         using (IDbTransaction transaction = session.Connection.BeginTransaction())
         {
             session.Connection.Update(typo);
             transaction.Commit();
         }
 }
コード例 #2
0
ファイル: TypoEntry.cs プロジェクト: Hobbitron/WheelMUD
        /// <summary>
        /// Initializes a new instance of the TypoEntry class.
        /// </summary>
        /// <param name="record"> The record that contains the information from the database. </param>
        public TypoEntry(TypoRecord record)
        {
            this.Id = record.ID;
            this.Note = record.Note;
            this.Resolved = record.Resolved;
            this.ResolvedByPlayerId = record.ResolvedByPlayerID;
            this.PlaceID = record.RoomID.ToString(CultureInfo.InvariantCulture);
            this.SubmittedByPlayerID = record.SubmittedByPlayerID.ToString(CultureInfo.InvariantCulture);
            this.SubmittedDateTime = DateTime.Parse(record.SubmittedDateTime);

            if (record.ResolvedDateTime != null)
            {
                this.ResolvedDateTime = DateTime.Parse(record.ResolvedDateTime);
            }
            else
            {
                this.ResolvedDateTime = null;
            }
        }
コード例 #3
0
ファイル: TypoEntry.cs プロジェクト: Hobbitron/WheelMUD
        /// <summary> Save the typo to the database </summary>
        public void Save()
        {
            var typoRepository = new TypoRepository();

            var typoRecord = new TypoRecord
            {
                ID = this.Id,
                Note = this.Note,
                Resolved = this.Resolved,
                ResolvedByPlayerID = (long)this.ResolvedByPlayerId,
                RoomID = Convert.ToInt64(this.PlaceID),
                SubmittedByPlayerID = Convert.ToInt64(this.SubmittedByPlayerID),
            };

            if (this.ResolvedDateTime != null)
            {
                typoRecord.ResolvedDateTime = this.ResolvedDateTime.ToString();
            }
            else
            {
                typoRecord.ResolvedDateTime = null;
            }

            typoRecord.SubmittedDateTime = this.SubmittedDateTime.ToString(CultureInfo.InvariantCulture);

            if (typoRecord.ID == 0)
            {
                typoRepository.Add(typoRecord);
                this.Id = typoRecord.ID;
            }
            else
            {
                typoRepository.Update(typoRecord);
            }
        }