public void TestSetup()
        {
            dutyPlace_testObject = new DutyPlace();
            busDutyPlace         = new BDutyPlace();

            DatabaseGateway.TA_DutyPlaceDataTable dutyTable = dutyPlaceTA.GetRoot();
            DatabaseGateway.TA_DutyPlaceRow       dutyPlaceRow;
            if (dutyTable.Rows.Count == 0)
            {
                dutyPlaceTA.Insert("TestDutyPlaceRoot", "0-00Test", 0);
                dutyTable = dutyPlaceTA.GetRoot();
            }
            dutyPlaceRow                = dutyTable.Rows[0] as DatabaseGateway.TA_DutyPlaceRow;
            ADODutyPlaceRoot.ID         = dutyPlaceRow.dutyPlc_ID;
            ADODutyPlaceRoot.CustomCode = dutyPlaceRow.dutyPlc_CustomCode;
            ADODutyPlaceRoot.Name       = dutyPlaceRow.dutyPlc_Name;
            ADODutyPlaceRoot.ParentID   = 0;

            dutyPlaceTA.Insert("TestDutyPlace1", "0-00Test1", ADODutyPlaceRoot.ID);
            dutyTable                = dutyPlaceTA.GetDataByCustomCode("0-00Test1");
            dutyPlaceRow             = dutyTable.Rows[0] as DatabaseGateway.TA_DutyPlaceRow;
            ADODutyPlace1.ID         = dutyPlaceRow.dutyPlc_ID;
            ADODutyPlace1.Name       = dutyPlaceRow.dutyPlc_Name;
            ADODutyPlace1.CustomCode = dutyPlaceRow.dutyPlc_CustomCode;
            ADODutyPlace1.ParentID   = dutyPlaceRow.dutyPlc_ParentID;

            dutyPlaceTA.Insert("TestDutyPlace2", "0-00Test2", ADODutyPlaceRoot.ID);
            dutyTable                = dutyPlaceTA.GetDataByCustomCode("0-00Test2");
            dutyPlaceRow             = dutyTable.Rows[0] as DatabaseGateway.TA_DutyPlaceRow;
            ADODutyPlace2.ID         = dutyPlaceRow.dutyPlc_ID;
            ADODutyPlace2.Name       = dutyPlaceRow.dutyPlc_Name;
            ADODutyPlace2.CustomCode = dutyPlaceRow.dutyPlc_CustomCode;
            ADODutyPlace2.ParentID   = dutyPlaceRow.dutyPlc_ParentID;

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

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

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

            requestTA.Insert(ADOPrecar1.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);
            ADORequest1.ID = Convert.ToInt32(requestTable.Rows[0][0]);

            requestDetailTA.Insert(ADORequest1.ID, null, null, ADODutyPlace2.ID);
        }
