public static ICriteria GetCriteriaForBookRequests(NameValueCollection pars) { Agent a = AgentBO.GetLoggedInAgent(); Customer c = CustomerBO.GetLoggedInCustomer(); ICriteria cr = NHibernateHelper.GetCurrentSession().CreateCriteria(typeof(BookRequest)); cr.AddOrder(new Order("TimeofCreation", false)); if (pars.Get("triptype") != null) { cr.Add(Restrictions.Eq("TripType", pars.Get("triptype"))); } if (pars.Get("name") != null) { cr.Add(Restrictions.Eq("ContactDetails.Name", pars.Get("name"))); } if (pars.Get("email") != null) { cr.Add(Restrictions.Eq("ContactDetails.Email", pars.Get("email"))); } if (pars.Get("agentid") != null) { cr.Add(Restrictions.Eq("Agent", AgentDAO.FindAgentByID(Int64.Parse(pars.Get("agentid"))))); } if (a != null) { cr.Add(Restrictions.Eq("Agent", a)); } if (c != null) { cr.Add(Restrictions.Eq("ContactDetails.Email", c.Email)); } if (pars.Get("status") != null) { cr.Add(Restrictions.Eq("Status", Int16.Parse(pars.Get("status")))); } else { cr.Add(Restrictions.Eq("Status", (short)0)); } if (pars.Get("aircrafttype") != null) { cr.Add(Restrictions.Eq("PlaneType", OperatorDAO.FindAircraftTypeByID(pars.Get("aircrafttype")))); } return(cr); }
public static IList <AirplaneTypeRate> GetAllRates(NameValueCollection pars) { ICriteria cr = NHibernateHelper.GetCurrentSession().CreateCriteria(typeof(AirplaneTypeRate)); Country c = AdminDAO.GetCountryByID(pars.Get("country")); if (pars.Get("country") != null) { cr.Add(Restrictions.Eq("Country", c)); } AirplaneType at = OperatorDAO.FindAircraftTypeByID(pars.Get("aircrafttype")); if (pars.Get("aircrafttype") != null) { cr.Add(Restrictions.Eq("PlaneType", at)); } cr.AddOrder(new Order("Country", false)); return(cr.List <AirplaneTypeRate>()); }