//Get TimeTable Model For Delete public TblTimetable getTimeTable(int givenID) { TblTimetable tdObj = (TblTimetable)NHSession.CreateCriteria(typeof(TblTimetable)) .Add(Restrictions.Eq(Constants.allModelProperties.TimetableId, givenID)) .UniqueResult(); return(tdObj); }
//Get TimeTable For checking Already Exist public TblTimetable getTimeTable(int DeptID, int courseID, int sessionID, string section) { var dis = Restrictions.Disjunction(); TblTimetable tdObj = (TblTimetable)NHSession.CreateCriteria(typeof(TblTimetable)) .Add(Restrictions.Eq(Constants.allModelProperties.DeptId, DeptID)) .Add(Restrictions.Eq(Constants.allModelProperties.CourseId, courseID)) .Add(Restrictions.Eq(Constants.allModelProperties.SessionId, sessionID)) .Add(dis.Add(Restrictions.Eq(Constants.allModelProperties.ClassSection, section))) .UniqueResult(); return(tdObj); }
public int AddTimeTable(TblTimetable Tb) { using (ITransaction T = NHSession.BeginTransaction()) { try { int result = (Int32)NHSession.Save(Tb); T.Commit(); return(result); } catch (Exception ex) { T.Rollback(); } } return(-1); }
public bool deleteTimeTable(TblTimetable L) { bool result = false; using (ITransaction T = NHSession.BeginTransaction()) { try { NHSession.Delete(L); T.Commit(); result = true; } catch (Exception ex) { T.Rollback(); } } return(result); }