Пример #1
0
 public JsonController()
 {
     Result              = new Result();
     countryUtil         = new CountryUtil();
     stateUtil           = new StateUtil();
     areaUtil            = new AreaUtil();
     userUtil            = new UserUtil();
     subareaUtil         = new SubAreaUtil();
     appointmentTypeUtil = new AppointmentTypeUtil();
     currencyUtil        = new CurrencyUtil();
     dateFormatUtil      = new DateFormatUtil();
     languageUtil        = new LanguageUtil();
     religionUtil        = new ReligionUtil();
     durationDaysUtil    = new DurationDaysUtil();
     sourceUtil          = new SourceUtil();
     packageUtil         = new PackageUtil();
     cityUtil            = new CityUtil();
     //scoreColumnUtil = new ScoreColumnUtil();
     nationalityUtil = new NationalityUtil();
     timeFormatUtil  = new TimeFormatUtil();
     industryUtil    = new IndustryUtil();
     paymentModeUtil = new PaymentModeUtil();
     applicationTemplatePlaceHolderUtil = new ApplicationTemplatePlaceHolderUtil();
     jobTypeUtill        = new JobTypeUtill();
     jobStatusUtill      = new JobStatusUtill();
     packageTypeUtill    = new PackageTypeUtill();
     paperTypeUtill      = new PaperTypeUtill();
     paperSubTypeUtill   = new PaperSubTypeUtill();
     paymentStatusUtill  = new PaymentStatusUtill();
     currencyUtil        = new CurrencyUtil();
     leminationTypeUtill = new LeminationTypeUtill();
 }
Пример #2
0
        public MastersController()
        {
            result              = new Result();
            countryUtil         = new CountryUtil();
            stateUtil           = new StateUtil();
            cityUtil            = new CityUtil();
            areaUtil            = new AreaUtil();
            subareaUtil         = new SubAreaUtil();
            appointmentTypeUtil = new AppointmentTypeUtil();
            currencyUtil        = new CurrencyUtil();
            dateFormatUtil      = new DateFormatUtil();
            documentTypeUtil    = new DocumentTypeUtil();
            languageUtil        = new LanguageUtil();
            religionUtil        = new ReligionUtil();
            nationalityUtil     = new NationalityUtil();
            sourceUtil          = new SourceUtil();
            durationDaysUtil    = new DurationDaysUtil();
            packageUtil         = new PackageUtil();

            // scoreColumnUtil = new ScoreColumnUtil();
            timeFormatUtil  = new TimeFormatUtil();
            industryUtil    = new IndustryUtil();
            paymentModeUtil = new PaymentModeUtil();
            applicationTemplatePlaceHolderUtil = new ApplicationTemplatePlaceHolderUtil();
        }
Пример #3
0
        /// <summary>
        /// Process the page in aspFile string. Pagepath is only used for getting included files.
        /// </summary>
        /// <param name="pagePath"></param>
        /// <param name="aspFile"></param>
        /// <param name="virtualRootPath">Physical path of the virtual root used when this class is used
        public void processPage(string pagePath, string aspFile, string virtualRootPath)
        {
            _virtualRootPath = virtualRootPath;
            Dlrsoft.VBScript.Compiler.Range[] lineRanges = SourceUtil.GetLineRanges(aspFile);
            const string    pattern = "<%(?<contents>.*?)%>|<!--\\s*#include\\s+(?<contents>.*?)\\s*-->|<script[^>]+runat=\"?server\"?[^>]*>(?<contents>.*?)</script>";
            Regex           r       = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Singleline);
            MatchCollection ms      = r.Matches(aspFile);

            int p1 = 0;
            int p2 = 0;

            foreach (Match m in ms)
            {
                p2 = m.Index;
                if (p2 - p1 > 0)
                {
                    appendBlock(pagePath, SourceUtil.GetSpan(lineRanges, p1, p2 - 1), GetListeral(aspFile, p1, p2), 1);
                }
                p1 = m.Index + m.Length;

                string value    = m.Value.Trim();
                string contents = m.Groups["contents"].Value.Trim();

                if (value.StartsWith("<!-"))
                {
                    processInclude(pagePath, contents.ToLower());
                }
                else if (Regex.IsMatch(value, "^<%\\s*@"))
                {
                }
                else
                {
                    string temp = contents.Trim();
                    if (!string.IsNullOrEmpty(temp))
                    {
                        if (temp[0] == '=') //Expression
                        {
                            contents = string.Format("response.Write({0})", temp.Substring(1).Trim());
                            appendBlock(pagePath, SourceUtil.GetSpan(lineRanges, m.Index, p1 - 1), contents, 1);
                        }
                        else
                        {
                            appendBlock(pagePath, SourceUtil.GetSpan(lineRanges, m.Index, p1 - 1), contents, SourceUtil.GetLineCount(contents));
                        }
                    }
                }
            }
            p2 = aspFile.Length;
            if (p2 - p1 > 0)
            {
                appendBlock(pagePath, SourceUtil.GetSpan(lineRanges, p1, p2 - 1), GetListeral(aspFile, p1, p2), 1);
            }
        }
