//CRUD UPDATE
 //POST an update to the db
 //error checking
 public string UpdateTSEntry(TSEntryModel tsEntry)
 {
     if (tsEntry != null)
     {
         //create a new oTSEntry object
         TimeSheetEntry oTSEntry = new TimeSheetEntry();
         //populate the object with the object data from tsEntry
         oTSEntry.TSEntryID             = tsEntry.TSEntryID;
         oTSEntry.EntryDate             = tsEntry.Date;
         oTSEntry.EmployeeID            = tsEntry.EmployeeID;
         oTSEntry.ProdZoneID            = tsEntry.ProdZoneID;
         oTSEntry.StartTime             = tsEntry.StartTime;
         oTSEntry.EndTime               = tsEntry.EndTime;
         oTSEntry.EquipmentMeterReading = tsEntry.EquipmentMeterReading;
         oTSEntry.EquipmentNumber       = tsEntry.EquipmentNumber;
         oTSEntry.ImplementNumber       = tsEntry.ImplementNumber;
         oTSEntry.TaskWOID              = tsEntry.Task_WO_ID;
         oTSEntry.FieldNumber           = tsEntry.FieldNumber;
         //connect via interface to DAL App, and update the ts entry as an object
         itsApp.UpdateTSEntry(oTSEntry);
         return("Entry Updated Successfully");
     }
     else
     {
         return("Entry Not Updated! Try Again");
     }
 }
 //CRUD DELETE
 //POST a deletion to the db
 //error checking
 public string DeleteTSEntry(TSEntryModel tsEntry)
 {
     if (tsEntry != null)
     {
         //create a new oTSEntry object
         TimeSheetEntry oTSEntry = new TimeSheetEntry();
         //populate the object with the object data from tsEntry
         oTSEntry.TSEntryID             = tsEntry.TSEntryID;
         oTSEntry.EntryDate             = tsEntry.Date;
         oTSEntry.EmployeeID            = tsEntry.EmployeeID;
         oTSEntry.ProdZoneID            = tsEntry.ProdZoneID;
         oTSEntry.StartTime             = tsEntry.StartTime;
         oTSEntry.EndTime               = tsEntry.EndTime;
         oTSEntry.EquipmentMeterReading = tsEntry.EquipmentMeterReading;
         oTSEntry.EquipmentNumber       = tsEntry.EquipmentNumber;
         oTSEntry.ImplementNumber       = tsEntry.ImplementNumber;
         oTSEntry.TaskWOID              = tsEntry.Task_WO_ID;
         oTSEntry.FieldNumber           = tsEntry.FieldNumber;
         //connect via interface to DAL App, and delete the ts entry as an object. The DAL parses out just the tsEntry.TSEntryID, and removed the entry by it's particular id/insertion order
         itsApp.DeleteTSEntry(oTSEntry);
         return("Entry Deleted Successfully");
     }
     else
     {
         return("Entry Not Deleted! Try Again");
     }
 }
        //gets/reads all an employees timesheet entries by their date
        public ActionResult GetTimeSheetEntriesByDate(TSEntryModel tsEntry)
        {
            //gets entries as Dataview
            itsApp.GetTimeSheetEntriesByDate(tsEntry.Date);
            EntriesByDate = itsApp.dvTimeSheetEntriesByDate();

            //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 EntriesByDate.Table.Rows)
            {
                childRow = new Dictionary <string, object>();
                foreach (DataColumn col in EntriesByDate.Table.Columns)
                {
                    childRow.Add(col.ColumnName, row[col]);
                }
                parentRow.Add(childRow);
            }

            string JsSerializer = JsonConvert.SerializeObject(parentRow);

            return(Json(JsSerializer, JsonRequestBehavior.AllowGet));
        }