Example #2
0
        public void TestSetup()
        {
            #region precards

            DatasetGatewayWorkFlow.TA_PrecardGroupsDataTable precardTable = new DatasetGatewayWorkFlow.TA_PrecardGroupsDataTable();
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.leave.ToString());
            ADOPrecardGroup1.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup1.Name = "HourlyLeave";
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.duty.ToString());
            ADOPrecardGroup2.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup2.Name = "HourlyDuty";
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.leaveestelajy.ToString());
            ADOPrecardGroup3.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup3.Name = "Estelaji";
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.traffic.ToString());
            ADOPrecardGroup4.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup4.Name = "Traffic";
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.overwork.ToString());
            ADOPrecardGroup5.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup5.Name = "OwerWork";


            precardTA.Insert("TestPrecard1", true, ADOPrecardGroup1.ID, true, false, true, "99999999", false);
            precardTA.Insert("TestPrecard4", true, ADOPrecardGroup1.ID, false, true, true, "99999999", false);
            precardTA.Insert("TestPrecard6", true, ADOPrecardGroup1.ID, false, true, true, "99999999", false);
            precardTA.Insert("TestPrecard7", true, ADOPrecardGroup2.ID, false, true, true, "99999999", false);
            precardTA.Insert("TestPrecard2", true, ADOPrecardGroup2.ID, true, false, true, "99999999", false);
            precardTA.Insert("TestPrecard3", true, ADOPrecardGroup3.ID, true, false, true, "99999999", false);
            precardTA.Insert("TestPrecard5", true, ADOPrecardGroup4.ID, true, false, true, "99999999", false);
            precardTA.Insert("TestPrecard8", true, ADOPrecardGroup5.ID, true, false, true, "99999999", false);

            DatasetGatewayWorkFlow.TA_PrecardDataTable pTable = new DatasetGatewayWorkFlow.TA_PrecardDataTable();
            pTable = precardTA.GetDataByName("TestPrecard1");
            ADOPrecardHourlyLeave1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardHourlyLeave1.Name = "TestPrecard1";
            pTable = precardTA.GetDataByName("TestPrecard2");
            ADOPrecardHourlyDuty1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardHourlyDuty1.Name = "TestPrecard2";
            pTable = precardTA.GetDataByName("TestPrecard3");
            ADOPrecardHourlyEstelji1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardHourlyEstelji1.Name = "TestPrecard3";
            pTable = precardTA.GetDataByName("TestPrecard4");
            ADOPrecardHourlyLeave2.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardHourlyLeave2.Name = "TestPrecard4";
            pTable = precardTA.GetDataByName("TestPrecard5");
            ADOPrecardTraffic1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardTraffic1.Name = "TestPrecard6";
            pTable = precardTA.GetDataByName("TestPrecard6");
            ADOPrecardDailyLeave1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardDailyLeave1.Name = "TestPrecard7";
            pTable = precardTA.GetDataByName("TestPrecard7");
            ADOPrecardDailyDuty1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardDailyDuty1.Name = "TestPrecard7";
            pTable = precardTA.GetDataByName("TestPrecard8");
            ADOPrecardOverTime1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardOverTime1.Name = "TestPrecard8";
            #endregion

            requestTA.Insert(ADOPrecardHourlyLeave1.ID, ADOPerson1.ID, new DateTime(2010, 5, 1), new DateTime(2010, 5, 1), 420, 600, "", DateTime.Now, ADOUser1.ID);
            requestTA.Insert(ADOPrecardHourlyLeave1.ID, ADOPerson1.ID, new DateTime(2010, 5, 1), new DateTime(2010, 5, 1), 900, 1020, "", DateTime.Now, ADOUser1.ID);
            requestTA.Insert(ADOPrecardTraffic1.ID, ADOPerson1.ID, new DateTime(2010, 5, 1), new DateTime(2010, 5, 1), 900, 1020, "", DateTime.Now, ADOUser1.ID);
            requestTA.Insert(ADOPrecardDailyLeave1.ID, ADOPerson1.ID, new DateTime(2010, 5, 2), new DateTime(2010, 5, 6), 0, 0, "", DateTime.Now, ADOUser1.ID);
            requestTA.Insert(ADOPrecardDailyDuty1.ID, ADOPerson1.ID, new DateTime(2010, 5, 7), new DateTime(2010, 5, 7), 0, 0, "", DateTime.Now, ADOUser1.ID);

            requestTA.Insert(ADOPrecardHourlyLeave1.ID, ADOPerson5.ID, new DateTime(2010, 5, 7), new DateTime(2010, 5, 7), 420, 600, "", DateTime.Now, ADOUser1.ID);
            requestTA.Insert(ADOPrecardHourlyLeave1.ID, ADOPerson5.ID, new DateTime(2010, 5, 7), new DateTime(2010, 5, 7), 800, 900, "", DateTime.Now, ADOUser1.ID);
            requestTA.Insert(ADOPrecardHourlyDuty1.ID, ADOPerson5.ID, new DateTime(2010, 5, 8), new DateTime(2010, 5, 8), 100, 300, "", DateTime.Now, ADOUser1.ID);

            DatasetGatewayWorkFlow.TA_RequestDataTable requestTable = new DatasetGatewayWorkFlow.TA_RequestDataTable();
            requestTable = requestTA.GetDataByPersonId(ADOPerson1.ID);
            ADORequestHourlyLeave1.ID = Convert.ToInt32(requestTable.Rows[0][0]);
            ADORequestHourlyLeave2.ID = Convert.ToInt32(requestTable.Rows[1][0]);
            ADORequestTraffic1.ID     = Convert.ToInt32(requestTable.Rows[2][0]);
            ADORequestDailyLeave1.ID  = Convert.ToInt32(requestTable.Rows[3][0]);
            ADORequestDailyDuty1.ID   = Convert.ToInt32(requestTable.Rows[4][0]);

            requestTable = requestTA.GetDataByPersonId(ADOPerson5.ID);

            ADORequestLeavePerson2_1.ID = Convert.ToInt32(requestTable.Rows[0][0]);
            ADORequestLeavePerson2_2.ID = Convert.ToInt32(requestTable.Rows[1][0]);
            ADORequestDutyPerson2_1.ID  = Convert.ToInt32(requestTable.Rows[2][0]);

            #region Base Information
            doctorTA.Insert("TestDoctor1", "TestDoctorLastName1", "", "", "");
            illnessTA.Insert("TestIllness1", "");
            dutyPlcTA.Insert("TestDutyPlc1", "0-0", 0);


            DatasetGatewayWorkFlow.TA_DoctorDataTable    doctorTable    = doctorTA.GetDataByName("TestDoctorLastName1");
            DatasetGatewayWorkFlow.TA_IllnessDataTable   illnessTable   = illnessTA.GetDataByName("TestIllness1");
            DatasetGatewayWorkFlow.TA_DutyPlaceDataTable dutyPlaceTable = dutyPlcTA.GetDataByName("TestDutyPlc1");

            ADODoctor1.ID        = Convert.ToInt32(doctorTable.Rows[0][0]);
            ADODoctor1.FirstName = "TestDoctor1";
            ADODoctor1.LastName  = "TestDoctorLastName1";
            ADOIllness1.ID       = Convert.ToInt32(illnessTable.Rows[0][0]);
            ADOIllness1.Name     = "TestIllness1";
            ADODuty1.ID          = Convert.ToInt32(dutyPlaceTable.Rows[0][0]);
            ADODuty1.Name        = "TestDutyPlc1";

            dutyPlcTA.Insert("TestDutyPlc2", "0-0", ADODuty1.ID);
            dutyPlaceTable = dutyPlcTA.GetDataByName("TestDutyPlc2");
            ADODuty2.ID    = Convert.ToInt32(dutyPlaceTable.Rows[0][0]);
            ADODuty2.Name  = "TestDutyPlc2";


            #endregion

            #region Manager Flow

            #region MAnager

            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;

            managerTA.Insert(ADOPerson3.ID, null);

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

            managerTA.Insert(ADOPerson4.ID, null);

            managetTable = new DatasetGatewayWorkFlow.TA_ManagerDataTable();
            managerTA.FillByPersonID(managetTable, ADOPerson4.ID);
            ADOManager3.ID     = Convert.ToInt32(managetTable.Rows[0]["MasterMng_ID"]);
            ADOManager3.Person = ADOPerson4;
            #endregion

            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, "FlowTest1");
            DatasetGatewayWorkFlow.TA_FlowDataTable mangTAble = flowTA.GetDataByName("FlowTest1");
            ADOFlow1.ID         = Convert.ToInt32(mangTAble.Rows[0][0]);
            ADOFlow1.FlowName   = "FlowTest1";
            ADOFlow1.ActiveFlow = false;
            ADOFlow1.WorkFlow   = false;

            flowTA.Insert(ADOAccessGroup1.ID, false, false, "FlowTest2");
            mangTAble           = flowTA.GetDataByName("FlowTest2");
            ADOFlow2.ID         = Convert.ToInt32(mangTAble.Rows[0][0]);
            ADOFlow2.FlowName   = "FlowTest2";
            ADOFlow2.ActiveFlow = true;
            ADOFlow2.WorkFlow   = true;

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

            mangFlowTA.Insert(ADOManager2.ID, 1, ADOFlow2.ID, true);
            mangFlowTA.Insert(ADOManager3.ID, 1, ADOFlow2.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"]);

            nbgFlowTable          = mangFlowTA.GetDataByFlowID(ADOFlow2.ID);
            ADOManagerFlow2.ID    = Convert.ToInt32(nbgFlowTable.Rows[0]["mngrFlow_ID"]);
            ADOManagerFlow2.Level = Convert.ToInt32(nbgFlowTable.Rows[0]["mngrFlow_LEVEL"]);
            ADOManagerFlow3.ID    = Convert.ToInt32(nbgFlowTable.Rows[1]["mngrFlow_ID"]);
            ADOManagerFlow3.Level = Convert.ToInt32(nbgFlowTable.Rows[1]["mngrFlow_LEVEL"]);

            #endregion

            requestStatusTA.Insert(ADOManagerFlow1.ID, ADORequestHourlyLeave1.ID, true, false, "", DateTime.Now, false);
            requestStatusTA.Insert(ADOManagerFlow1.ID, ADORequestHourlyLeave2.ID, true, true, "", DateTime.Now, false);
            requestStatusTA.Insert(ADOManagerFlow1.ID, ADORequestDailyDuty1.ID, false, true, "", DateTime.Now, false);
            requestStatusTA.Insert(ADOManagerFlow1.ID, ADORequestDailyLeave1.ID, false, false, "", DateTime.Now, false);
            requestStatusTA.Insert(ADOManagerFlow1.ID, ADORequestTraffic1.ID, true, false, "", DateTime.Now, false);

            requestStatusTA.Insert(ADOManagerFlow2.ID, ADORequestLeavePerson2_1.ID, true, false, "", DateTime.Now, false);
            requestStatusTA.Insert(ADOManagerFlow3.ID, ADORequestLeavePerson2_1.ID, true, true, "", DateTime.Now, false);
            requestStatusTA.Insert(ADOManagerFlow3.ID, ADORequestLeavePerson2_2.ID, true, false, "", DateTime.Now, false);
            requestStatusTA.Insert(ADOManagerFlow3.ID, ADORequestLeavePerson2_2.ID, false, true, "", DateTime.Now, false);
            requestStatusTA.Insert(ADOManagerFlow3.ID, ADORequestDutyPerson2_1.ID, true, false, "", DateTime.Now, false);

            request_testObject      = new Request();
            busHourlyAbsenceRequest = new BRequest(ADOPerson1.ID);
            busDailyAbsenceRequest  = new BRequest(ADOPerson1.ID);
            busTrafficRequest       = new BRequest(ADOPerson1.ID);
            busOverTime             = new BRequest(ADOPerson1.ID);
            busPersonelRequest      = new BRequest(ADOPerson1.ID);
        }
