示例#1
0
        public void TestSetup()
        {
            workgroup_testObject = new WorkGroup();
            busWorkgroup         = new BWorkgroup();

            personTA.InsertQuery("0000", "ali", true, null);
            int personId = Convert.ToInt32(personTA.GetDataByBarcode("0000")[0][0]);

            workgrpTA.Insert("WorkGroupTest", "0-0", 0);
            workgrpTA.Insert("WorkGroupTest1", "0-1", 0);

            DatabaseGateway.TA_WorkGroupDataTable table = new DatabaseGateway.TA_WorkGroupDataTable();
            workgrpTA.FillByName(table, "WorkGroupTest");
            ADOWorkGroup.ID         = Convert.ToInt32(table.Rows[0]["workgroup_ID"]);
            ADOWorkGroup.Name       = Convert.ToString(table.Rows[0]["workgroup_Name"]);
            ADOWorkGroup.CustomCode = Convert.ToString(table.Rows[0]["workgroup_CustomCode"]);

            shiftTA.Insert("ShiftTest", 1, 11, null, 100, false, false, false, "2", "0-0");

            DatabaseGateway.TA_ShiftDataTable shiftTable = new DatabaseGateway.TA_ShiftDataTable();
            shiftTA.FillByName(shiftTable, "ShiftTest");
            ADOShift.ID = Convert.ToInt32(shiftTable.Rows[0]["shift_ID"]);

            workgrpDtlTA.Insert(ADOWorkGroup.ID, ADOShift.ID, DateTime.Now);

            assignWorkGroupTA.Insert(ADOWorkGroup.ID, personId, DateTime.Now);
        }
        public void TreatDown()
        {
            wgTA.DeleteByCustomCode("55-55");
            shiftTA.DeleteByCustomCode("55-54");
            shiftTA.DeleteByCustomCode("55-55");
            flowTA.DeleteByName("FlowTest");
            managerTA.DeleteByBarcode("00001");
            accessGroupTA.DeleteByName("AccessGroup1_2");
            doctorTA.DeleteByLastName("TestDoctorLastName1");
            illnessTA.DeleteByName("TestIllness1");
            requestTA.DeleteByPerson(ADOPerson1.ID);
            requestTA.DeleteByPerson(ADOPerson2.ID);
            precardTA.DeleteByID("99999999");
            dutyPlcTA.DeleteByName("TestDutyPlc1");
            dutyPlcTA.DeleteByName("TestDutyPlc2");

            BPerson    bperson    = new BPerson(SysLanguageResource.Parsi, LocalLanguageResource.Parsi);
            BWorkgroup bworkGroup = new BWorkgroup();
            BShift     bshift     = new BShift();

            ClearSession();
            assingWorkGrouTA.DeleteByPerson(ADOPerson1.ID);
            //bshift.SaveChanges(ADOShift1, UIActionType.DELETE);
            //bshift.SaveChanges(ADOShift2, UIActionType.DELETE);
        }
        public void TestSetup()
        {
            wgd_testObject = new WorkGroupDetail();
            busCalendar    = new BWorkGroupCalendar(SysLanguageResource.Parsi);

            #region insert workgroup,shift,person
            BPerson bperson = new BPerson(SysLanguageResource.Parsi, LocalLanguageResource.Parsi);
            ADOPerson = new Person()
            {
                ID = bperson.CreateWorkingPerson2()
            };

            BWorkgroup bworkGroup = new BWorkgroup();
            ADOWorkGroup.CustomCode = "55-55";
            ADOWorkGroup.Name       = "ClanderWorkGroupTest";
            bworkGroup.SaveChanges(ADOWorkGroup, UIActionType.ADD);

            BShift bshift = new BShift();
            ADOShift1.Name      = "ClanderShiftTest1";
            ADOShift1.Person    = ADOPerson;
            ADOShift1.Color     = "0xff6512";
            ADOShift1.ShiftType = ShiftTypesEnum.WORK;
            bshift.SaveChanges(ADOShift1, UIActionType.ADD);

            ADOShift2.Name      = "ClanderShiftTest2";
            ADOShift2.Color     = "0xbbccaa";
            ADOShift2.Person    = ADOPerson;
            ADOShift2.ShiftType = ShiftTypesEnum.WORK;
            bshift.SaveChanges(ADOShift2, UIActionType.ADD);
            #endregion

            #region date inti
            date1  = Utility.ToMildiDate("1390/5/1");
            date2  = Utility.ToMildiDate("1390/5/2");
            date3  = Utility.ToMildiDate("1390/5/3");
            date4  = Utility.ToMildiDate("1390/5/5");
            date5  = Utility.ToMildiDate("1390/5/6");
            date6  = Utility.ToMildiDate("1390/5/7");
            date7  = Utility.ToMildiDate("1390/5/9");
            date8  = Utility.ToMildiDate("1390/5/10");
            date9  = Utility.ToMildiDate("1390/5/11");
            date10 = Utility.ToMildiDate("1389/1/1");
            date11 = Utility.ToMildiDate("1391/1/1");
            #endregion

            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date1);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date2);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date3);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date4);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date5);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift2.ID, date6);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift2.ID, date7);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift2.ID, date8);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift2.ID, date9);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift2.ID, date10);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift2.ID, date11);
            ClearSession();
        }
        public void TreatDown()
        {
            BPerson    bperson    = new BPerson(SysLanguageResource.Parsi, LocalLanguageResource.Parsi);
            BWorkgroup bworkGroup = new BWorkgroup();
            BShift     bshift     = new BShift();

            ClearSession();
            bworkGroup.SaveChanges(ADOWorkGroup, UIActionType.DELETE);
            bshift.SaveChanges(ADOShift1, UIActionType.DELETE);
            bshift.SaveChanges(ADOShift2, UIActionType.DELETE);
            bperson.SaveChanges(ADOPerson, UIActionType.DELETE);
        }
