public static void SaveShiftMap(int varEmployeeID, ShiftCollection items) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM EmployeeDepartmentHistory WHERE EmployeeID=@EmployeeID", Employee.Schema.Provider.Name); cmdDel.AddParameter("@EmployeeID", varEmployeeID); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (Shift item in items) { EmployeeDepartmentHistory varEmployeeDepartmentHistory = new EmployeeDepartmentHistory(); varEmployeeDepartmentHistory.SetColumnValue("EmployeeID", varEmployeeID); varEmployeeDepartmentHistory.SetColumnValue("ShiftID", item.GetPrimaryKeyValue()); varEmployeeDepartmentHistory.Save(); } }
public ShiftCollection FetchByID(object ShiftID) { ShiftCollection coll = new ShiftCollection().Where("ShiftID", ShiftID).Load(); return(coll); }