public bool Insert(GradeHistoryEntity gradeHistoryEntity)
        {
            bool result = true;

            Database db = DatabaseFactory.CreateDatabase(Constant.DiaryDBConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("usp_GradeHistoryInsert");

            db.AddInParameter(dbCommand, "@NewGradeId", DbType.Int32, gradeHistoryEntity.NewGradeId);
            db.AddInParameter(dbCommand, "@OldGradeId", DbType.Int32, gradeHistoryEntity.OldGradeId);
            db.AddInParameter(dbCommand, "@UserId", DbType.Guid, gradeHistoryEntity.UserId);
            db.AddInParameter(dbCommand, "@CreatedBy", DbType.Guid, gradeHistoryEntity.CreatedBy);

            db.ExecuteNonQuery(dbCommand);

            return result;
        }
Exemple #2
0
 private void AddGradeHistory()
 {
     User user = Dairy.Utility.Generic.Get<User>(this.UserId.Value);
     if (user.GradeId != this.GradeId)
     {
         GradeHistoryEntity gradeHistory = new GradeHistoryEntity();
         gradeHistory.UserId = this.UpdatedBy;
         gradeHistory.OldGradeId = user.GradeId;
         gradeHistory.NewGradeId = this.GradeId.Value;
         gradeHistory.CreatedBy = this.UpdatedBy;
         new GradeHistoryDao().Insert(gradeHistory);
     }
 }