示例#5
0
 /// <summary>
 /// لیستی از گروههای کاری را برمیگرداند
 /// </summary>
 /// <returns>لیست گروه های کاری</returns>
 public IList <WorkGroup> GetAllWorkGroup()
 {
     try
     {
         BWorkgroup busWorkGroup = new BWorkgroup();
         return(busWorkGroup.GetAll());
     }
     catch (Exception ex)
     {
         LogException(ex, "BAssignWorkGroup", "GetAllWorkGroup");
         throw ex;
     }
 }
示例#6
0
        public void TestSetup()
        {
            busExceptionShift  = new BExceptionShift();
            shiftEx_testobject = new ShiftException();

            #region Shift
            shiftTA.Insert("ShiftTest1", 1, 11, null, 100, false, false, false, "2", "0-00");
            shiftTA.Insert("ShiftTest2", 1, 11, null, 100, false, false, false, "2", "0-00");
            ADOShift1 = new Shift();

            DatabaseGateway.TA_ShiftDataTable shiftTable = new DatabaseGateway.TA_ShiftDataTable();
            shiftTA.FillByName(shiftTable, "ShiftTest1");
            ADOShift1.ID = Convert.ToInt32(shiftTable.Rows[0]["shift_ID"]);
            shiftTA.FillByName(shiftTable, "ShiftTest2");
            ADOShift2.ID = Convert.ToInt32(shiftTable.Rows[0]["shift_ID"]);
            #endregion

            #region WorkGroup & WorkGroup Detail & Assignment
            BWorkgroup bworkGroup = new BWorkgroup();
            ADOWorkGroup.CustomCode = "00-00";
            ADOWorkGroup.Name       = "TestWorkGroup";
            bworkGroup.SaveChanges(ADOWorkGroup, UIActionType.ADD);

            ADOWorkGroup2.CustomCode = "00-01";
            ADOWorkGroup2.Name       = "TestWorkGroup2";
            bworkGroup.SaveChanges(ADOWorkGroup2, UIActionType.ADD);

            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, Utility.ToMildiDate("1390/10/01"));
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift2.ID, Utility.ToMildiDate("1390/10/03"));
            wgdTA.Insert(ADOWorkGroup2.ID, ADOShift2.ID, Utility.ToMildiDate("1390/10/01"));

            asgWrgTA.Insert(ADOWorkGroup.ID, ADOPerson2.ID, Utility.ToMildiDate("1390/09/15"));
            asgWrgTA.Insert(ADOWorkGroup2.ID, ADOPerson1.ID, Utility.ToMildiDate("1390/09/15"));
            #endregion
            exShiftTA.Insert(ADOPerson1.ID, ADOShift1.ID, Utility.ToMildiDate("1390/10/10"), ADOUser1.ID, DateTime.Now, "");
            DatabaseGateway.TA_ExceptionShiftDataTable exShiftTable = exShiftTA.GetDataByPersonId(ADOPerson1.ID);
            ADOExShift.ID = Convert.ToDecimal(exShiftTable.Rows[0]["ExceptionShift_ID"]);
        }
