Beispiel #1
0
        public void Insert_TrafficRequestEmptyPrecardTest()
        {
            try
            {
                busTrafficRequest = new BRequest(ADOPerson2.ID);
                request_testObject.TheFromDate = Utility.ToString(new DateTime(2010, 5, 12));
                request_testObject.TheToDate   = Utility.ToString(new DateTime(2010, 5, 12));
                request_testObject.TheFromTime = "08:00";
                request_testObject.TheToTime   = "10:00";
                request_testObject.Precard     = new Precard()
                {
                    ID = -1
                };

                busTrafficRequest.InsertRequest(request_testObject);
                ClearSession();

                request_testObject = new BRequest().GetByID(request_testObject.ID);
                Assert.AreEqual("0", request_testObject.Precard.Code);
                Assert.IsTrue(request_testObject.User.ID > 0);

                busTrafficRequest.DeleteRequest(request_testObject);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Beispiel #2
0
        public void GetAllTrafficDetai_Test_Dependent()
        {
            busTrafficRequest = new BRequest();
            IList <MonthlyDetailReportProxy> list = busTrafficRequest.GetAllTrafic("2011/8/25");

            Assert.IsNotNull(list);
        }
Beispiel #3
0
        public void Insert_TrafficRequestEmptyFromTimeTest()
        {
            try
            {
                busTrafficRequest = new BRequest(ADOPerson2.ID);
                request_testObject.TheFromDate = Utility.ToString(new DateTime(2010, 5, 12));
                request_testObject.TheToDate   = Utility.ToString(new DateTime(2010, 5, 12));
                request_testObject.TheFromTime = "";
                request_testObject.TheToTime   = "17:00";
                request_testObject.Precard     = new Precard()
                {
                    ID = ADOPrecardTraffic1.ID
                };

                busTrafficRequest.InsertRequest(request_testObject);
                ClearSession();

                request_testObject = new BRequest().GetByID(request_testObject.ID);
                Assert.AreEqual(-1000, request_testObject.FromTime);

                busTrafficRequest.DeleteRequest(request_testObject);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Beispiel #4
0
        public void GetAllTrafficRequests_Test()
        {
            busTrafficRequest = new BRequest(ADOPerson1.ID);
            IList <Request> list = busTrafficRequest.GetAllTrafficRequests("2010/5/1");

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(1, list.Where(x => x.ID == ADORequestTraffic1.ID).Count());
        }
Beispiel #5
0
        public void Insert_TrafficRequestEmptyFromToTimeTest()
        {
            try
            {
                busTrafficRequest = new BRequest(ADOPerson2.ID);
                request_testObject.TheFromDate = Utility.ToString(new DateTime(2010, 5, 12));
                request_testObject.TheToDate   = Utility.ToString(new DateTime(2010, 5, 12));
                request_testObject.TheFromTime = "";
                request_testObject.TheToTime   = "";
                request_testObject.Precard     = new Precard()
                {
                    ID = ADOPrecardTraffic1.ID
                };

                busTrafficRequest.InsertRequest(request_testObject);
                Assert.Fail("زمان خالی است");
            }
            catch (UIValidationExceptions ex)
            {
                Assert.IsTrue(ex.Exists(ExceptionResourceKeys.RequestTimeIsNotValid));
            }
        }
Beispiel #6
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);
        }