package models.services
import forms._
import models._
import org.squeryl._
import org.squeryl.PrimitiveTypeMode._


case class NotifyManager() {
  def insert(notify: NotifyForm, notifyType: Long, partId: Long, designChangeId: Long, paramState: Int):Notify = {
    val newNotify = PartsListDb.notifies.insert(Notify(notify.message, notify.atach, UserManager().getByName(notify.users.name).id, notifyType, partId, designChangeId, paramState))
    return newNotify
  }
  
  def update(notify: Notify) = {
    PartsListDb.notifies.update(notify)
  }
  
  def getById(id: Long): Notify ={
    PartsListDb.notifies.where(n => n.id === id).head
  }

}