public void UpdateFlow_Test() { IList <UnderManagment> unders = new List <UnderManagment>(); UnderManagment under1 = new UnderManagment(); under1.Department = new Department() { ID = ADODepartment1.ID }; under1.Contains = true; UnderManagment under2 = new UnderManagment(); under2.Department = new Department() { ID = ADODepartment2.ID }; under2.Contains = true; under2.Person = new Person() { ID = ADOPerson4.ID }; unders.Add(under1); unders.Add(under2); busManager.UpdateFlow(ADOFlow1.ID, ADOAccessGroup2.ID, "FlowTest", unders); ClearSession(); BFlow bflow = new BFlow(); Flow testObject = bflow.GetByID(ADOFlow1.ID); Assert.AreEqual(ADOAccessGroup2.ID, testObject.AccessGroup.ID); Assert.IsNotNull(testObject.UnderManagmentList); Assert.AreEqual(2, testObject.UnderManagmentList.Count); Assert.IsTrue(testObject.UnderManagmentList.Where(x => x.Person != null && x.Person.ID == ADOPerson4.ID).Count() == 1); }
public void Delete_FlowTest() { try { busManager.DeleteFlow(ADOFlow1.ID); Flow f = new BFlow().GetByID(ADOFlow1.ID); Assert.Fail("نباید در دیتابیس موجود باشد"); } catch (ItemNotExists ex) { Assert.Pass(ex.Message); } }
/// <summary> /// بصورت بازگشتی درحت را پیمایش و شرط نمایش را بررسی میکند /// اگر تشخیص داده شد که گره ای نباید نشان داده شود نیازی به پیمایش گره های فرزند نیست /// زیرا این تشخیص شامل آنها نیز میشود /// </summary> /// <param name="department"></param> /// <param name="visibleIds"></param> private void SetVisibility(Department department, Flow flow, IList <Department> containsChildList) { BFlow bFlow = new BFlow(); //IList<decimal> restrictionIds = accessPort.GetAccessibleDeparments(); if (department.ChildList != null) { foreach (Department child in department.ChildList) { if (!containsChildList.Contains(child)) { child.Visible = child.Visible || false;//ممکن است در جریانهای قبلی مقدار یک گرفته باشد } else { child.Visible = true; this.SetVisibility(child, flow, bFlow.GetDepartmentChilds(child.ID, flow.ID)); } } } }
protected void Button32_Click(object sender, EventArgs e) { BFlow busFlow = new BFlow(); busFlow.SearchFlow(FlowSearchFields.AccessGroupName, "بدون"); }
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() { busflow = new BFlow(); flow_testObject = new Flow(); 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); 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; 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"; 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(ADOManager2.ID, 1, ADOFlow1.ID, true); mangFlowTA.Insert(ADOManager1.ID, 2, 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"]); ADOManagerFlow2.ID = Convert.ToInt32(nbgFlowTable.Rows[1]["mngrFlow_ID"]); ADOManagerFlow2.Level = Convert.ToInt32(nbgFlowTable.Rows[1]["mngrFlow_LEVEL"]); undermanagmentTA.Insert(ADOFlow1.ID, ADOPerson3.ID, ADODepartment1.ID, false, true); undermanagmentTA.Insert(ADOFlow1.ID, ADOPerson5.ID, ADODepartment2.ID, false, false); }