public void TestSetup() { assign_testObject = new AssignWorkGroup(); bussAssign = new BAssignWorkGroup(SysLanguageResource.Parsi); DatabaseGateway.TA_PersonDataTable personTable = personTA.GetDataByBarcode("00001"); ADOPerson1.ID = Convert.ToInt32(personTable.Rows[0]["prs_ID"]); ADOPerson1.BarCode = Convert.ToString(personTable.Rows[0]["prs_Barcode"]); workGroupTA.Insert("WorkGroup1", "0-0", null); DatabaseGateway.TA_WorkGroupDataTable workGroupTAble = new DatabaseGateway.TA_WorkGroupDataTable(); workGroupTA.FillByName(workGroupTAble, "WorkGroup1"); ADOworkGroup1.ID = Convert.ToDecimal(workGroupTAble.Rows[0]["WorkGroup_ID"]); ADOworkGroup1.Name = Convert.ToString(workGroupTAble.Rows[0]["WorkGroup_Name"]); ADOworkGroup1.CustomCode = Convert.ToString(workGroupTAble.Rows[0]["WorkGroup_CustomCode"]); assingTA.Insert(ADOworkGroup1.ID, ADOPerson1.ID, new DateTime(2010, 2, 14)); assingTA.Insert(ADOworkGroup1.ID, ADOPerson1.ID, new DateTime(2005, 5, 14)); assingTA.Insert(ADOworkGroup1.ID, ADOPerson1.ID, new DateTime(2007, 11, 5)); assingTA.Insert(ADOworkGroup1.ID, ADOPerson1.ID, new DateTime(2010, 9, 14)); assingTA.Insert(ADOworkGroup1.ID, ADOPerson1.ID, new DateTime(2012, 9, 14)); assingTA.Insert(ADOworkGroup1.ID, ADOPerson1.ID, new DateTime(2008, 3, 1)); DatabaseGateway.TA_AssignWorkGroupDataTable table = new DatabaseGateway.TA_AssignWorkGroupDataTable(); assingTA.FillByFilter(table, ADOworkGroup1.ID, ADOPerson1.ID); ADOAssign.ID = (decimal)table.Rows[0]["AsgWorkGroup_ID"]; ADOAssign.FromDate = (DateTime)table.Rows[0]["AsgWorkGroup_FromDate"]; }
public void TestSetup() { return; try { if (NeedBaseInformation || true) { #region ControlSration sataionTA.Insert("ControlStationTest1", "0-0Test"); sataionTA.Insert("ControlStationTest2", "0-1Test"); DatabaseGateway.TA_ControlStationDataTable controltable = new DatabaseGateway.TA_ControlStationDataTable(); sataionTA.FillByCustomCode(controltable, "0-0Test"); ADOStaion1.ID = Convert.ToInt32(controltable.Rows[0]["station_ID"]); ADOStaion1.Name = Convert.ToString(controltable.Rows[0]["station_Name"]); ADOStaion1.CustomCode = Convert.ToString(controltable.Rows[0]["station_CustomCode"]); sataionTA.FillByCustomCode(controltable, "0-1Test"); ADOStaion2.ID = Convert.ToInt32(controltable.Rows[0]["station_ID"]); ADOStaion2.Name = Convert.ToString(controltable.Rows[0]["station_Name"]); ADOStaion2.CustomCode = Convert.ToString(controltable.Rows[0]["station_CustomCode"]); #endregion #region EmplyeeType emplTA.Insert("EmploymentTypeTest1", "0-0Test"); emplTA.Insert("EmploymentTypeTest2", "0-1Test"); DatabaseGateway.TA_EmploymentTypeDataTable emptable = new DatabaseGateway.TA_EmploymentTypeDataTable(); emplTA.FillByCustomCode(emptable, "0-0Test"); ADOEmploymentType1.ID = Convert.ToInt32(emptable.Rows[0]["emply_ID"]); ADOEmploymentType1.Name = Convert.ToString(emptable.Rows[0]["emply_Name"]); ADOEmploymentType1.CustomCode = Convert.ToString(emptable.Rows[0]["emply_CustomCode"]); emplTA.FillByCustomCode(emptable, "0-1Test"); ADOEmploymentType2.ID = Convert.ToInt32(emptable.Rows[0]["emply_ID"]); ADOEmploymentType2.Name = Convert.ToString(emptable.Rows[0]["emply_Name"]); ADOEmploymentType2.CustomCode = Convert.ToString(emptable.Rows[0]["emply_CustomCode"]); #endregion #region Department DatabaseGateway.TA_DepartmentDataTable depTable = new DatabaseGateway.TA_DepartmentDataTable(); depTable = departmentTA.GetRoot(); if (depTable.Rows.Count == 0) { departmentTA.InsertQuery("TestLevel1", "123", 0, "", ""); depTable = departmentTA.GetRoot(); } ADORoot.ID = Convert.ToInt32(depTable.Rows[0]["dep_ID"]); ADORoot.ParentID = Utility.ToInteger(depTable.Rows[0]["dep_ParentID"]); ADORoot.Name = Convert.ToString(depTable.Rows[0]["dep_Name"]); ADORoot.CustomCode = Convert.ToString(depTable.Rows[0]["dep_CustomCode"]); departmentTA.Insert("TestLevel2_1", "1234", ADORoot.ID, "," + ADORoot.ID + ",", ""); departmentTA.Insert("TestLevel2_2", "1235", ADORoot.ID, "," + ADORoot.ID + ",", ""); departmentTA.GetByCustomCode(depTable, "1234"); ADODepartment1.ID = Convert.ToInt32(depTable.Rows[0]["dep_ID"]); ADODepartment1.ParentID = Convert.ToInt32(depTable.Rows[0]["dep_ParentID"]); ADODepartment1.Name = Convert.ToString(depTable.Rows[0]["dep_Name"]); ADODepartment1.CustomCode = Convert.ToString(depTable.Rows[0]["dep_CustomCode"]); ADODepartment1.ParentPath = Convert.ToString(depTable.Rows[0]["dep_ParentPath"]); departmentTA.GetByCustomCode(depTable, "1235"); ADODepartment2.ID = Convert.ToInt32(depTable.Rows[0]["dep_ID"]); ADODepartment2.ParentID = Convert.ToInt32(depTable.Rows[0]["dep_ParentID"]); ADODepartment2.Name = Convert.ToString(depTable.Rows[0]["dep_Name"]); ADODepartment2.CustomCode = Convert.ToString(depTable.Rows[0]["dep_CustomCode"]); #endregion #region Persons personTA.Insert("00001", 0, true, "", ADODepartment1.ID, null, null, ADOStaion1.ID, null, ADOEmploymentType1.ID, true, "لیسانس", "TestAli1", (int)MaritalStatus.Mojarad, "TestAlian1", null); personTA.Insert("00002", 0, true, "", ADODepartment2.ID, null, null, ADOStaion1.ID, null, ADOEmploymentType1.ID, true, "دیپلم", "TestAli2", (int)MaritalStatus.Motahel, "TestAlian2", null); personTA.Insert("00003", 0, true, "", ADODepartment1.ID, null, null, null, null, null, true, "", "TestAli3", 1, "TestAlian3", null); personTA.Insert("00004", 0, true, "", ADODepartment2.ID, null, null, null, null, null, true, "", "TestAli4", 1, "TestAlian4", null); personTA.Insert("00005", 0, true, "", ADODepartment2.ID, null, null, null, null, null, true, "", "TestAli5", 1, "TestAlian5", null); personTA.Insert("00006", 0, true, "", ADODepartment2.ID, null, null, null, null, null, true, "", "TestAli6", 1, "TestAlian6", null); DatabaseGateway.TA_PersonDataTable personTable = personTA.GetDataByBarcode("00001"); ADOPerson1.ID = Convert.ToInt32(personTable.Rows[0]["prs_ID"]); ADOPerson1.PersonCode = Convert.ToString(personTable.Rows[0]["prs_Barcode"]); ADOPerson1.LastName = "TestAlian1"; personTable = personTA.GetDataByBarcode("00002"); ADOPerson2.ID = Convert.ToInt32(personTable.Rows[0]["prs_ID"]); ADOPerson2.PersonCode = Convert.ToString(personTable.Rows[0]["prs_Barcode"]); ADOPerson2.LastName = "TestAlian2"; personTable = personTA.GetDataByBarcode("00003"); ADOPerson3.ID = Convert.ToInt32(personTable.Rows[0]["prs_ID"]); ADOPerson3.PersonCode = Convert.ToString(personTable.Rows[0]["prs_Barcode"]); ADOPerson3.LastName = "TestAlian3"; personTable = personTA.GetDataByBarcode("00004"); ADOPerson4.ID = Convert.ToInt32(personTable.Rows[0]["prs_ID"]); ADOPerson4.PersonCode = Convert.ToString(personTable.Rows[0]["prs_Barcode"]); ADOPerson4.LastName = "TestAlian4"; personTable = personTA.GetDataByBarcode("00005"); ADOPerson5.ID = Convert.ToInt32(personTable.Rows[0]["prs_ID"]); ADOPerson5.PersonCode = Convert.ToString(personTable.Rows[0]["prs_Barcode"]); ADOPerson5.LastName = "TestAlian5"; personTable = personTA.GetDataByBarcode("00006"); ADOPerson6.ID = Convert.ToInt32(personTable.Rows[0]["prs_ID"]); ADOPerson6.PersonCode = Convert.ToString(personTable.Rows[0]["prs_Barcode"]); ADOPerson6.LastName = "TestAlian6"; personDtilTA.InsertQuery2(ADOPerson1.ID, "001232130", "23432", "", "", "HassanTest", (int)MilitaryStatus.HeineKhedmat, "", "", "", "", DateTime.Now); personDtilTA.InsertQuery2(ADOPerson2.ID, "001434130", "11432", "", "", "HassanTest", (int)MilitaryStatus.AmadeBeKhedmat, "", "", "", "", DateTime.Now); personDtilTA.InsertQuery2(ADOPerson3.ID, "001434165", "11532", "", "", "HassanTest", (int)MilitaryStatus.AmadeBeKhedmat, "", "", "", "", DateTime.Now); personDtilTA.InsertQuery2(ADOPerson4.ID, "001434100", "11532", "", "", "HassanTest", (int)MilitaryStatus.AmadeBeKhedmat, "", "", "", "", DateTime.Now); personDtilTA.InsertQuery2(ADOPerson5.ID, "001434101", "11532", "", "", "HassanTest", (int)MilitaryStatus.AmadeBeKhedmat, "", "", "", "", DateTime.Now); personDtilTA.InsertQuery2(ADOPerson6.ID, "001434102", "11532", "", "", "HassanTest", (int)MilitaryStatus.AmadeBeKhedmat, "", "", "", "", DateTime.Now); personTA.UpdateDetails(ADOPerson1.ID, "001232130"); personTA.UpdateDetails(ADOPerson2.ID, "001434130"); personTA.UpdateDetails(ADOPerson3.ID, "001434165"); personTA.UpdateDetails(ADOPerson4.ID, "001434100"); personTA.UpdateDetails(ADOPerson5.ID, "001434101"); personTA.UpdateDetails(ADOPerson6.ID, "001434102"); #endregion #region user userTA.InsertQuery(ADOPerson1.ID, "TestUserName1"); userTA.InsertQuery(ADOPerson2.ID, "TestUserName2"); userTA.InsertQuery(ADOPerson3.ID, "TestUserName3"); userTA.InsertQuery(ADOPerson4.ID, "TestUserName4"); userTA.InsertQuery(ADOPerson5.ID, "TestUserName5"); userTA.InsertQuery(ADOPerson6.ID, "TestUserName6"); DatabaseGateway.TA_SecurityUserDataTable userTable; userTable = userTA.GetDataByUserName("TestUserName1"); ADOUser1.ID = Convert.ToInt32(userTable.Rows[0]["user_ID"]); ADOUser1.UserName = "******"; userTable = userTA.GetDataByUserName("TestUserName2"); ADOUser2.ID = Convert.ToInt32(userTable.Rows[0]["user_ID"]); ADOUser2.UserName = "******"; userTable = userTA.GetDataByUserName("TestUserName3"); ADOUser3.ID = Convert.ToInt32(userTable.Rows[0]["user_ID"]); ADOUser3.UserName = "******"; userTable = userTA.GetDataByUserName("TestUserName4"); ADOUser4.ID = Convert.ToInt32(userTable.Rows[0]["user_ID"]); ADOUser4.UserName = "******"; userTable = userTA.GetDataByUserName("TestUserName5"); ADOUser5.ID = Convert.ToInt32(userTable.Rows[0]["user_ID"]); ADOUser5.UserName = "******"; userTable = userTA.GetDataByUserName("TestUserName6"); ADOUser6.ID = Convert.ToInt32(userTable.Rows[0]["user_ID"]); ADOUser6.UserName = "******"; #endregion #region DataAccess dataAccessDepTA.Insert(BUser.CurrentUser.ID, ADODepartment1.ID, false); dataAccessDepTA.Insert(BUser.CurrentUser.ID, ADODepartment2.ID, false); //dataAccessMngTA.Insert(BUser.CurrentUser.ID, null, true); #endregion #region Calc Leave UsedLeaveDtlTA.Insert(DateTime.Now.AddYears(-1), 0, 0, 0, ADOPerson1.ID, 0); UsedleaveTable = UsedLeaveDtlTA.GetDataByValue(ADOPerson1.ID); leaveCalcTA.Insert(DateTime.Now.AddYears(-1), 0, 0, ADOPerson1.ID, 0, 0, 0, 0, 0, (decimal)UsedleaveTable.Rows[0][0], "ULD"); UsedLeaveDtlTA.Insert(DateTime.Now.AddYears(-1), 0, 0, 0, ADOPerson2.ID, 0); UsedleaveTable = UsedLeaveDtlTA.GetDataByValue(ADOPerson2.ID); leaveCalcTA.Insert(DateTime.Now.AddYears(-1), 0, 0, ADOPerson2.ID, 0, 0, 0, 0, 0, (decimal)UsedleaveTable.Rows[0][0], "ULD"); UsedLeaveDtlTA.Insert(DateTime.Now.AddYears(-1), 0, 0, 0, ADOPerson3.ID, 0); UsedleaveTable = UsedLeaveDtlTA.GetDataByValue(ADOPerson3.ID); leaveCalcTA.Insert(DateTime.Now.AddYears(-1), 0, 0, ADOPerson3.ID, 0, 0, 0, 0, 0, (decimal)UsedleaveTable.Rows[0][0], "ULD"); UsedLeaveDtlTA.Insert(DateTime.Now.AddYears(-1), 0, 0, 0, ADOPerson4.ID, 0); UsedleaveTable = UsedLeaveDtlTA.GetDataByValue(ADOPerson4.ID); leaveCalcTA.Insert(DateTime.Now.AddYears(-1), 0, 0, ADOPerson4.ID, 0, 0, 0, 0, 0, (decimal)UsedleaveTable.Rows[0][0], "ULD"); UsedLeaveDtlTA.Insert(DateTime.Now.AddYears(-1), 0, 0, 0, ADOPerson5.ID, 0); UsedleaveTable = UsedLeaveDtlTA.GetDataByValue(ADOPerson5.ID); leaveCalcTA.Insert(DateTime.Now.AddYears(-1), 0, 0, ADOPerson5.ID, 0, 0, 0, 0, 0, (decimal)UsedleaveTable.Rows[0][0], "ULD"); #endregion } } catch (Exception ex) { personTA.DeleteByBarcode("00001"); personTA.DeleteByBarcode("00002"); personTA.DeleteByBarcode("00003"); personTA.DeleteByBarcode("00004"); personTA.DeleteByBarcode("00005"); personTA.DeleteByBarcode("00006"); personDtilTA.DeleteByFatherName("HassanTest"); throw ex; } }