Пример #4
0
        /// <summary>
        /// Process the page in aspFile string. Pagepath is only used for getting included files.
        /// </summary>
        /// <param name="pagePath"></param>
        /// <param name="aspFile"></param>
        /// <param name="virtualRootPath">Physical path of the virtual root used when this class is used
        public void processPage(string pagePath, string aspFile, string virtualRootPath)
        {
            _virtualRootPath = virtualRootPath;
            Range[]         lineRanges = SourceUtil.GetLineRanges(aspFile);
            const string    pattern    = "<%(?<contents>.*?)%>|<!--\\s*#include\\s+(?<contents>.*?)\\s*-->|<script[^>]+runat=\"?server\"?[^>]*>(?<contents>.*?)</script>";
            Regex           r          = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Singleline);
            MatchCollection ms         = r.Matches(aspFile);
            int             p1         = 0;
            int             p2         = 0;

            foreach (Match m in ms)
            {
                p2 = m.Index;
                if (p2 - p1 > 0)
                {
                    appendBlock(pagePath, SourceUtil.GetSpan(lineRanges, p1, p2 - 1), GetListeral(aspFile, p1, p2), 1);
                }
                p1 = m.Index + m.Length;
                string value    = m.Value;
                string contents = m.Groups["contents"].Value;
                switch (value.Substring(0, 3))
                {
                case "<!-":     //Include
                    processInclude(pagePath, contents.ToLower(), SourceUtil.GetSpan(lineRanges, m.Index, p1 - 1), value);
                    break;

                case "<%@":     //Declaration. Ignore
                    break;

                default:
                    string temp = contents.Trim();
                    if (!string.IsNullOrEmpty(temp))
                    {
                        if (temp[0] == '=')                                           //Expression
                        {
                            contents = "@Html.Raw(" + temp.Substring(1).Trim() + ")"; //string.Format("response.Write({0})", temp.Substring(1).Trim());
                            appendBlock(pagePath, SourceUtil.GetSpan(lineRanges, m.Index, p1 - 1), contents, 1);
                        }
                        else
                        {
                            if (ProcessCode != null)
                            {
                                contents = ProcessCode(contents);
                            }

                            var preceeding = m.Index > 0 ? aspFile.Substring(m.Index - 1, 1) : " ";
                            var codePrefix = (Regex.IsMatch(preceeding, @"\s|[>='\""]") ? "" : " ")
                                             + "@Code";

                            if (!contents.StartsWith(" "))
                            {
                                codePrefix += " ";
                            }
                            contents = codePrefix + contents;

                            if (!contents.EndsWith("\n") && !contents.EndsWith(" "))
                            {
                                contents += " ";
                            }

                            contents += "End Code";
                            var nextChar  = m.Index + m.Length;
                            var following = nextChar < aspFile.Length ? aspFile.Substring(m.Index + m.Length, 1) : " ";
                            contents += (Regex.IsMatch(following, @"\s|['\""&<]") ? "" : " ");
                            appendBlock(pagePath, SourceUtil.GetSpan(lineRanges, m.Index, p1 - 1), contents, SourceUtil.GetLineCount(contents));
                        }
                    }
                    break;
                }
            }
            p2 = aspFile.Length;
            if (p2 - p1 > 0)
            {
                appendBlock(pagePath, SourceUtil.GetSpan(lineRanges, p1, p2 - 1), GetListeral(aspFile, p1, p2), 1);
            }
        }
Пример #5
0
        ParseFileToLambda(string filename, TextReader reader)
        {
            var scanner    = new VB.Scanner(reader);
            var errorTable = new List <VB.SyntaxError>();

            var block = new VB.Parser().ParseScriptFile(scanner, errorTable);

            if (errorTable.Count > 0)
            {
                List <VBScriptSyntaxError> errors = new List <VBScriptSyntaxError>();
                foreach (VB.SyntaxError error in errorTable)
                {
                    errors.Add(new VBScriptSyntaxError(
                                   filename,
                                   SourceUtil.ConvertSpan(error.Span),
                                   (int)error.Type,
                                   error.Type.ToString())
                               );
                }
                throw new VBScriptCompilerException(errors);
            }

            VBScriptSourceCodeReader sourceReader = reader as VBScriptSourceCodeReader;
            ISourceMapper            mapper       = null;

            if (sourceReader != null)
            {
                mapper = sourceReader.SourceMapper;
            }

            var scope = new AnalysisScope(
                null,
                filename,
                this,
                Expression.Parameter(typeof(VBScript), "vbscriptRuntime"),
                Expression.Parameter(typeof(IDynamicMetaObjectProvider), "fileModule"),
                mapper);

            //Generate function table
            List <Expression> body = new List <Expression>();

            //Add the built in globals
            ParameterExpression err = Expression.Parameter(typeof(ErrObject), ERR_PARAMETER);

            scope.Names.Add(ERR_PARAMETER, err);
            body.Add(
                Expression.Assign(
                    err,
                    Expression.New(typeof(ErrObject))
                    )
                );

            if (Trace)
            {
                ParameterExpression trace = Expression.Parameter(typeof(ITrace), TRACE_PARAMETER);
                scope.Names.Add(TRACE_PARAMETER, trace);
                body.Add(
                    Expression.Assign(
                        trace,
                        Expression.Convert(
                            Expression.Dynamic(
                                scope.GetRuntime().GetGetMemberBinder(TRACE_PARAMETER),
                                typeof(object),
                                scope.GetModuleExpr()
                                ),
                            typeof(ITrace)
                            )
                        )
                    );
            }

            //Put module variables and functions into the scope
            VBScriptAnalyzer.AnalyzeFile(block, scope);

            //Generate the module level code other than the methods:
            if (block.Statements != null)
            {
                foreach (var s in block.Statements)
                {
                    if (s is VB.MethodDeclaration)
                    {
                        //Make sure methods are created first before being executed
                        body.Insert(0, VBScriptGenerator.GenerateExpr(s, scope));
                    }
                    else
                    {
                        Expression stmt = VBScriptGenerator.GenerateExpr(s, scope);
                        if (scope.VariableScope.IsOnErrorResumeNextOn)
                        {
                            stmt = VBScriptGenerator.WrapTryCatchExpression(stmt, scope);
                        }
                        Expression debugInfo      = null;
                        Expression clearDebugInfo = null;
                        if (Trace && s is VB.Statement && !(s is VB.BlockStatement))
                        {
                            debugInfo = VBScriptGenerator.GenerateDebugInfo(s, scope, out clearDebugInfo);
                            body.Add(debugInfo);
                        }

                        body.Add(stmt);

                        if (clearDebugInfo != null)
                        {
                            body.Add(clearDebugInfo);
                        }
                    }
                }
            }

            body.Add(Expression.Constant(null)); //Stop anything from returning

            if (scope.Errors.Count > 0)
            {
                throw new VBScriptCompilerException(scope.Errors);
            }

            //if (Debug)
            //{
            //    Expression registerRuntimeVariables = VBScriptGenerator.GenerateRuntimeVariablesExpression(scope);

            //    body.Insert(0, registerRuntimeVariables);
            //}

            var moduleFun = Expression.Lambda <Action <VBScript, IDynamicMetaObjectProvider> >(
                Expression.Block(
                    scope.Names.Values,
                    body),
                scope.RuntimeExpr,
                scope.ModuleExpr);

            //if (!Debug)
            //{
            return(moduleFun.Compile());
            //}
            //else
            //{
            //    Expression<Action<VBScript, IDynamicMetaObjectProvider>> lambda =  (Expression<Action<VBScript, IDynamicMetaObjectProvider>>)DebugContext.TransformLambda(moduleFun);
            //    return lambda.Compile();
            //}
        }