Exemple #1
0
        public void LoadRoot(atriumManager atmng, int programId)
        {
            //load root
            if (UIHelper.AtMng.AppMan.Language.ToUpper() == "FRE")
            {
                SelectedIssueLangText = "IssueNameFre";
            }

            myFM = atmng.GetFile();
            //selectedIssue = myFM.CurrentFile;



            if (programId == 0)
            {
                LoadRootX(atmng, 0);
            }
            else
            {
                // load roots based on program issue
                atLogic.ObjectBE obe = atmng.GetCodeTableBE("ProgramIssue");
                if (obe.myDT.Rows.Count == 0)
                {
                    obe.Load();
                }
                CodesDB.ProgramIssueDataTable pidt = (CodesDB.ProgramIssueDataTable)obe.myDT;
                foreach (CodesDB.ProgramIssueRow pir in pidt)
                {
                    if (pir.ProgramId == programId)
                    {
                        LoadRootX(atmng, pir.IssueId);
                    }
                }
            }

            tvIssues.ExpandAll();
        }
Exemple #2
0
        private void ApplyTribunalMemberFilter()
        {
            // code to apply filter criteria to memmebrs list
            if (CurrentRow() != null)
            {
                grexAppealsReadyForAssignment.DropDowns["ddMemberListAssignmentFilter"].ApplyFilter(null); // clear filter

                GridEXFilterCondition filtTribunalMember = new GridEXFilterCondition();

                if (this.chkLanguage.Checked) // add language filter
                {
                    if (CurrentRow().FileLanguageCode == "F")
                    {
                        filtTribunalMember.AddCondition(new GridEXFilterCondition(grexAppealsReadyForAssignment.DropDowns["ddMemberListAssignmentFilter"].Columns["CanHearFre"],
                                                                                  ConditionOperator.Equal, true));
                    }
                    else if (CurrentRow().FileLanguageCode == "E")
                    {
                        filtTribunalMember.AddCondition(new GridEXFilterCondition(grexAppealsReadyForAssignment.DropDowns["ddMemberListAssignmentFilter"].Columns["CanHearEng"],
                                                                                  ConditionOperator.Equal, true));
                    }
                    else
                    {
                        filtTribunalMember.AddCondition(new GridEXFilterCondition(grexAppealsReadyForAssignment.DropDowns["ddMemberListAssignmentFilter"].Columns["CanHearFre"],
                                                                                  ConditionOperator.Equal, true));
                        filtTribunalMember.AddCondition(new GridEXFilterCondition(grexAppealsReadyForAssignment.DropDowns["ddMemberListAssignmentFilter"].Columns["CanHearEng"],
                                                                                  ConditionOperator.Equal, true));
                    }
                }

                if (this.chkTraining.Checked) // add training filter
                {
                    // charter condition
                    if (CurrentRow().IsCharter)
                    {
                        filtTribunalMember.AddCondition(new GridEXFilterCondition(grexAppealsReadyForAssignment.DropDowns["ddMemberListAssignmentFilter"].Columns["TrainedCharter"],
                                                                                  ConditionOperator.Equal, true));
                    }

                    // program & benefit condition
                    if (!CurrentRow().IsAccountIdNull())
                    {
                        atLogic.ObjectBE obe = myAtMng.GetCodeTableBE("AccountType");
                        if (obe.myDT.Rows.Count == 0)
                        {
                            obe.Load();
                        }
                        CodesDB.AccountTypeDataTable atdt = (CodesDB.AccountTypeDataTable)obe.myDT;
                        CodesDB.AccountTypeRow       atr  = atdt.FindByAccountTypeId(CurrentRow().AccountId);

                        string trainedByProgramColumn = "";

                        switch (atr.ProgramID)
                        {
                        case 3:     // EI
                            trainedByProgramColumn = "TrainedEI";
                            break;

                        case 8:     // CPP
                            trainedByProgramColumn = "TrainedCPP";
                            break;

                        case 9:     // OAS
                            trainedByProgramColumn = "TrainedOAS";
                            break;
                        }

                        if (trainedByProgramColumn != "")
                        {
                            filtTribunalMember.AddCondition(new GridEXFilterCondition(grexAppealsReadyForAssignment.DropDowns["ddMemberListAssignmentFilter"].Columns[trainedByProgramColumn],
                                                                                      ConditionOperator.Equal, true));
                        }
                    }
                }

                if (this.chkLocation.Checked) // add location filter
                {
                    var memberId = new List <int>();

                    if (!CurrentRow().IsOfficeIdNull())
                    {
                        int selectedSCOfficeId = CurrentRow().OfficeId;

                        // get service centre latitude and longitude
                        lmDatasets.MemberManagement.OfficeSCListRow scr = myMemMng.DB.OfficeSCList.FindByOfficeId(selectedSCOfficeId);// myAtMng.OfficeMng.GetServiceCentre().Load(selectedSCOfficeId);

                        if (!scr.IsLatitudeNull() && !scr.IsLongitudeNull())
                        {
                            // get member postal code
                            double distance;

                            maxDistance = (int)maxDistanceEditBox.Value;

                            foreach (MemberManagement.MemberListAssignmentFilterRow mlafr in mListAssignmentFilter)
                            {
                                if (!mlafr.IsLatitudeNull())
                                {
                                    distance = myAtMng.GetPostalCodeLocation().CalculateDistance((double)mlafr.Latitude, (double)mlafr.Longitude, (double)scr.Latitude, (double)scr.Longitude);
                                    if (distance >= 0 && distance <= maxDistance)
                                    {
                                        memberId.Add(mlafr.OfficerId);
                                    }
                                }
                            }
                        }
                    }

                    if (memberId.Count == 0)
                    {
                        memberId.Add(-1);
                    }

                    GridEXFilterCondition filtLocation = new GridEXFilterCondition();
                    foreach (int memID in memberId)
                    {
                        if (filtLocation.Conditions.Count == 0)
                        {
                            filtLocation.AddCondition(new GridEXFilterCondition(grexAppealsReadyForAssignment.DropDowns["ddMemberListAssignmentFilter"].Columns["OfficerId"], ConditionOperator.Equal, memID));
                        }
                        else
                        {
                            filtLocation.AddCondition(LogicalOperator.Or, new GridEXFilterCondition(grexAppealsReadyForAssignment.DropDowns["ddMemberListAssignmentFilter"].Columns["OfficerId"], ConditionOperator.Equal, memID));
                        }
                    }
                    filtTribunalMember.AddCondition(filtLocation);
                }

                // apply filter only if conditions exist
                if (filtTribunalMember.Conditions.Count > 0)
                {
                    grexAppealsReadyForAssignment.DropDowns["ddMemberListAssignmentFilter"].ApplyFilter(filtTribunalMember);
                }
            }
        }