public static Apprenticeship DecodeSearchFrameworkOrStandardByName(String frameworkOrStandardName)
        {
            if (frameworkOrStandardName == null)
            {
                return(null);
            }

            ProviderPortalEntities _db = new ProviderPortalEntities();

            String[] nameParts = frameworkOrStandardName.Split('-');
            switch (nameParts.GetLength(0))
            {
            case 2:     // Must be a standard

                String standardSectorCode = nameParts[0].Trim();
                String standardName       = nameParts[1].Trim();

                StandardSectorCode ssc = _db.StandardSectorCodes.FirstOrDefault(x => x.StandardSectorCodeDesc == standardSectorCode);
                if (ssc != null)
                {
                    Standard s = _db.Standards.FirstOrDefault(x => x.StandardName == standardName && x.StandardSectorCode == ssc.StandardSectorCodeId && x.RecordStatusId == (Int32)Constants.RecordStatus.Live);
                    if (s != null)
                    {
                        return(new Apprenticeship
                        {
                            StandardCode = s.StandardCode,
                            Version = s.Version
                        });
                    }
                }

                break;

            case 3:     // Must be a framework

                String nasTitle     = nameParts[0].Trim();
                String progTypeDesc = nameParts[1].Trim();
                String pathwayName  = nameParts[2].Trim();

                ProgType pt = _db.ProgTypes.FirstOrDefault(x => x.ProgTypeDesc == progTypeDesc);
                if (pt != null)
                {
                    Framework fw = _db.Frameworks.FirstOrDefault(x => x.NasTitle == nasTitle && x.ProgType == pt.ProgTypeId && x.PathwayName == pathwayName && x.RecordStatusId == (Int32)Constants.RecordStatus.Live);
                    if (fw != null)
                    {
                        return(new Apprenticeship
                        {
                            FrameworkCode = fw.FrameworkCode,
                            ProgType = fw.ProgType,
                            PathwayCode = fw.PathwayCode
                        });
                    }
                }

                break;
            }

            return(null);
        }
 public IEnumerable <ApprenticeshipProgrammeTypeAim> ApprenticeshipAims(ProgType pt)
 {
     return(_apprenticeShipAims.Values.Where(s => s.ProgType == pt));;
 }
Example #3
0
        public AppSettings(string sPath2AppDir)
        {
            mAppDir = sPath2AppDir;

            string sProgType, sProgLang;

            sProgType = "trial";
            sProgLang = "heb";

            string sPath2SettingsXML = mAppDir + "\\Settings\\Settings.xml";

            XmlDocument XmlDoc = new XmlDocument();

            XmlDoc.Load(sPath2SettingsXML);

            XmlNodeList root = XmlDoc.GetElementsByTagName("AppSettings");

            XmlNodeList AllNodes = root[0].ChildNodes;

            foreach (XmlNode CurrNode in AllNodes)
            {
                if (CurrNode.Name.ToLower() == "language")
                {
                    sProgLang = CurrNode.InnerText.ToLower().Trim();
                }

                if (CurrNode.Name.ToLower() == "type")
                {
                    sProgType = CurrNode.InnerText.ToLower().Trim();
                }
            }

            string[] splt = sProgType.Split(",".ToCharArray()[0]);

            switch (splt[0].ToLower())
            {
            case "trial":
            case "t":
                mProgType          = ProgType.Trial;
                mTrialTimeDuration = Convert.ToInt16(splt[1]);
                break;

            case "normal":
                mProgType = ProgType.Normal;
                break;

            case "expert":
                mProgType = ProgType.Expert;
                break;

            case "dad":
                mProgType = ProgType.DAD;
                break;

            default:
                mProgType = ProgType.Trial;
                break;
            }

            switch (sProgLang.ToLower())
            {
            case "heb":
            case "hrebrew":
                mLang = Language.Hebrew;
                break;

            case "eng":
            case "english":
                mLang = Language.English;
                break;

            default:
                mLang = Language.Hebrew;
                break;
            }
        }