public void TestSetup() { busSubstitute = new BSubstitute(); substitute_testObject = new Substitute(); #region Substitute substituteTA.Insert(ADOManager1.ID, ADOPerson4.ID, DateTime.Now, DateTime.Now.AddDays(1), true); DatasetGatewayWorkFlow.TA_SubstituteDataTable subTable = substituteTA.GetByManager(ADOManager1.ID, ADOPerson4.ID); ADOSubstitute1.ID = (subTable.Rows[0] as DatasetGatewayWorkFlow.TA_SubstituteRow).sub_ID; ADOSubstitute1.TheFromDate = Utility.ToPersianDate(DateTime.Now); ADOSubstitute1.TheToDate = Utility.ToPersianDate(DateTime.Now.AddDays(1)); substitutePrecardTA.Insert(ADOPrecardHourlyDuty1.ID, ADOSubstitute1.ID); substitutePrecardTA.Insert(ADOPrecardHourlyLeave1.ID, ADOSubstitute1.ID); substitutePrecardTA.Insert(ADOPrecardHourlyLeave2.ID, ADOSubstitute1.ID); substitutePrecardTA.Insert(ADOPrecardDailyLeave1.ID, ADOSubstitute1.ID); substitutePrecardTA.Insert(ADOPrecardDailyDuty1.ID, ADOSubstitute1.ID); #endregion #region Operator operatorTA.Insert(ADOPerson1.ID, true, ADOFlow1.ID, ""); operatorTA.Insert(ADOPerson2.ID, true, ADOFlow2.ID, "");//مدیر و اپراتور DatasetGatewayWorkFlow.TA_OperatorDataTable opTable = operatorTA.GetByPesonId(ADOPerson1.ID); ADOOperator1.ID = (opTable.Rows[0] as DatasetGatewayWorkFlow.TA_OperatorRow).opr_ID; opTable = operatorTA.GetByPesonId(ADOPerson2.ID); ADOOperator2.ID = (opTable.Rows[0] as DatasetGatewayWorkFlow.TA_OperatorRow).opr_ID; //operatorManagerTA.Insert(ADOManager1.ID, ADOOperator1.ID); //operatorManagerTA.Insert(ADOManager1.ID, ADOOperator2.ID); #endregion }
public void TestSetup() { busOperator = new BOperator(); operator_testObject = new Operator(); #region Operator operatorTA.Insert(ADOPerson1.ID, true, ADOFlow1.ID, ""); operatorTA.Insert(ADOPerson3.ID, true, ADOFlow2.ID, ""); DatasetGatewayWorkFlow.TA_OperatorDataTable opTable = operatorTA.GetByPesonId(ADOPerson1.ID); ADOOperator1.ID = (opTable.Rows[0] as DatasetGatewayWorkFlow.TA_OperatorRow).opr_ID; opTable = operatorTA.GetByPesonId(ADOPerson3.ID); ADOOperator2.ID = (opTable.Rows[0] as DatasetGatewayWorkFlow.TA_OperatorRow).opr_ID; #endregion }
public void TestSetup() { busRegisteredRequest = new BKartabl(ADOPerson3.ID, ADOUser3.ID, ADOUser3.UserName); 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(ADOPrecardDailyLeave1.ID, ADOPerson5.ID, new DateTime(2010, 5, 4), new DateTime(2010, 5, 5), 0, 0, "", DateTime.Now, ADOUser3.ID); requestTA.Insert(ADOPrecardDailyDuty1.ID, ADOPerson6.ID, new DateTime(2010, 5, 6), new DateTime(2010, 5, 7), 0, 0, "", DateTime.Now, ADOUser3.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]); 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, ADORequestTraffic1.ID, true, false, "", DateTime.Now); #endregion #endregion #region Operator operatorTA.Insert(ADOPerson1.ID, true, ADOFlow1.ID, ""); operatorTA.Insert(ADOPerson6.ID, true, ADOFlow2.ID, ""); DatasetGatewayWorkFlow.TA_OperatorDataTable opTable = operatorTA.GetByPesonId(ADOPerson1.ID); ADOOperator1.ID = (opTable.Rows[0] as DatasetGatewayWorkFlow.TA_OperatorRow).opr_ID; ADOOperator1.Person = ADOPerson1; opTable = operatorTA.GetByPesonId(ADOPerson6.ID); ADOOperator2.ID = (opTable.Rows[0] as DatasetGatewayWorkFlow.TA_OperatorRow).opr_ID; ADOOperator2.Person = ADOPerson6; #endregion }