/// <summary> /// Update urgency object /// </summary> /// <param name="urgency">Urgency object</param> public void UpdateUrgency(Urgency urgency) { try { Urgency ur = (from u in context.Urgencies where u.UrgencyID == urgency.UrgencyID select u).FirstOrDefault<Urgency>(); ur.Name = urgency.Name; ur.Level = urgency.Level; context.SaveChanges(); } catch (Exception) { throw; } }
/// <summary> /// Delete urgency object /// </summary> /// <param name="urgency">Urgency object</param> public void DeleteUrgency(Urgency urgency) { try { context.Urgencies.DeleteObject(urgency); } catch (Exception) { throw; } }
/// <summary> /// Get urgency by primary key /// </summary> /// <param name="urgency">Urgency object</param> /// <returns>Urgency object</returns> public Urgency GetUrgencyByID(Urgency urgency) { return GetAllUrgencies().Where(u => u.UrgencyID == urgency.UrgencyID).FirstOrDefault<Urgency>(); }
/// <summary> /// Update urgency object /// </summary> /// <param name="urgency">Urgency object</param> public bool UpdateUrgency(Urgency urgency) { try { Urgency ur = requisitionDAO.GetUrgencyByID(urgency); if (ur != null && ur.UrgencyID != 0) { ur.Name = urgency.Name; ur.Level = urgency.Level; requisitionDAO.UpdateUrgency(ur); return true; } ErrorMessage("Update urgency record failed"); return false; } catch (Exception) { throw; } }
/// <summary> /// Create a urgency object /// </summary> /// <param name="urgency">Urgency object</param> public void CreateUrgency(Urgency urgency) { try { context.AddToUrgencies(urgency); } catch (Exception) { throw; } }
/// <summary> /// Get urgency by primary key /// </summary> /// <param name="urgency">Urgency object</param> /// <returns>Urgency object</returns> public Urgency GetUrgencyByID(Urgency urgency) { Urgency temp = requisitionDAO.GetUrgencyByID(urgency); if (temp != null) return temp; ErrorMessage("Result not found"); return null; }
/// <summary> /// Delete urgency object /// </summary> /// <param name="urgency">Urgency object</param> public bool DeleteUrgency(Urgency urgency) { try { if (urgency != null && urgency.UrgencyID != 0) { requisitionDAO.DeleteUrgency(urgency); return true; } ErrorMessage("Delete urgency record failed"); return false; } catch (Exception) { throw; } }
/// <summary> /// Create a urgency object /// </summary> /// <param name="urgency">Urgency object</param> public void CreateUrgency(Urgency urgency) { try { if (urgency != null) { requisitionDAO.CreateUrgency(urgency); } else { ErrorMessage("Create urgency record failed"); } } catch (Exception) { throw; } }
/// <summary> /// Create a new Urgency object. /// </summary> /// <param name="urgencyID">Initial value of the UrgencyID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="level">Initial value of the Level property.</param> public static Urgency CreateUrgency(global::System.Int32 urgencyID, global::System.String name, global::System.Int32 level) { Urgency urgency = new Urgency(); urgency.UrgencyID = urgencyID; urgency.Name = name; urgency.Level = level; return urgency; }
/// <summary> /// Deprecated Method for adding a new object to the Urgencies EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUrgencies(Urgency urgency) { base.AddObject("Urgencies", urgency); }