Exemple #1
0
        public void Insert_ValidationShiftAndShiftPair()
        {
            shift_testObject              = new Shift();
            shift_testObject.Name         = "ShiftTest2";
            shift_testObject.Color        = "5";
            shift_testObject.CustomCode   = "0-01";
            shift_testObject.MinNobatKari = 2;
            shift_testObject.ShiftType    = ShiftTypesEnum.WORK;

            businessShift.SaveChanges(shift_testObject, UIActionType.ADD);

            shiftpair_testObject.FromTime = "10:00";
            shiftpair_testObject.ToTime   = "20:00";
            shiftpair_testObject.ShiftId  = shift_testObject.ID;
            businessShift.SaveChangesShiftPair(shiftpair_testObject, UIActionType.ADD);

            decimal id = shift_testObject.ID;

            shift_testObject = new Shift();
            ClearSession();
            shift_testObject = businessShift.GetByID(id);
            Assert.AreEqual(shift_testObject.Pairs.Count, 1);
        }
        public void TestSetup()
        {
            #region precards

            DatasetGatewayWorkFlow.TA_PrecardGroupsDataTable precardTable = new DatasetGatewayWorkFlow.TA_PrecardGroupsDataTable();
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.overwork.ToString());
            ADOPrecardGroup1.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup1.Name = "OwerWork";


            precardTA.Insert("TestPrecard1", true, ADOPrecardGroup1.ID, true, false, true, "99999999", false);

            DatasetGatewayWorkFlow.TA_PrecardDataTable pTable = new DatasetGatewayWorkFlow.TA_PrecardDataTable();
            pTable = precardTA.GetDataByName("TestPrecard1");
            ADOPrecardOverTime1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardOverTime1.Name = "TestPrecard1";

            pTable = precardTA.GetDataByCode(126.ToString());
            ADOPrecardDasturyOverTime.ID = Convert.ToInt32(pTable.Rows[0][0]);
            #endregion

            requestTA.Insert(ADOPrecardOverTime1.ID, ADOPerson1.ID, new DateTime(2010, 5, 1), new DateTime(2010, 5, 1), 420, 600, "", DateTime.Now, ADOUser1.ID);

            DatasetGatewayWorkFlow.TA_RequestDataTable requestTable = new DatasetGatewayWorkFlow.TA_RequestDataTable();
            requestTable           = requestTA.GetDataByPersonId(ADOPerson1.ID);
            ADORequestOvertime1.ID = Convert.ToInt32(requestTable.Rows[0][0]);


            #region Manager Flow

            managerTA.Insert(ADOPerson1.ID, null);

            DatasetGatewayWorkFlow.TA_ManagerDataTable managetTable = new DatasetGatewayWorkFlow.TA_ManagerDataTable();
            managerTA.FillByPersonID(managetTable, ADOPerson1.ID);
            ADOManager1.ID     = Convert.ToInt32(managetTable.Rows[0]["MasterMng_ID"]);
            ADOManager1.Person = ADOPerson1;

            accessGroupTA.Insert("AccessGroup1_2");
            DatasetGatewayWorkFlow.TA_PrecardAccessGroupDataTable accessTable = accessGroupTA.GetDataBy1("AccessGroup1_2");
            ADOAccessGroup1.ID   = Convert.ToInt32(accessTable.Rows[0][0]);
            ADOAccessGroup1.Name = "AccessGroup1_2";

            flowTA.Insert(ADOAccessGroup1.ID, false, false, "FlowTest");
            DatasetGatewayWorkFlow.TA_FlowDataTable mangTAble = flowTA.GetDataByName("FlowTest");
            ADOFlow1.ID         = Convert.ToInt32(mangTAble.Rows[0][0]);
            ADOFlow1.FlowName   = "FlowTest";
            ADOFlow1.ActiveFlow = false;
            ADOFlow1.WorkFlow   = false;

            mangFlowTA.Insert(ADOManager1.ID, 1, ADOFlow1.ID, true);

            DatasetGatewayWorkFlow.TA_ManagerFlowDataTable nbgFlowTable = mangFlowTA.GetDataByFlowID(ADOFlow1.ID);
            ADOManagerFlow1.ID    = Convert.ToInt32(nbgFlowTable.Rows[0]["mngrFlow_ID"]);
            ADOManagerFlow1.Level = Convert.ToInt32(nbgFlowTable.Rows[0]["mngrFlow_LEVEL"]);

            #endregion

            requestStatusTA.Insert(ADOManagerFlow1.ID, ADORequestOvertime1.ID, true, false, "", DateTime.Now, false);

            request_testObject = new Request();
            busOverTime        = new BRequest(ADOPerson1.ID);

            #region insert workgroup,shift
            BWorkgroup bworkGroup = new BWorkgroup();
            ADOWorkGroup.CustomCode = "55-55";
            ADOWorkGroup.Name       = "ClanderWorkGroupTest";
            bworkGroup.SaveChanges(ADOWorkGroup, UIActionType.ADD);

            assingWorkGrouTA.Insert(ADOWorkGroup.ID, ADOPerson1.ID, new DateTime(2000, 1, 1));

            BShift bshift = new BShift();
            ADOShift1.Name       = "ClanderShiftTest1";
            ADOShift1.Person     = ADOPerson1;
            ADOShift1.Color      = "0xff6512";
            ADOShift1.ShiftType  = ShiftTypesEnum.WORK;
            ADOShift1.CustomCode = "55-54";
            bshift.SaveChanges(ADOShift1, UIActionType.ADD);
            ShiftPair pair1 = new ShiftPair(100, 200)
            {
                ShiftId = ADOShift1.ID
            };
            ShiftPair pair2 = new ShiftPair(200, 400)
            {
                ShiftId = ADOShift1.ID
            };
            bshift.SaveChangesShiftPair(pair1, UIActionType.ADD);
            bshift.SaveChangesShiftPair(pair2, UIActionType.ADD);

            ADOShift2.Name       = "ClanderShiftTest2";
            ADOShift2.Color      = "0xbbccaa";
            ADOShift2.Person     = ADOPerson1;
            ADOShift2.ShiftType  = ShiftTypesEnum.WORK;
            ADOShift2.CustomCode = "55-55";
            bshift.SaveChanges(ADOShift2, UIActionType.ADD);
            #endregion

            #region date inti
            date1 = Utility.ToMildiDate("1390/5/1");
            date2 = Utility.ToMildiDate("1390/5/2");
            date3 = Utility.ToMildiDate("1390/5/3");
            date4 = Utility.ToMildiDate("1390/5/5");
            date5 = Utility.ToMildiDate("1390/5/6");
            date6 = Utility.ToMildiDate("1390/5/7");
            date7 = Utility.ToMildiDate("1390/5/9");

            #endregion

            #region WorkGroup Detail
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date1);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date2);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date3);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date4);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date5);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift2.ID, date6);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift2.ID, date7);
            #endregion

            ClearSession();
        }