//inserts/creates a Task/Work Order object in the DAL->db
        //POST: /TSTaskWorkOrder/InsertTaskWO
        public string InsertTaskWO(TSTaskWorkOrderModel tsTaskWorkOrder)
        {
            //if the object has data, insert the data, else if there is no data just return a string
            try
            {
                //create a new DAL-based TaskWO-type object called oTaskWO
                TaskWO oTaskWO = new TaskWO();

                //populate the DAL-object with the MVC object data
                oTaskWO.Task_WO_ID      = tsTaskWorkOrder.Task_WO_ID;
                oTaskWO.TaskType        = tsTaskWorkOrder.TaskType;
                oTaskWO.ExpenseType     = tsTaskWorkOrder.ExpenseType;
                oTaskWO.TaskDescription = tsTaskWorkOrder.TaskDescription;
                oTaskWO.TaskPurpose     = tsTaskWorkOrder.TaskPurpose;
                oTaskWO.Active          = tsTaskWorkOrder.Active;

                //connect via interface to DAL App, and insert the object
                itsApp.InsertTaskWO(oTaskWO);
                return("Added");
            }
            catch
            {
                return("Not Added");
            }
        }
        //CRUD UPDATE
        //POST an update to the db
        //error checking
        //POST: /TSTaskWorkOrder/UpdateTaskWO
        public string UpdateTaskWO(TSTaskWorkOrderModel tsTaskWorkOrder)
        {
            try
            {
                //create a new TaskWO-type object called oTaskWO
                TaskWO oTaskWO = new TaskWO();
                //populate the DAL-object with the MVC object data

                //populate the DAL-object with the MVC object data
                oTaskWO.Task_WO_ID      = tsTaskWorkOrder.Task_WO_ID;
                oTaskWO.TaskType        = tsTaskWorkOrder.TaskType;
                oTaskWO.ExpenseType     = tsTaskWorkOrder.ExpenseType;
                oTaskWO.TaskDescription = tsTaskWorkOrder.TaskDescription;
                oTaskWO.TaskPurpose     = tsTaskWorkOrder.TaskPurpose;
                oTaskWO.Active          = tsTaskWorkOrder.Active;

                //connect via interface to DAL App, and insert the object
                itsApp.UpdateTaskWO(oTaskWO);
                return("Updated");
            }
            catch
            {
                return("Not Updated");
            }
        }
 //gets/reads tasks/work order by their id, used for tables
 //POST and GET: /TSTaskWorkOrder/GetTaskWOByTaskID
 public ActionResult GetTaskWOByTaskID(TSTaskWorkOrderModel tsTaskWorkOrder)
 {
     //error handling
     try
     {
         //gets entries as Dataview
         //stores the first table
         TaskWOByTaskID = itsApp.GetTaskWOByTaskID(tsTaskWorkOrder.Task_WO_ID).Tables[0].DefaultView;
         //serializes/converts the DataView to JSON
         JavaScriptSerializer jsSerializer             = new JavaScriptSerializer();
         List <Dictionary <string, object> > parentRow = new List <Dictionary <string, object> >();
         Dictionary <string, object>         childRow;
         foreach (DataRow row in TaskWOByTaskID.Table.Rows)
         {
             childRow = new Dictionary <string, object>();
             foreach (DataColumn col in TaskWOByTaskID.Table.Columns)
             {
                 childRow.Add(col.ColumnName, row[col]);
             }
             parentRow.Add(childRow);
         }
         string JsSerializer = JsonConvert.SerializeObject(parentRow);
         return(Json(JsSerializer, JsonRequestBehavior.AllowGet));
     }
     //error handling, else it returns no value/null to the AngularJS method,
     //The AngularJS method then finishes off the error handling,
     //and gives the user either the data or an error message.
     catch
     {
         return(null);
     }
 }
        //CRUD DELETE
        //POST a deletion to the db
        //error checking
        //POST: /TSTaskWorkOrder/DeleteTaskWO
        public string DeleteTaskWO(TSTaskWorkOrderModel tsTaskWorkOrder)
        {
            try
            {
                //create a new TaskWO-type object called oTaskWO
                TaskWO oTaskWO = new TaskWO();

                //populate the DAL-object with the MVC object data
                oTaskWO.Task_WO_ID      = tsTaskWorkOrder.Task_WO_ID;
                oTaskWO.TaskType        = tsTaskWorkOrder.TaskType;
                oTaskWO.ExpenseType     = tsTaskWorkOrder.ExpenseType;
                oTaskWO.TaskDescription = tsTaskWorkOrder.TaskDescription;
                oTaskWO.TaskPurpose     = tsTaskWorkOrder.TaskPurpose;
                oTaskWO.Active          = tsTaskWorkOrder.Active;

                //connect via interface to DAL App, and delete the object. The DAL parses out just the equipment number, deleting the object with that number
                itsApp.DeleteTaskWO(oTaskWO);
                return("Deleted");
            }
            catch
            {
                return("Not Deleted");
            }
        }