示例#7
0
        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()
        {
            #region precards

            DatasetGatewayWorkFlow.TA_PrecardGroupsDataTable precardTable = new DatasetGatewayWorkFlow.TA_PrecardGroupsDataTable();
            precardGroupTA.FillByName(precardTable, PrecardGroupsName.overwork.ToString());
            ADOPrecardGroup1.ID   = Convert.ToInt32(precardTable.Rows[0][0]);
            ADOPrecardGroup1.Name = "OwerWork";


            precardTA.Insert("TestPrecard1", true, ADOPrecardGroup1.ID, true, false, true, "99999999", false);

            DatasetGatewayWorkFlow.TA_PrecardDataTable pTable = new DatasetGatewayWorkFlow.TA_PrecardDataTable();
            pTable = precardTA.GetDataByName("TestPrecard1");
            ADOPrecardOverTime1.ID   = Convert.ToInt32(pTable.Rows[0][0]);
            ADOPrecardOverTime1.Name = "TestPrecard1";

            pTable = precardTA.GetDataByCode(126.ToString());
            ADOPrecardDasturyOverTime.ID = Convert.ToInt32(pTable.Rows[0][0]);
            #endregion

            requestTA.Insert(ADOPrecardOverTime1.ID, ADOPerson1.ID, new DateTime(2010, 5, 1), new DateTime(2010, 5, 1), 420, 600, "", DateTime.Now, ADOUser1.ID);

            DatasetGatewayWorkFlow.TA_RequestDataTable requestTable = new DatasetGatewayWorkFlow.TA_RequestDataTable();
            requestTable           = requestTA.GetDataByPersonId(ADOPerson1.ID);
            ADORequestOvertime1.ID = Convert.ToInt32(requestTable.Rows[0][0]);


            #region Manager Flow

            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;

            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, "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(ADOManager1.ID, 1, 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"]);

            #endregion

            requestStatusTA.Insert(ADOManagerFlow1.ID, ADORequestOvertime1.ID, true, false, "", DateTime.Now, false);

            request_testObject = new Request();
            busOverTime        = new BRequest(ADOPerson1.ID);

            #region insert workgroup,shift
            BWorkgroup bworkGroup = new BWorkgroup();
            ADOWorkGroup.CustomCode = "55-55";
            ADOWorkGroup.Name       = "ClanderWorkGroupTest";
            bworkGroup.SaveChanges(ADOWorkGroup, UIActionType.ADD);

            assingWorkGrouTA.Insert(ADOWorkGroup.ID, ADOPerson1.ID, new DateTime(2000, 1, 1));

            BShift bshift = new BShift();
            ADOShift1.Name       = "ClanderShiftTest1";
            ADOShift1.Person     = ADOPerson1;
            ADOShift1.Color      = "0xff6512";
            ADOShift1.ShiftType  = ShiftTypesEnum.WORK;
            ADOShift1.CustomCode = "55-54";
            bshift.SaveChanges(ADOShift1, UIActionType.ADD);
            ShiftPair pair1 = new ShiftPair(100, 200)
            {
                ShiftId = ADOShift1.ID
            };
            ShiftPair pair2 = new ShiftPair(200, 400)
            {
                ShiftId = ADOShift1.ID
            };
            bshift.SaveChangesShiftPair(pair1, UIActionType.ADD);
            bshift.SaveChangesShiftPair(pair2, UIActionType.ADD);

            ADOShift2.Name       = "ClanderShiftTest2";
            ADOShift2.Color      = "0xbbccaa";
            ADOShift2.Person     = ADOPerson1;
            ADOShift2.ShiftType  = ShiftTypesEnum.WORK;
            ADOShift2.CustomCode = "55-55";
            bshift.SaveChanges(ADOShift2, UIActionType.ADD);
            #endregion

            #region date inti
            date1 = Utility.ToMildiDate("1390/5/1");
            date2 = Utility.ToMildiDate("1390/5/2");
            date3 = Utility.ToMildiDate("1390/5/3");
            date4 = Utility.ToMildiDate("1390/5/5");
            date5 = Utility.ToMildiDate("1390/5/6");
            date6 = Utility.ToMildiDate("1390/5/7");
            date7 = Utility.ToMildiDate("1390/5/9");

            #endregion

            #region WorkGroup Detail
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date1);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date2);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date3);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date4);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift1.ID, date5);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift2.ID, date6);
            wgdTA.Insert(ADOWorkGroup.ID, ADOShift2.ID, date7);
            #endregion

            ClearSession();
        }