internal void RemoveShiftExc(ShiftException shiftException) { string excID = shiftException.Tag.ToString(); MiscRequests.DeleteItem("Shift Exception", "Shift Exception ID", excID, true); IEnumerable <Panel> panels = stpShiftExc.Children.OfType <Panel>(); foreach (Panel p in panels) { p.Children.Remove(shiftException); } shiftException = null; }
public void Delete_Test() { try { busExceptionShift.DeleteExceptionShift(ADOExShift.ID); ClearSession(); shiftEx_testobject = busExceptionShift.GetByID(ADOExShift.ID); Assert.Fail(); } catch (ItemNotExists ex) { Assert.Pass(); } }
public void Update_Test() { shiftEx_testobject.ID = ADOExShift.ID; shiftEx_testobject.Person = new Person() { ID = ADOPerson2.ID }; shiftEx_testobject.Date = DateTime.Now; shiftEx_testobject.Shift = new Shift() { ID = ADOShift1.ID }; shiftEx_testobject.UserID = ADOUser1.ID; busExceptionShift.SaveChanges(shiftEx_testobject, UIActionType.EDIT); ClearSession(); shiftEx_testobject = busExceptionShift.GetByID(ADOExShift.ID); Assert.AreEqual(ADOPerson2.ID, shiftEx_testobject.Person.ID); }
public void TestSetup() { busExceptionShift = new BExceptionShift(); shiftEx_testobject = new ShiftException(); #region Shift shiftTA.Insert("ShiftTest1", 1, 11, null, 100, false, false, false, "2", "0-00"); shiftTA.Insert("ShiftTest2", 1, 11, null, 100, false, false, false, "2", "0-00"); ADOShift1 = new Shift(); DatabaseGateway.TA_ShiftDataTable shiftTable = new DatabaseGateway.TA_ShiftDataTable(); shiftTA.FillByName(shiftTable, "ShiftTest1"); ADOShift1.ID = Convert.ToInt32(shiftTable.Rows[0]["shift_ID"]); shiftTA.FillByName(shiftTable, "ShiftTest2"); ADOShift2.ID = Convert.ToInt32(shiftTable.Rows[0]["shift_ID"]); #endregion #region WorkGroup & WorkGroup Detail & Assignment BWorkgroup bworkGroup = new BWorkgroup(); ADOWorkGroup.CustomCode = "00-00"; ADOWorkGroup.Name = "TestWorkGroup"; bworkGroup.SaveChanges(ADOWorkGroup, UIActionType.ADD); ADOWorkGroup2.CustomCode = "00-01"; ADOWorkGroup2.Name = "TestWorkGroup2"; bworkGroup.SaveChanges(ADOWorkGroup2, UIActionType.ADD); wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, Utility.ToMildiDate("1390/10/01")); wgdTA.Insert(ADOWorkGroup.ID, ADOShift2.ID, Utility.ToMildiDate("1390/10/03")); wgdTA.Insert(ADOWorkGroup2.ID, ADOShift2.ID, Utility.ToMildiDate("1390/10/01")); asgWrgTA.Insert(ADOWorkGroup.ID, ADOPerson2.ID, Utility.ToMildiDate("1390/09/15")); asgWrgTA.Insert(ADOWorkGroup2.ID, ADOPerson1.ID, Utility.ToMildiDate("1390/09/15")); #endregion exShiftTA.Insert(ADOPerson1.ID, ADOShift1.ID, Utility.ToMildiDate("1390/10/10"), ADOUser1.ID, DateTime.Now, ""); DatabaseGateway.TA_ExceptionShiftDataTable exShiftTable = exShiftTA.GetDataByPersonId(ADOPerson1.ID); ADOExShift.ID = Convert.ToDecimal(exShiftTable.Rows[0]["ExceptionShift_ID"]); }
public void GetById_Test() { shiftEx_testobject = busExceptionShift.GetByID(ADOExShift.ID); Assert.AreEqual(ADOExShift.ID, shiftEx_testobject.ID); }