public void TestSetup() { validationGroup_testObject = new UIValidationGroup(); busValidationGroup = new BUIValidationGroup(); ruleTA.InsertQuery(111000111, "TestRule1", "000-001", true); ruleTA.InsertQuery(111000112, "TestRule2", "000-002", true); DatabaseGateway.TA_UIValidationRuleDataTable ruleTable = ruleTA.GetDataByCode("000-001"); ADORule1.ID = (ruleTable.Rows[0] as DatabaseGateway.TA_UIValidationRuleRow).UIRle_ID; ruleTable = ruleTA.GetDataByCode("000-002"); ADORule2.ID = (ruleTable.Rows[0] as DatabaseGateway.TA_UIValidationRuleRow).UIRle_ID; paramTmpTA.Insert(0, "Rule TMP Param Test 1", ADORule1.ID); paramTmpTA.Insert(1, "Rule TMP Param Test 2", ADORule1.ID); paramTmpTA.Insert(2, "Rule TMP Param Test 3", ADORule1.ID); validationGroupTA.InsertQuery("TestGroup00"); DatabaseGateway.TA_UIValidationGroupDataTable groupTable = validationGroupTA.GetDataByName("TestGroup00"); ADOGroup1.ID = (groupTable.Rows[0] as DatabaseGateway.TA_UIValidationGroupRow).UIValGrp_ID; validationGroupTA.InsertQuery("TestGroup01"); groupTable = validationGroupTA.GetDataByName("TestGroup01"); ADOGroup2.ID = (groupTable.Rows[0] as DatabaseGateway.TA_UIValidationGroupRow).UIValGrp_ID; groupingTA.Insert(ADORule1.ID, ADOGroup1.ID, false, true); personTA.UpdateValidationGroup(ADOGroup1.ID, ADOPerson1.ID); }
private Person GetReadyForUpdate(decimal personid, SysLanguageResource sys, LocalLanguageResource local) { try { busPerson = new BPerson(sys, local); if (personid == 0) { person_testObject.ID = busPerson.CreateWorkingPerson2(); ClearSession(); } else { person_testObject.ID = personid; } person_testObject.PersonDetail = new PersonDetail(); #region Assigns BAssignWorkGroup bAssginWorkGroup = new BAssignWorkGroup(SysLanguageResource.Parsi); BWorkgroup workgroup = new BWorkgroup(); decimal wID = workgroup.SaveChanges(new WorkGroup() { Name = "WorkGroupTest3", CustomCode = "0-3" }, UIActionType.ADD); AssignWorkGroup aw = new AssignWorkGroup(); aw.UIFromDate = Utility.ToPersianDate(DateTime.Now); aw.WorkGroup = new WorkGroup() { ID = wID, Name = "WorkGroupTest3" }; aw.Person = new Person() { ID = person_testObject.ID }; bAssginWorkGroup.SaveChanges(aw, UIActionType.ADD); BAssignRule bAssginRule = new BAssignRule(SysLanguageResource.Parsi); BRuleCategory bruleCat = new BRuleCategory(); bruleCat.EnableInsertValidate = false; decimal rID = bruleCat.SaveChanges(new RuleCategory() { Name = "RuleCatTest3", CustomCode = "00-00test2" }, UIActionType.ADD); PersonRuleCatAssignment pa = new PersonRuleCatAssignment(); pa.UIFromDate = Utility.ToPersianDate(new DateTime(2016, 1, 1)); pa.UIToDate = Utility.ToPersianDate(new DateTime(2017, 1, 1)); pa.RuleCategory = new RuleCategory() { ID = rID, Name = "RuleCatTest3" }; pa.Person = new Person() { ID = person_testObject.ID }; bAssginRule.SaveChanges(pa, UIActionType.ADD); BAssignDateRange bDateRange = new BAssignDateRange(SysLanguageResource.Parsi); PersonRangeAssignment rangeAssign = new PersonRangeAssignment(); BDateRange bdate = new BDateRange(); decimal rangeId = bdate.SaveChanges(new CalculationRangeGroup() { Name = "CalcGroup3" }, UIActionType.ADD); ClearSession(); rangeAssign.CalcDateRangeGroup = new CalculationRangeGroup() { ID = rangeId }; if (sys == SysLanguageResource.Parsi) { rangeAssign.UIFromDate = "1390/01/01"; } else { rangeAssign.UIFromDate = "1390/01/01"; //Utility.ToString(Utility.ToMildiDate("1390/01/01")); } rangeAssign.Person = new Person() { ID = person_testObject.ID }; bDateRange.SaveChanges(rangeAssign, UIActionType.ADD); //جهت درج //person_testObject.PersonRangeAssignList = new List<PersonRangeAssignment>(); //person_testObject.PersonRangeAssignList.Add(rangeAssign); #endregion #region Dep DatabaseGatewayTableAdapters.TA_DepartmentTableAdapter departmentTA = new GTSTestUnit.Clock.Business.DatabaseGatewayTableAdapters.TA_DepartmentTableAdapter(); decimal departmentId = Convert.ToDecimal(departmentTA.InsertQuery("Level1", "123", 1, ",1,", "")); DatabaseGatewayTableAdapters.TA_OrganizationUnitTableAdapter organTA = new GTSTestUnit.Clock.Business.DatabaseGatewayTableAdapters.TA_OrganizationUnitTableAdapter(); organTA.InsertQuery("OrganTestLevel1", "0-0Test", null, 1, String.Format(",{0},", 1)); decimal organId = Convert.ToDecimal(organTA.GetDataByCustomCode("0-0Test")[0]["organ_ID"]); DatabaseGatewayTableAdapters.TA_ControlStationTableAdapter sataionTA = new GTSTestUnit.Clock.Business.DatabaseGatewayTableAdapters.TA_ControlStationTableAdapter(); sataionTA.Insert("StationTest1", "0-0Test"); decimal stationId = Convert.ToDecimal(sataionTA.GetDataByCustomCode("0-0Test")[0]["station_ID"]); DatabaseGatewayTableAdapters.TA_EmploymentTypeTableAdapter emplTA = new GTSTestUnit.Clock.Business.DatabaseGatewayTableAdapters.TA_EmploymentTypeTableAdapter(); emplTA.Insert("EmploymentTypeTest1", "0-0Test"); decimal employeeId = Convert.ToDecimal(emplTA.GetDataByCustomCode("0-0Test")[0]["emply_ID"]); #endregion #region UIValidatinGroup DatabaseGatewayTableAdapters.TA_UIValidationGroupTableAdapter validationGroupTA = new GTSTestUnit.Clock.Business.DatabaseGatewayTableAdapters.TA_UIValidationGroupTableAdapter(); UIValidationGroup ADOUIValidationGroupEmpty = new UIValidationGroup(); validationGroupTA.InsertQuery("TestGroup00"); DatabaseGateway.TA_UIValidationGroupDataTable groupTable = validationGroupTA.GetDataByName("TestGroup00"); ADOUIValidationGroupEmpty.ID = (groupTable.Rows[0] as DatabaseGateway.TA_UIValidationGroupRow).UIValGrp_ID; person_testObject.UIValidationGroup = ADOUIValidationGroupEmpty; #endregion person_testObject.FirstName = "Iraj"; person_testObject.LastName = "Bahadori"; person_testObject.PersonDetail.FatherName = "Gholzoom"; person_testObject.PersonDetail.FatherName = "0082111098"; person_testObject.PersonDetail.BirthCertificate = "22777"; person_testObject.PersonDetail.BirthPlace = "Sorhe"; person_testObject.Education = "لیسانس"; person_testObject.PersonDetail.Status = "رو هوا"; person_testObject.PersonDetail.Tel = "23444343"; person_testObject.PersonDetail.Address = ""; person_testObject.PersonCode = "00001222"; person_testObject.CardNum = "4345554"; person_testObject.EmploymentNum = "123A342-ad"; person_testObject.Sex = PersonSex.Male; person_testObject.MaritalStatus = MaritalStatus.Motaleghe; person_testObject.PersonDetail.MilitaryStatus = MilitaryStatus.HeineKhedmat; person_testObject.Department = new global::GTS.Clock.Model.Charts.Department() { ID = departmentId }; person_testObject.OrganizationUnit = new global::GTS.Clock.Model.Charts.OrganizationUnit() { ID = organId, PersonID = person_testObject.ID, Name = "OrganTestLevel1", CustomCode = "0-0", ParentID = 1 }; person_testObject.ControlStation = new global::GTS.Clock.Model.BaseInformation.ControlStation() { ID = stationId }; person_testObject.EmploymentType = new global::GTS.Clock.Model.BaseInformation.EmploymentType() { ID = employeeId }; if (sys == SysLanguageResource.Parsi) { person_testObject.UIEmploymentDate = "1380/05/03"; person_testObject.UIEndEmploymentDate = "1390/05/03"; person_testObject.PersonDetail.UIBirthDate = "1390/05/03"; } else { person_testObject.UIEmploymentDate = Utility.ToString(Utility.ToMildiDate("1380/05/03")); person_testObject.UIEndEmploymentDate = Utility.ToString(Utility.ToMildiDate("1390/05/03")); person_testObject.PersonDetail.UIBirthDate = Utility.ToString(Utility.ToMildiDate("1390/05/03")); } ClearSession(); return(person_testObject); } catch (Exception ex) { throw ex; } }
public void TestSetup() { return; busPerson = new BPerson(SysLanguageResource.English, LocalLanguageResource.English); searchTool = new BPerson(); person_testObject = new Person(); workgrpTA.Insert("WorkGroupTest1", "0-0", 0); workgrpTA.Insert("WorkGroupTest2", "0-1", 0); DatabaseGateway.TA_WorkGroupDataTable table = new DatabaseGateway.TA_WorkGroupDataTable(); workgrpTA.FillByName(table, "WorkGroupTest1"); ADOWorkGroup1.ID = Convert.ToInt32(table.Rows[0]["workgroup_ID"]); ADOWorkGroup1.Name = Convert.ToString(table.Rows[0]["workgroup_Name"]); ADOWorkGroup1.CustomCode = Convert.ToString(table.Rows[0]["workgroup_CustomCode"]); workgrpTA.FillByName(table, "WorkGroupTest2"); ADOWorkGroup2.ID = Convert.ToInt32(table.Rows[0]["workgroup_ID"]); ADOWorkGroup2.Name = Convert.ToString(table.Rows[0]["workgroup_Name"]); ADOWorkGroup2.CustomCode = Convert.ToString(table.Rows[0]["workgroup_CustomCode"]); assignWorkGroupTA.Insert(ADOWorkGroup1.ID, ADOPerson2.ID, new DateTime(2007, 4, 5)); assignWorkGroupTA.Insert(ADOWorkGroup1.ID, ADOPerson2.ID, new DateTime(2012, 5, 5)); assignWorkGroupTA.Insert(ADOWorkGroup2.ID, ADOPerson2.ID, new DateTime(2010, 11, 6)); assignWorkGroupTA.Insert(ADOWorkGroup1.ID, ADOPerson2.ID, new DateTime(2009, 6, 15)); assignWorkGroupTA.Insert(ADOWorkGroup1.ID, ADOPerson2.ID, new DateTime(2010, 8, 5)); groupTA.Insert("RangeGroup1", "", 1); groupTA.Insert("RangeGroup2", "", 1); DatabaseGateway.TA_CalculationRangeGroupDataTable groupTable = new DatabaseGateway.TA_CalculationRangeGroupDataTable(); groupTA.FillByGroupName(groupTable, "RangeGroup1"); ADOGroup1.ID = Convert.ToDecimal(groupTable.Rows[0]["CalcRangeGroup_ID"]); ADOGroup1.Name = Convert.ToString(groupTable.Rows[0]["CalcRangeGroup_Name"]); ADOGroup1.Description = Convert.ToString(groupTable.Rows[0]["CalcRangeGroup_Des"]); groupTA.FillByGroupName(groupTable, "RangeGroup2"); ADOGroup2.ID = Convert.ToDecimal(groupTable.Rows[0]["CalcRangeGroup_ID"]); ADOGroup2.Name = Convert.ToString(groupTable.Rows[0]["CalcRangeGroup_Name"]); ADOGroup2.Description = Convert.ToString(groupTable.Rows[0]["CalcRangeGroup_Des"]); assinTA.Insert(ADOPerson2.ID, ADOGroup1.ID, new DateTime(2010, 2, 14)); assinTA.Insert(ADOPerson2.ID, ADOGroup1.ID, new DateTime(2005, 5, 14)); assinTA.Insert(ADOPerson2.ID, ADOGroup1.ID, new DateTime(2007, 11, 5)); assinTA.Insert(ADOPerson2.ID, ADOGroup2.ID, new DateTime(2010, 9, 14)); assinTA.Insert(ADOPerson2.ID, ADOGroup1.ID, new DateTime(2012, 9, 14)); assinTA.Insert(ADOPerson2.ID, ADOGroup1.ID, new DateTime(2008, 3, 1)); ruleCatTA.Insert("RuleGroupTest1", "0000", false, "00-00test1"); ruleCatTA.Insert("RuleGroupTest2", "0000", false, "00-00test1"); DatabaseGateway.TA_RuleCategoryDataTable ruleTable = ruleCatTA.GetDataByName("RuleGroupTest1"); ADORuleCat1.ID = (Decimal)ruleTable[0]["RuleCat_ID"]; ADORuleCat1.Name = (String)ruleTable[0]["RuleCat_Name"]; ruleTable = ruleCatTA.GetDataByName("RuleGroupTest2"); ADORuleCat2.ID = (Decimal)ruleTable[0]["RuleCat_ID"]; ADORuleCat2.Name = (String)ruleTable[0]["RuleCat_Name"]; prsRleCatAsgTA.Insert(ADOPerson2.ID, ADORuleCat1.ID, "2005/05/15", "2007/05/08", null); prsRleCatAsgTA.Insert(ADOPerson2.ID, ADORuleCat1.ID, "2008/01/01", "2010/01/01", null); prsRleCatAsgTA.Insert(ADOPerson2.ID, ADORuleCat1.ID, "2010/01/02", "2010/12/01", null); prsRleCatAsgTA.Insert(ADOPerson2.ID, ADORuleCat1.ID, "2010/12/02", "2011/03/01", null); prsRleCatAsgTA.Insert(ADOPerson2.ID, ADORuleCat2.ID, "2011/03/02", "2015/03/01", null); validationGroupTA.InsertQuery("TestGroup00"); DatabaseGateway.TA_UIValidationGroupDataTable uiValGroupTable = validationGroupTA.GetDataByName("TestGroup00"); ADOUIValidationGroup1.ID = (uiValGroupTable.Rows[0] as DatabaseGateway.TA_UIValidationGroupRow).UIValGrp_ID; }