private bool CreateView(int jobkeycode, GetDataService service, string _bbFieldsPath)
        {
            try
            {
                if (File.Exists(_bbFieldsPath))
                {
                    CreateOrUpdateViewDefinitionRequest createRequest = new CreateOrUpdateViewDefinitionRequest();
                    ViewOptions viewOptions = new ViewOptions();
                    viewOptions.dateFormat = DateFormat.yyyymmdd;
                    createRequest.viewOptions = viewOptions;
                    createRequest.viewName = "BamGenevaView";

                    if (!_bbFieldsPath.Equals(String.Empty))
                    {
                        xdocBbFields = new XmlDocument();
                        xdocBbFields.Load(_bbFieldsPath);
                    }

                    Field[] fields = null;
                    if (xdocBbFields.DocumentElement.ChildNodes != null && xdocBbFields.DocumentElement.ChildNodes.Count > 0)
                    {
                        int i = 0;
                        fields = new Field[xdocBbFields.DocumentElement.ChildNodes.Count];
                        foreach (XmlNode field in xdocBbFields.DocumentElement.ChildNodes)
                        {
                            fields[i] = new Field();
                            fields[i].mnemonic = field.Attributes["name"].Value.ToString();
                            fields[i].overrideSpecified = Convert.ToBoolean(field.Attributes["overrideSpecified"].Value.ToString());
                            fields[i].@override = Convert.ToBoolean(field.Attributes["override"].Value.ToString());
                            i++;
                        }
                    }

                    createRequest.fields = fields;

                    CreateOrUpdateViewDefinitionResponse createResponse = service.createViewDefinition(createRequest);
                    Console.Write("Create View Status Description: " + createResponse.statusCodes.description + "\n");
                    Console.Write("Create View RequestId: " + createResponse.dlwsHeader.dlwsRequestId + "\n\n");
                }
                else
                    throw new Exception(String.Format("Bbg fields file does not exist at {0}", _bbFieldsPath));
            }
            catch (Exception ex)
            {
                log.Error(jobkeycode, ex);
                return false;
            }
            return true;
        }
Beispiel #2
0
        private void CreateView(GetDataService service, string _bbFieldsPath)
        {
            CreateOrUpdateViewDefinitionRequest createRequest = new CreateOrUpdateViewDefinitionRequest();
            ViewOptions viewOptions = new ViewOptions();
            viewOptions.dateFormat = DateFormat.yyyymmdd;
            createRequest.viewOptions = viewOptions;
            createRequest.viewName = "BamGenevaView";

            if (!_bbFieldsPath.Equals(String.Empty))
            {
                xdocBbFields = new XmlDocument();
                xdocBbFields.Load(_bbFieldsPath);
            }

            Field[] fields = null;
            if (xdocBbFields.DocumentElement.ChildNodes != null && xdocBbFields.DocumentElement.ChildNodes.Count > 0)
            {
                int i = 0;
                fields = new Field[xdocBbFields.DocumentElement.ChildNodes.Count];
                foreach (XmlNode field in xdocBbFields.DocumentElement.ChildNodes)
                {
                    fields[i] = new Field();
                    fields[i].mnemonic = field.Attributes["name"].Value.ToString();
                    fields[i].overrideSpecified = Convert.ToBoolean(field.Attributes["overrideSpecified"].Value.ToString());
                    fields[i].@override = Convert.ToBoolean(field.Attributes["override"].Value.ToString());
                    i++;
                }
            }

            createRequest.fields = fields;

            CreateOrUpdateViewDefinitionResponse createResponse = service.createViewDefinition(createRequest);
            Console.Write("Create View Status Description: " + createResponse.statusCodes.description + "\n");
            Console.Write("Create View RequestId: " + createResponse.dlwsHeader.dlwsRequestId + "\n\n");
        }