public void DeleteWorkOrder(WorkOrder workOrder)
 {
     using (ISession session = HibernateProvider.Factory.OpenSession())
     {
         session.Delete(workOrder);
         session.Flush();
     }
 }
 public void InsertWorkOrder(WorkOrder workOrder)
 {
     using (ISession session = HibernateProvider.Factory.OpenSession())
     {
         session.SaveOrUpdate(workOrder);
         session.Flush();
     }
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the WorkOrders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToWorkOrders(WorkOrder workOrder)
 {
     base.AddObject("WorkOrders", workOrder);
 }
        public bool TryLoadWorkOrderByJobID(string jobID, out WorkOrder workOrder)
        {
            bool bSuccess = false;
            workOrder = null;

            //TODO: prone to SQL injection
            string sqlQuery = string.Format("SELECT * FROM WorkOrders WHERE JobID = '{0}'", jobID);

            try
            {
                OleDbCommand sqlCommand = new OleDbCommand(sqlQuery, _accessConnection);
                OleDbDataReader reader = sqlCommand.ExecuteReader();

                while (reader.Read())
                {
                    workOrder = new WorkOrder();
                    workOrder.Load(reader);
                    bSuccess = true;
                }
            }
            catch (Exception e)
            {
            }

            return bSuccess;
        }
 /// <summary>
 /// Create a new WorkOrder object.
 /// </summary>
 /// <param name="workOrderID">Initial value of the WorkOrderID property.</param>
 public static WorkOrder CreateWorkOrder(global::System.Int32 workOrderID)
 {
     WorkOrder workOrder = new WorkOrder();
     workOrder.WorkOrderID = workOrderID;
     return workOrder;
 }