/// <summary> /// Deprecated Method for adding a new object to the EmpTests EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToEmpTests(EmpTest empTest) { base.AddObject("EmpTests", empTest); }
/// <summary> /// create a lab test /// </summary> /// <param name="day"></param> /// <param name="test"></param> /// <param name="timesheet"></param> /// <param name="manager"></param> public void createLabTest(string day, string density, string lab, int timesheet, bool manager, ref decimal totalLab) { using (var context = new PetoEntities()) { try { if (manager) { ManagerTest t = new ManagerTest(); t.Day = day; if (density != string.Empty) { t.DensityTest = Convert.ToInt32(density); } if (lab != string.Empty) { t.LabTest = Convert.ToDecimal(lab); totalLab += t.LabTest.Value; } t.TimeSheetId = timesheet; if (lab != string.Empty || density != string.Empty) { context.ManagerTests.AddObject(t); context.SaveChanges(); } } else { EmpTest t = new EmpTest(); t.Day = day; if (density != string.Empty) { t.DensityTest = Convert.ToInt32(density); } if (lab != string.Empty) { t.LabTest = Convert.ToDecimal(lab); totalLab += t.LabTest.Value; } t.TimeSheetId = timesheet; if (lab != string.Empty || density != string.Empty) { context.EmpTests.AddObject(t); context.SaveChanges(); } } } catch (Exception) { throw; } } }
/// <summary> /// Create a new EmpTest object. /// </summary> /// <param name="testId">Initial value of the TestId property.</param> /// <param name="day">Initial value of the Day property.</param> /// <param name="timeSheetId">Initial value of the TimeSheetId property.</param> public static EmpTest CreateEmpTest(global::System.Int32 testId, global::System.String day, global::System.Int32 timeSheetId) { EmpTest empTest = new EmpTest(); empTest.TestId = testId; empTest.Day = day; empTest.TimeSheetId = timeSheetId; return empTest; }
/// <summary> /// copy EmpTests to ManagerTests /// </summary> /// <param name="emps"></param> public void copyToManagerTest(EmpTest item) { using (var context = new PetoEntities()) { try { ManagerTest m = new ManagerTest(); m.TimeSheetId = item.TimeSheetId; if (item.LabTest.HasValue) { m.LabTest = item.LabTest; } if (item.DensityTest.HasValue) { m.DensityTest = item.DensityTest; } m.Day = item.Day; context.ManagerTests.AddObject(m); context.SaveChanges(); } catch (Exception) { throw; } } }