Exemplo n.º 1
0
        public OrddtlAdapter(IProgressConnection connection) : base(connection)
        {
            try
            {
                this.proxyAppObject = new TWLProxyAppObject(connection.Connection);
                this.pdsContext     = new pdsContextDataSet();
                this.dataSet        = new pdsorddtlDataSet()
                {
                    DataSetName = DataSetName
                };
                this.orddtlTableControlKey = this.dataSet.ttblorddtl.GetTableControlParametersKey();

                if (!this.tempTableControlParameters.ContainsKey(this.orddtlTableControlKey))
                {
                    this.CreateTableControlParameters(this.orddtlTableControlKey);
                }
                this.OnCreated();
            }
            catch (Exception ex)
            {
                NLogLogger.ErrorException("Failed in adapter ", ex);
                ErrorReportingHelper.ReportProgramErrors($"Error in OrddtlAdapter constructor - {ex.Message}");
            }
        }
Exemplo n.º 2
0
        public void TestException(int type)
        {
            switch (type)
            {
            case 401:
                ErrorReportingHelper.ReportErrors("SESSION ID NOT FOUND IN CORE_SESSION");
                break;

            case 420:
                ErrorReportingHelper.ReportErrors("420 Error");
                break;

            case 421:
                ErrorReportingHelper.ReportErrors("421 Error", 421);
                break;

            case 500:
                throw new DivideByZeroException();

            default:
                ErrorReportingHelper.ReportProgramErrors("Invalid exception");
                break;
            }
        }
Exemplo n.º 3
0
        public string GetViewPathFromId(string id = "")
        {
            string path = null;

            // The viewId is stored in the json of the default view files. To match the viewId with the file path
            // we need to read files until we find a match.

            // Get directory to search for the file (we know the module from the 1st piece of the viewId so we can narrow the search down)
            var module     = (id.IndexOf('-') > 0) ? id.Substring(0, id.IndexOf('-')) : "";
            var absDirPath = PathHelpers.CleanPath(this._currentBasePath + "modules\\", module);

            if (string.IsNullOrEmpty(absDirPath))
            {
                ErrorReportingHelper.ReportProgramErrors("Attempt to traverse outside allowed bounds ({id})");
                return(string.Empty);
            }

            // Get list of json view files
            var files = Directory.GetFiles(absDirPath, "*.json", SearchOption.AllDirectories);

            // Check each file
            foreach (var fileName in files)
            {
                var json = File.ReadAllText(fileName, Encoding.UTF8);

                // If found the file, then return the relative path
                if (id == GetViewId(json))
                {
                    path = fileName.Replace("\\", "/");
                    path = path.Substring(path.LastIndexOf(BaseModulesPath, StringComparison.Ordinal) + 15);
                    break;
                }
            }

            return(path);
        }
Exemplo n.º 4
0
        public EventSetupLstActnAdapter(IProgressConnection connection) : base(connection)
        {
            try
            {
                this.proxyAppObject = new SharedProxyAppObject(connection.Connection);
                this.pdsContext     = new pdsContextDataSet();
                this.dataSet        = new pdsevent_setup_lst_actnDataSet()
                {
                    DataSetName = DataSetName
                };
                this.eventSetupLstActnTableControlKey = this.dataSet.ttblevent_setup_lst_actn.GetTableControlParametersKey();

                if (!this.tempTableControlParameters.ContainsKey(this.eventSetupLstActnTableControlKey))
                {
                    this.CreateTableControlParameters(this.eventSetupLstActnTableControlKey);
                }
                this.OnCreated();
            }
            catch (Exception ex)
            {
                NLogLogger.ErrorException("Failed in adapter ", ex);
                ErrorReportingHelper.ReportProgramErrors($"Error in EventSetupLstActnAdapter constructor - {ex.Message}");
            }
        }