Example #3
0
        public void TestSetup()
        {
            busflow         = new BFlow();
            flow_testObject = new Flow();

            #region Flow Entry


            personTA.UpdateDepartmentId(ADODepartment1.ID, ADOPerson3.ID);
            personTA.UpdateDepartmentId(ADODepartment1.ID, ADOPerson4.ID);
            personTA.UpdateDepartmentId(ADODepartment2.ID, ADOPerson5.ID);
            personTA.UpdateDepartmentId(ADODepartment2.ID, ADOPerson6.ID);

            DatabaseGateway.TA_OrganizationUnitDataTable table = organTA.GetDataByParent();
            ADOOrganParent.ID         = Convert.ToInt32(table.Rows[0]["organ_ID"]);
            ADOOrganParent.CustomCode = Convert.ToString(table.Rows[0]["organ_CustomCode"]);

            organTA.Insert("TestLevel2_1", "0-1", ADOPerson2.ID, ADOOrganParent.ID, String.Format(",{0},", ADOOrganParent.ID));
            table               = organTA.GetDataByCustomCode("0-1");
            ADOOrgan.ID         = Convert.ToInt32(table.Rows[0]["organ_ID"]);
            ADOOrgan.ParentID   = Convert.ToInt32(table.Rows[0]["organ_ParentID"]);
            ADOOrgan.Name       = Convert.ToString(table.Rows[0]["organ_Name"]);
            ADOOrgan.CustomCode = Convert.ToString(table.Rows[0]["organ_CustomCode"]);
            ADOOrgan.PersonID   = Convert.ToInt32(table.Rows[0]["organ_PersonID"]);

            organTA.Insert("TestLevel2_2", "0-2", ADOPerson1.ID, ADOOrganParent.ID, String.Format(",{0},", ADOOrganParent.ID));
            table                = organTA.GetDataByCustomCode("0-2");
            ADOOrgan2.ID         = Convert.ToInt32(table.Rows[0]["organ_ID"]);
            ADOOrgan2.ParentID   = Convert.ToInt32(table.Rows[0]["organ_ParentID"]);
            ADOOrgan2.Name       = Convert.ToString(table.Rows[0]["organ_Name"]);
            ADOOrgan2.CustomCode = Convert.ToString(table.Rows[0]["organ_CustomCode"]);
            ADOOrgan2.PersonID   = Convert.ToInt32(table.Rows[0]["organ_PersonID"]);

            managerTA.Insert(ADOPerson1.ID, null);
            managerTA.Insert(null, ADOOrgan.ID);//ADOPerson2

            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;

            managerTA.FillByOrganID(managetTable, ADOOrgan.ID);
            ADOManager2.ID = Convert.ToInt32(managetTable.Rows[0]["MasterMng_ID"]);
            ADOManager2.OrganizationUnit = ADOOrgan;


            #region precards

            DatasetGatewayWorkFlow.TA_PrecardGroupsDataTable precardTable = new DatasetGatewayWorkFlow.TA_PrecardGroupsDataTable();
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.leave.ToString());
            ADOPrecardGroup1.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup1.Name = "HourlyLeave";
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.duty.ToString());
            ADOPrecardGroup2.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup2.Name = "HourlyDuty";
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.leaveestelajy.ToString());
            ADOPrecardGroup3.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup3.Name = "Estelaji";
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.traffic.ToString());
            ADOPrecardGroup4.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup4.Name = "Traffic";
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.overwork.ToString());
            ADOPrecardGroup5.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup5.Name = "OwerWork";


            precardTA.Insert("TestPrecard1", true, ADOPrecardGroup1.ID, true, false, true, "99999999", false);
            precardTA.Insert("TestPrecard4", true, ADOPrecardGroup1.ID, false, true, true, "99999999", false);
            precardTA.Insert("TestPrecard6", true, ADOPrecardGroup1.ID, false, true, true, "99999999", false);
            precardTA.Insert("TestPrecard7", true, ADOPrecardGroup2.ID, false, true, true, "99999999", false);
            precardTA.Insert("TestPrecard2", true, ADOPrecardGroup2.ID, true, false, true, "99999999", false);
            precardTA.Insert("TestPrecard3", true, ADOPrecardGroup3.ID, true, false, true, "99999999", false);
            precardTA.Insert("TestPrecard5", true, ADOPrecardGroup4.ID, true, false, true, "99999999", false);
            precardTA.Insert("TestPrecard8", true, ADOPrecardGroup5.ID, true, false, true, "99999999", false);

            DatasetGatewayWorkFlow.TA_PrecardDataTable pTable = new DatasetGatewayWorkFlow.TA_PrecardDataTable();
            pTable = precardTA.GetDataByName("TestPrecard1");
            ADOPrecardHourlyLeave1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardHourlyLeave1.Name = "TestPrecard1";
            pTable = precardTA.GetDataByName("TestPrecard2");
            ADOPrecardHourlyDuty1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardHourlyDuty1.Name = "TestPrecard2";
            pTable = precardTA.GetDataByName("TestPrecard3");
            ADOPrecardHourlyEstelji1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardHourlyEstelji1.Name = "TestPrecard3";
            pTable = precardTA.GetDataByName("TestPrecard4");
            ADOPrecardHourlyLeave2.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardHourlyLeave2.Name = "TestPrecard4";
            pTable = precardTA.GetDataByName("TestPrecard5");
            ADOPrecardTraffic1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardTraffic1.Name = "TestPrecard6";
            pTable = precardTA.GetDataByName("TestPrecard6");
            ADOPrecardDailyLeave1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardDailyLeave1.Name = "TestPrecard7";
            pTable = precardTA.GetDataByName("TestPrecard7");
            ADOPrecardDailyDuty1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardDailyDuty1.Name = "TestPrecard7";
            pTable = precardTA.GetDataByName("TestPrecard8");
            ADOPrecardOverTime1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardOverTime1.Name = "TestPrecard8";
            #endregion

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

            accessGroupDtlTA.Insert(ADOAccessGroup1.ID, ADOPrecardHourlyDuty1.ID);
            accessGroupDtlTA.Insert(ADOAccessGroup1.ID, ADOPrecardHourlyLeave1.ID);
            accessGroupDtlTA.Insert(ADOAccessGroup1.ID, ADOPrecardHourlyLeave2.ID);
            accessGroupDtlTA.Insert(ADOAccessGroup2.ID, ADOPrecardDailyLeave1.ID);
            accessGroupDtlTA.Insert(ADOAccessGroup2.ID, ADOPrecardDailyDuty1.ID);

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

            mangTAble           = flowTA.GetDataByName("FlowTest2");
            ADOFlow2.ID         = Convert.ToInt32(mangTAble.Rows[0][0]);
            ADOFlow2.FlowName   = "FlowTest2";
            ADOFlow2.ActiveFlow = false;
            ADOFlow2.WorkFlow   = false;

            mangFlowTA.Insert(ADOManager1.ID, 1, ADOFlow1.ID, true); //مدیر اولیه
            mangFlowTA.Insert(ADOManager2.ID, 2, ADOFlow1.ID, true); //مدیر ثانویه
            mangFlowTA.Insert(ADOManager1.ID, 1, ADOFlow2.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"]);

            ADOManagerFlow2.ID    = Convert.ToInt32(nbgFlowTable.Rows[1]["mngrFlow_ID"]);
            ADOManagerFlow2.Level = Convert.ToInt32(nbgFlowTable.Rows[1]["mngrFlow_LEVEL"]);

            nbgFlowTable          = mangFlowTA.GetDataByFlowID(ADOFlow2.ID);
            ADOManagerFlow3.ID    = Convert.ToInt32(nbgFlowTable.Rows[0]["mngrFlow_ID"]);
            ADOManagerFlow3.Level = Convert.ToInt32(nbgFlowTable.Rows[0]["mngrFlow_LEVEL"]);

            undermanagmentTA.Insert(ADOFlow1.ID, ADOPerson3.ID, ADODepartment1.ID, false, true);
            undermanagmentTA.Insert(ADOFlow1.ID, ADOPerson4.ID, ADODepartment1.ID, false, false);

            undermanagmentTA.Insert(ADOFlow2.ID, null, ADODepartment2.ID, true, true);//ADOPerson4,ADOPerson5
            #endregion

            #region Request Entry

            requestTA.Insert(ADOPrecardHourlyLeave1.ID, ADOPerson3.ID, new DateTime(2010, 5, 1), new DateTime(2010, 5, 1), 420, 600, "", DateTime.Now, ADOUser1.ID);
            requestTA.Insert(ADOPrecardHourlyLeave1.ID, ADOPerson3.ID, new DateTime(2010, 5, 2), new DateTime(2010, 5, 2), 900, 1020, "", DateTime.Now, ADOUser1.ID);
            requestTA.Insert(ADOPrecardHourlyDuty1.ID, ADOPerson3.ID, new DateTime(2010, 5, 2), new DateTime(2010, 5, 2), 700, 800, "", DateTime.Now, ADOUser1.ID);
            requestTA.Insert(ADOPrecardTraffic1.ID, ADOPerson4.ID, new DateTime(2010, 5, 3), new DateTime(2010, 5, 3), 900, 1020, "", DateTime.Now, ADOUser1.ID);
            requestTA.Insert(ADOPrecardHourlyDuty1.ID, ADOPerson3.ID, new DateTime(2010, 5, 10), new DateTime(2010, 5, 10), 700, 800, "", DateTime.Now, ADOUser1.ID);
            requestTA.Insert(ADOPrecardHourlyDuty1.ID, ADOPerson3.ID, new DateTime(2010, 5, 10), new DateTime(2010, 5, 10), 1000, 1100, "", DateTime.Now, ADOUser1.ID);


            requestTA.Insert(ADOPrecardDailyLeave1.ID, ADOPerson5.ID, new DateTime(2010, 5, 4), new DateTime(2010, 5, 5), 0, 0, "", DateTime.Now, ADOUser1.ID);
            requestTA.Insert(ADOPrecardDailyDuty1.ID, ADOPerson6.ID, new DateTime(2010, 5, 6), new DateTime(2010, 5, 7), 0, 0, "", DateTime.Now, ADOUser1.ID);


            DatasetGatewayWorkFlow.TA_RequestDataTable requestTable = new DatasetGatewayWorkFlow.TA_RequestDataTable();
            requestTable = requestTA.GetDataByPersonId(ADOPerson3.ID);
            ADORequestHourlyLeave1.ID      = Convert.ToInt32(requestTable.Rows[0][0]);
            ADORequestHourlyLeave2.ID      = Convert.ToInt32(requestTable.Rows[1][0]);
            ADORequestHourlyDuty1.ID       = Convert.ToInt32(requestTable.Rows[2][0]);
            ADORequestHourlyDuty2.ID       = Convert.ToInt32(requestTable.Rows[3][0]);
            ADORequestHourlyDuty2.FromDate = Convert.ToDateTime(requestTable.Rows[3]["request_fromdate"]);
            ADORequestHourlyDuty3.ID       = Convert.ToInt32(requestTable.Rows[4][0]);
            requestTable                   = requestTA.GetDataByPersonId(ADOPerson4.ID);
            ADORequestTraffic1.ID          = Convert.ToInt32(requestTable.Rows[0][0]);
            requestTable                   = requestTA.GetDataByPersonId(ADOPerson5.ID);
            ADORequestDailyLeave1.ID       = Convert.ToInt32(requestTable.Rows[0][0]);
            ADORequestDailyLeave1.FromDate = Convert.ToDateTime(requestTable.Rows[0]["request_fromdate"]);
            requestTable                   = requestTA.GetDataByPersonId(ADOPerson6.ID);
            ADORequestDailyDuty1.ID        = Convert.ToInt32(requestTable.Rows[0][0]);

            #region Request Status
            requestStatusTA.Insert(ADOManagerFlow1.ID, ADORequestHourlyDuty1.ID, false, true, "", DateTime.Now, false);

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

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

            requestStatusTA.Insert(ADOManagerFlow3.ID, ADORequestDailyDuty1.ID, true, true, "", DateTime.Now, false);

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

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

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

            #endregion

            #endregion
        }
        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();
        }