public QueryRecordExecutor(Cluster cluster, QueryPolicy policy, Statement statement)
     : base(cluster, policy, statement)
 {
     this.recordSet = new RecordSet(this, policy.recordQueueSize, cancel.Token);
     statement.Prepare(true);
     InitializeThreads();
 }
Exemplo n.º 2
0
 public override bool Select(string SQL)
 {
     pErrorMsg = "No error";
     pErrorCode = 0;
     try
     {
         SqlCeCommand command = new SqlCeCommand(SQL, DataBasePDA.Get());
         RecordSet Set = new RecordSet(command.ExecuteReader());
         Set.Next();
         string[] fields = Set.Fileds();
         Rows = new List<DataRows>();
         while(!Set.Eof)
         {
             DataRows row = new DataRows();
             foreach (string fieldname in fields)
             {
                 row.AddField(new DataField(fieldname, Set.FieldByName(fieldname)));
             }
             Rows.Add(row);
             Set.Next();
         }
     }
     catch(Exception ex)
     {
         pErrorMsg = ex.Message;
         pErrorCode = 1;
         throw;
         //return false;
     }
     return true;
 }
Exemplo n.º 3
0
 public void Print(RecordSet data, string fileName)
 {
     IReportGen gen = new TecITGener();
     this.filePath = this.folderPath+"/"+fileName;
     this.taskConfig.Printer += filePath;
     gen.Print(data, this.taskConfig);
 }
Exemplo n.º 4
0
        //────────────────────────────────────────
        /// <summary>
        /// レコードセットを、一時記憶。
        /// </summary>
        /// <param name="p3_RecordSet"></param>
        /// <param name="RecordSetSaveTo_or_null"></param>
        /// <param name="log_Reports"></param>
        public void P4_Save(
            RecordSet recordSet_toSave,
            Expressionv_4ASelectRecord ecvRequest_SelRec_OrNull,//where
            Log_Reports log_Reports
            )
        {
            if (null != ecvRequest_SelRec_OrNull)
            {
                //
                // "RECORD_SAVE_TO:FC_mr_skillLst_001" といった、名前。
                string sStorage = ecvRequest_SelRec_OrNull.Expression_Storage.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                if ("" != sStorage.Trim())
                {
                    //
                    // 内容のコピー。
                    //p3_Selectstatement.NFld = nRequest_saveTo_orNull.NField;
                    //p3_Selectstatement.NLookupValue = nRequest_saveTo_orNull.NLookupValue;
                    //p3_Selectstatement.NRequired = nRequest_saveTo_orNull.NRequired;
                    //p3_Selectstatement.NFrom = nRequest_saveTo_orNull.NFrom;
                    //p3_Selectstatement.NStorage = nRequest_saveTo_orNull.NStorage;
                    //p3_Selectstatement.NDescription = nRequest_saveTo_orNull.NDescription;

                    //
                    // レコードセットを一時記憶。
                    this.Owner_MemoryApplication.MemoryRecordset.RecordsetStorage.Add(
                        ecvRequest_SelRec_OrNull.Expression_Storage,
                        recordSet_toSave,// p3_Selectstatement,
                        this.Owner_MemoryApplication,
                        log_Reports);
                }
            }
        }
        /// <summary>
        /// Populates this feed instance with the contents of the record set, based upon the passed in property set
        /// </summary>
        /// <param name="results">The results.</param>
        /// <param name="exportProperties">The export properties.</param>
        public void CreateExport(RecordSet results, IExportProperties exportProperties)
        {
            GeoRSSExportProperties feedProperties = (GeoRSSExportProperties)exportProperties;

            //add the georss namespace
            this.AttributeExtensions.Add(new XmlQualifiedName(GEORSS_NS_PREFIX, XML_NS), GEORSS_NS);

            //if the geometry type is gml then also add the GML namespace
            if (feedProperties.GeometryFormat == "GML")
                this.AttributeExtensions.Add(new XmlQualifiedName(GML_NS_PREFIX, XML_NS), GML_NS);

            //set up feed level properties
            this.Authors.Add(feedProperties.Author);
            this.Copyright = new TextSyndicationContent(feedProperties.CopyRight);
            this.Description = new TextSyndicationContent(feedProperties.Description);
            this.Generator = feedProperties.Generator;
            this.Id = Guid.NewGuid().ToString();
            this.Language = feedProperties.Language;
            this.Links.Add(feedProperties.Link);
            this.Title = new TextSyndicationContent(feedProperties.Title);

            //set up the item collection for the feed
            List<SyndicationItem> items = CreateItemCollection(results, feedProperties);
            this.Items = items;
        }
Exemplo n.º 6
0
        public void Print(RecordSet records, ReportGenConfig config)
        {
            if (records == null | config == null)
            {
                throw new ArgumentNullException("打印参数或打印数据不能为空");
            }

            try
            {
                TECITLicense.Register();
            }
            catch (Exception ex)
            {
                throw new ReportGenLicenseException(ex);
            }

            Job job = default(Job);
            JobDataRecordSet jobdata = default(JobDataRecordSet);
            job = new Job();
            jobdata = new JobDataRecordSet();
            job.JobData = jobdata;
            job.RepositoryName = config.Template;
            job.PrinterName = config.Printer;
            job.PrinterType = config.PrinterType;
            job.NumberOfCopies = config.NumberOfCopies;
            for (int i = 0; i <= records.Count - 1; i++)
            {
                Record rec = new Record();
                foreach (KeyValuePair<string, string> ent in records[i])
                {
                    rec.Data.Add(ent.Key, ent.Value);
                }
                jobdata.Records.Add(rec);
            }

            try
            {
                job.Print();
                job.Dispose();
            }
            catch (TFORMerException ex)
            {
                if (ex.ErrorCode == 13)
                {
                    throw new ReportTypeException(ex);
                }
                else { throw new ReportPrintException(ex); }
            }
            catch (Exception ex)
            {
                throw new ReportPrintException(ex);
            }
            finally {
                if (job != null)
                    job.Dispose();
            }
        }
Exemplo n.º 7
0
 private static void FillEmptyRecordsForType(RecordSet properties, RecordType recordType)
 {
     properties.AaaaRecords = recordType == RecordType.AAAA ? new List <Sdk.AaaaRecord>() : null;
     properties.ARecords    = recordType == RecordType.A ? new List <Sdk.ARecord>() : null;
     properties.CnameRecord = recordType == RecordType.CNAME ? new Sdk.CnameRecord(string.Empty) : null;
     properties.MxRecords   = recordType == RecordType.MX ? new List <Sdk.MxRecord>() : null;
     properties.PtrRecords  = recordType == RecordType.PTR ? new List <Sdk.PtrRecord>() : null;
     properties.SoaRecord   = null;
     properties.SrvRecords  = recordType == RecordType.SRV ? new List <Sdk.SrvRecord>() : null;
     properties.TxtRecords  = recordType == RecordType.TXT ? new List <Sdk.TxtRecord>() : null;
 }
Exemplo n.º 8
0
        public static RecordSet getUnitTestRecordSet3()
        {
            Record            record = getUnitTestRecord1();
            List <RecordData> data   = new List <RecordData>();

            data.Add(record.Data);

            RecordSet rs = new RecordSet(record.Structure, data);

            return(rs);
        }
Exemplo n.º 9
0
        public void QueryExecuteOperate()
        {
            int begin = 3;
            int end   = 9;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(args.set);
            stmt.SetFilter(Filter.Range(binName1, begin, end));

            Bin bin = new Bin("foo", "bar");

            ExecuteTask task = client.Execute(null, stmt, Operation.Put(bin));

            task.Wait(3000, 3000);

            string expected = bin.value.ToString();

            stmt = new Statement();
            stmt.SetNamespace(args.ns);
            stmt.SetSetName(args.set);
            stmt.SetFilter(Filter.Range(binName1, begin, end));

            RecordSet rs = client.Query(null, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    Record record = rs.Record;
                    string value  = record.GetString(bin.name);

                    if (value == null)
                    {
                        Assert.Fail("Bin " + bin.name + " not found");
                    }

                    if (!value.Equals(expected))
                    {
                        Assert.Fail("Data mismatch. Expected " + expected + ". Received " + value);
                    }
                    count++;
                }
                Assert.AreEqual(end - begin + 1, count);
            }
            finally
            {
                rs.Close();
            }
        }
Exemplo n.º 10
0
 private string[] ParseAdresses(RecordSet set, FlatRecordType type)
 {
     if (type == FlatRecordType.A)
     {
         return(set.ARecords.Select(x => x.Ipv4Address).ToArray());
     }
     if (type == FlatRecordType.AAAA)
     {
         return(set.AaaaRecords.Select(x => x.Ipv6Address).ToArray());
     }
     throw null;
 }
        public void RecordSetByZoneIdTest()
        {
            Template template      = StackTest.GetNewBlankTemplateWithVpc($"Vpc{this.TestContext.TestName}");
            string   recordSetName = $"A{DateTime.Now.Ticks.ToString().Substring(10, 5)}";

            recordSetName = "abc";
            var target = RecordSet.AddByHostedZoneId(template, recordSetName, "Z1H285MI71YUD0", recordSetName + ".sircupsalot.com.", RecordSet.RecordSetTypeEnum.A);

            target.RecordSetType = RecordSet.RecordSetTypeEnum.A.ToString();
            target.AddResourceRecord("206.190.36.45");
            StackTest.CreateTestStack(template, this.TestContext);
        }
Exemplo n.º 12
0
        public RecordSetWasUpdated(
            DomainName domainName,
            RecordSet recordSet)
        {
            DomainName        = domainName;
            SecondLevelDomain = domainName.SecondLevelDomain;
            TopLevelDomain    = domainName.TopLevelDomain.Value;

            Records = recordSet
                      .Select(r => new RecordData(r))
                      .ToArray();
        }
Exemplo n.º 13
0
        public override List <String> GetFeatureIDs(string where, IGeometry shape)
        {
            CheckIsFeatureLayer();
            CheckHasFeatureIDField();

            SpatialFilter spatialFilter = new SpatialFilter(shape, FeatureIDField.Name, where);

            spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
            RecordSet recordSet = _service.MapServer.QueryFeatureData(DataFrame.Name, _mapLayerInfo.LayerID, spatialFilter);

            return(RecordSetToIds(recordSet));
        }
Exemplo n.º 14
0
 private void FillEmptyRecordsForType(RecordSet properties, RecordType recordType)
 {
     properties.AaaaRecords = recordType == RecordType.AAAA ? new List <Management.Dns.Models.AaaaRecord>() : null;
     properties.ARecords    = recordType == RecordType.A ? new List <Management.Dns.Models.ARecord>() : null;
     properties.CnameRecord = recordType == RecordType.CNAME ? new Management.Dns.Models.CnameRecord(String.Empty) : null;
     properties.MxRecords   = recordType == RecordType.MX ? new List <Management.Dns.Models.MxRecord>() : null;
     properties.NsRecords   = recordType == RecordType.NS ? new List <Management.Dns.Models.NsRecord>() : null;
     properties.PtrRecords  = recordType == RecordType.PTR ? new List <Management.Dns.Models.PtrRecord>() : null;
     properties.SoaRecord   = null;
     properties.SrvRecords  = recordType == RecordType.SRV ? new List <Management.Dns.Models.SrvRecord>() : null;
     properties.TxtRecords  = recordType == RecordType.TXT ? new List <Management.Dns.Models.TxtRecord>() : null;
 }
Exemplo n.º 15
0
        public override DataTable GetFeatureTable(string fieldNames, string where, IGeometry shape)
        {
            CheckIsFeatureLayer();

            FieldSelection fieldSelection = new FieldSelection(this, fieldNames);
            SpatialFilter  spatialFilter  = new SpatialFilter(shape, fieldSelection.NamesToString(), where);

            spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
            RecordSet recordSet = _service.MapServer.QueryFeatureData(DataFrame.Name, _mapLayerInfo.LayerID, spatialFilter);

            return(RecordSetToTable(recordSet, fieldSelection));
        }
Exemplo n.º 16
0
        public Task UpdateRecordSetAsync(FlatRecordSet set, List <FlatTargetRecord> addresses)
        {
            // If I ever find someone doing this in prod code, I'll be unhappy :P
            string[] s = set.ID.Split('/');

            RecordType recordType = set.RecordType.ToAzureDnsRecordSet();

            RecordSet record = BuildRecordSet(set, addresses);

            // ETag will throw here
            return(_dnsClient.RecordSets.UpdateAsync(s[4], s[8], s[10], recordType, record, set.ETag));
        }
Exemplo n.º 17
0
 public void Print(RecordSet data,string printer_name=null,string copy=null)
 {
     IReportGen gen = new TecITGener();
     ReportGenConfig config = new ReportGenConfig()
     {
         Printer = string.IsNullOrEmpty(printer_name) ? this.Name : printer_name,
         NumberOfCopies = string.IsNullOrEmpty(copy) ? this.Copy : int.Parse(copy),
         PrinterType = (PrinterType)this.Type,
         Template = this.TemplatePath
     };
     gen.Print(data, config);
 }
Exemplo n.º 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var incomingMessage = new IncomingMessage(HttpContext.Current);
        //var data = Request["_text"].Base64ToString();
        //var _queue = Request["_queue"].Base64ToString();
        //var _manager = Request["_manager"].Base64ToString();
        //var _host = Request["_host"].Base64ToString();
        //var _messageID = Request["_messageID"].Base64ToString();
        //var _correlationID = Request["_correlationID"].Base64ToString();


        //var data = incomingMessage.Message;
        //var _queue = incomingMessage.QueuName;
        //var _manager = incomingMessage.ManagerName;
        //var _host = incomingMessage.Host;
        //var _messageID = incomingMessage.MessageId;
        //var _correlationID = incomingMessage.MessageCorrelationId;

        var message = incomingMessage.Message;

        if (string.IsNullOrEmpty(message))
        {
            return;
        }
        message = message.Replace("ns0:", "esb:");

        var dataset = new RecordSet();

        dataset.ReadXml(new StringReader(message));

        if (dataset.HasRows)
        {
            if (dataset.Tables.Contains("MessageIdentification") &&
                dataset.Tables.Contains("ApplicationInformationResult"))
            {
                var messageIdentification        = dataset.Tables["MessageIdentification"];
                var applicationInformationResult = dataset.Tables["ApplicationInformationResult"];

                Guid universalUniqueId;
                if (Guid.TryParse(messageIdentification.Rows[0]["universalUniqueID"].ToString(), out universalUniqueId))
                {
                    FDR.DataLayer.DBWriteManager.Insert_OutgoingPackageAuditTrail
                    (
                        universalUniqueId,
                        null,
                        string.Format("Queue({0}) - {1}", incomingMessage.QueuName,
                                      applicationInformationResult.Rows[0]["Description"])
                    );
                }
            }
        }
    }
        private void ValidateRecords()
        {
            int begin = 1;
            int end   = size + 100;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(args.set);
            stmt.SetFilters(Filter.Range(binName1, begin, end));

            RecordSet rs = client.Query(null, stmt);

            try
            {
                int[] expectedList = new int[] { 1, 2, 3, 104, 5, 106, 7, 108, -1, 10 };
                int   expectedSize = size - 1;
                int   count        = 0;

                while (rs.Next())
                {
                    Record record = rs.Record;
                    int    value1 = record.GetInt(binName1);
                    int    value2 = record.GetInt(binName2);

                    int val1 = value1;

                    if (val1 == 9)
                    {
                        Assert.Fail("Data mismatch. value1 " + val1 + " should not exist");
                    }

                    if (val1 == 5)
                    {
                        if (value2 != 0)
                        {
                            Assert.Fail("Data mismatch. value2 " + value2 + " should be null");
                        }
                    }
                    else if (value1 != expectedList[value2 - 1])
                    {
                        Assert.Fail("Data mismatch. Expected " + expectedList[value2 - 1] + ". Received " + value1);
                    }
                    count++;
                }
                Assert.AreEqual(expectedSize, count);
            }
            finally
            {
                rs.Close();
            }
        }
Exemplo n.º 20
0
        public static RecordSet ProjectRecordSet(Envelope env, RecordSet rs, int geomFieldIndex, SpatialReference inSR, SpatialReference outSR)
        {
            MapServiceFidTests._dbgGeomServer     = new Geometry_GeometryServer();
            MapServiceFidTests._dbgGeomServer.Url = "http://mashup/ArcGIS/services/Geometry/GeometryServer";
            MapServiceFidTests.dbgInSR            = inSR;
            MapServiceFidTests.dbgOutSR           = outSR;
            MapServiceFidTests.dbgEnv             = env;
            if (geomFieldIndex < 0)
            {
                return(null);
            }
            if (rs == null)
            {
                return(null);
            }
            if (inSR == null || outSR == null)
            {
                return(rs);
            }
            RecordSet result;

            try
            {
                List <Geometry> list    = new List <Geometry>(rs.Records.Length);
                Record[]        records = rs.Records;
                for (int i = 0; i < records.Length; i++)
                {
                    Record   record   = records[i];
                    Geometry geometry = record.Values[geomFieldIndex] as Geometry;
                    if (geometry != null)
                    {
                        list.Add(geometry);
                    }
                }
                Geometry[] inGeometryArray = list.ToArray();
                Geometry[] array           = MapServiceFidTests._dbgGeomServer.Project(MapServiceFidTests.dbgInSR, MapServiceFidTests.dbgOutSR, false, null, MapServiceFidTests.dbgEnv, inGeometryArray);
                int        num             = 0;
                Record[]   records2        = rs.Records;
                for (int j = 0; j < records2.Length; j++)
                {
                    Record record2 = records2[j];
                    record2.Values[geomFieldIndex] = array[num++];
                }
                result = rs;
            }
            catch (Exception ex)
            {
                string arg_F2_0 = ex.Message;
                result = rs;
            }
            return(result);
        }
Exemplo n.º 21
0
        public static RecordSet GetSubmissions(string taxRefNo = null, string year = null)
        {
            var oParams = new DBParamCollection
            {
                { "@TaxRefNo", taxRefNo },
                { "@Year", year }
            };

            using (var data = new RecordSet("[dbo].[uspREAD_FileSubmissions_All]", QueryType.StoredProcedure, oParams))
            {
                return(data);
            }
        }
Exemplo n.º 22
0
        public async Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, IEnumerable <string> values)
        {
            var resourceGroup = ExtractResourceGroup(zone.Id);

            // TXT レコードに TTL と値をセットする
            var recordSet = new RecordSet
            {
                TTL        = 60,
                TxtRecords = values.Select(x => new TxtRecord(new[] { x })).ToArray()
            };

            await _dnsManagementClient.RecordSets.CreateOrUpdateAsync(resourceGroup, zone.Name, relativeRecordName, RecordType.TXT, recordSet);
        }
Exemplo n.º 23
0
 public static SpatialReference getSR(Layer layer, RecordSet metadata)
 {
     if (metadata.Crs == null || metadata.Crs == "")
     {
         SpatialReference crs = layer.GetSpatialRef();
         if (crs != null)
         {
             return(crs);
         }
         return(AppState.instance.projectCrs);
     }
     return(Convert.TextToSR(metadata.Crs));
 }
Exemplo n.º 24
0
        private void LoadData()
        {
            cboBuyer.Items.Clear();
            cboBuyer.Items.Insert(0, new ListItem("Select", "0"));
            RecordSet rs = Company.GetBuyerCompanyList();

            while (!rs.EOF())
            {
                ListItem listItem = new ListItem(rs["CompanyName"].ToString(), rs["CompanyID"].ToString());
                cboBuyer.Items.Add(listItem);
                rs.MoveNext();
            }
        }
Exemplo n.º 25
0
 internal MultiColumnDropDown(C1.Win.C1FlexGrid.C1FlexGrid grid, int row, int col, RecordSet rs, string GetFieldName1, string LabelID)
 {
     _ctl         = grid;
     _row         = row;
     _col         = col;
     SetField2    = "";
     Field1       = GetFieldName1;
     Field2       = "";
     this.rs      = rs;
     this.LabelID = LabelID;
     _cols        = rs.cols;
     Init();
 }
Exemplo n.º 26
0
        public void Print(RecordSet data, string printer_name = null, string copy = null)
        {
            IReportGen      gen    = new TecITGener();
            ReportGenConfig config = new ReportGenConfig()
            {
                Printer        = string.IsNullOrEmpty(printer_name) ? this.Name : printer_name,
                NumberOfCopies = string.IsNullOrEmpty(copy) ? this.Copy : int.Parse(copy),
                PrinterType    = (PrinterType)this.Type,
                Template       = this.TemplatePath
            };

            gen.Print(data, config);
        }
Exemplo n.º 27
0
        public override string ProximaChavePrimaria(DBDataSource dbdts)
        {
            var numPreContrato = dbdts.GetValue(_numeroDoPreContrato.Datasource, 0);

            using (var recordset = new RecordSet())
            {
                var rs = recordset.DoQuery(
                    $@"SELECT 
                        CONVERT(NVARCHAR, {numPreContrato}) + '.' + CONVERT(NVARCHAR, COUNT(*) + 1) as codigo
                    FROM [{dbdts.TableName}] WHERE {_numeroDoPreContrato.Datasource} = {numPreContrato}");
                return(rs.Fields.Item("codigo").Value);
            }
        }
Exemplo n.º 28
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// レコードセットの追加。
        /// </summary>
        /// <param name="eName"></param>
        /// <param name="recordSet"></param>
        /// <param name="log_Reports"></param>
        public void Add(
            Expression_Node_String ec_Name, RecordSet recordSet,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_Expr.Name_Library, this, "Add", log_Reports);
            //
            //

            string sName = ec_Name.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim();

            try
            {
                this.dictionary_Recordset.Add(sName, recordSet);

                //// debug: 追加したレコードセットの内容。
                //{
                //    ystem.Console.WriteLine(Info_N.LibraryName + ":" + this.GetType().Name + "#Add: 追加したレコードセットの内容"+
                //        " fld=["+oRecordSet.NField.E_Execute(EnumHitcount.Unconstraint, log_Reports)+"]" +
                //        " lookup-value=["+oRecordSet.NLookupValue.E_Execute(EnumHitcount.Unconstraint, log_Reports)+"]" +
                //        " required=[" + oRecordSet.NRequired.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" +
                //        " from=[" + oRecordSet.NFrom.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" +
                //        " description=[" + oRecordSet.NDescription.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" +
                //        " Storage=[" + oRecordSet.NStorage.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]"
                //        );

                //}
            }
            catch (ArgumentException ex)
            {
                //return;

                {
                    Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                    tmpl.SetParameter(1, sName, log_Reports);                                                                 //名前
                    tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Name.Cur_Configuration), log_Reports); //設定位置パンくずリスト
                    tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(ex), log_Reports);                            //例外メッセージ

                    memoryApplication.CreateErrorReport("Er:6042;", tmpl, log_Reports);
                }
            }

            //
            //
            //
            //

            log_Method.EndMethod(log_Reports);
        }
Exemplo n.º 29
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("../close_win.aspx");
            }


            invoiceID = 0;
            if (Request.QueryString["InvoiceID"] != null)
            {
                invoiceID         = System.Convert.ToInt32(Request.QueryString["InvoiceID"]);
                ViewState["INID"] = invoiceID.ToString();
                iInvID            = invoiceID.ToString();
            }
            if (invoiceID == 0)
            {
                if (Session["InvoiceID"] != null)
                {
                    invoiceID = (int)Session["InvoiceID"];
                }
            }
            if (invoiceID == 0)
            {
                //prepare invoice head recordset from XML
                if (System.IO.File.Exists(Session["XMLInvoiceHeadFile"].ToString()))
                {
                    DataSet ds = new DataSet();
                    ds.ReadXmlSchema(Session["XSDInvoiceHeadFile"].ToString());
                    ds.ReadXml(Session["XMLInvoiceHeadFile"].ToString());
                    rsInvoiceHead = new RecordSet(ds);
                }
                //prepare invoice detail recordset from XML
                if (System.IO.File.Exists(Session["XSDInvoiceDetailFile"].ToString()))
                {
                    DataSet ds = new DataSet();

                    ds.ReadXmlSchema(Session["XSDInvoiceDetailFile"].ToString());
                    ds.ReadXml(Session["XMLInvoiceDetailFile"].ToString());
                    rsInvoiceDetail = new RecordSet(ds);
                }
                if (!IsPostBack)
                {
                    PopulateData();
                }
            }
            else
            {
                PopulateData(invoiceID);
            }
        }
Exemplo n.º 30
0
        } //scanTweetsCallback

        public void queryTweetsByUsername()
        {
            Console.WriteLine("\n********** Query Tweets By Username **********\n");

            RecordSet rs = null;

            try
            {
                // Get username
                string username;
                Console.WriteLine("\nEnter username:"******"test", "tweets", "username_index", "username", IndexType.STRING);
                    task.Wait();

                    string[]  bins = { "tweet" };
                    Statement stmt = new Statement();
                    stmt.SetNamespace("test");
                    stmt.SetSetName("tweets");
                    stmt.SetIndexName("username_index");
                    stmt.SetBinNames(bins);
                    stmt.SetFilters(Filter.Equal("username", username));

                    Console.WriteLine("\nHere's " + username + "'s tweet(s):\n");

                    rs = client.Query(null, stmt);
                    while (rs.Next())
                    {
                        Record r = rs.Record;
                        Console.WriteLine(r.GetValue("tweet"));
                    }
                }
                else
                {
                    Console.WriteLine("ERROR: User record not found!");
                }
            }
            finally
            {
                if (rs != null)
                {
                    // Close record set
                    rs.Close();
                }
            }
        } //queryTweetsByUsername
Exemplo n.º 31
0
        private void FillRecordsForType(RecordSet properties, RecordType recordType, DnsRecordBase[] resourceRecords)
        {
            switch (recordType)
            {
            case RecordType.A:
                properties.ARecords = resourceRecords.Select(x => (Sdk.ARecord)(x as ARecord).ToMamlRecord()).ToList();
                break;

            case RecordType.AAAA:
                properties.AaaaRecords = resourceRecords.Select(x => (Sdk.AaaaRecord)(x as AaaaRecord).ToMamlRecord()).ToList();
                break;

            case RecordType.CNAME:
                if (resourceRecords.Length > 1)
                {
                    throw new ArgumentException(ProjectResources.Error_AddRecordMultipleCnames);
                }

                properties.CnameRecord = (Sdk.CnameRecord)resourceRecords[0].ToMamlRecord();
                break;

            case RecordType.MX:
                properties.MxRecords = resourceRecords.Select(x => (Sdk.MxRecord)(x as MxRecord).ToMamlRecord()).ToList();
                break;

            case RecordType.NS:
                properties.NsRecords = resourceRecords.Select(x => (Sdk.NsRecord)(x as NsRecord).ToMamlRecord()).ToList();
                break;

            case RecordType.PTR:
                properties.PtrRecords = resourceRecords.Select(x => (Sdk.PtrRecord)(x as PtrRecord).ToMamlRecord()).ToList();
                break;

            case RecordType.SRV:
                properties.SrvRecords = resourceRecords.Select(x => (Sdk.SrvRecord)(x as SrvRecord).ToMamlRecord()).ToList();
                break;

            case RecordType.TXT:
                properties.TxtRecords = resourceRecords.Select(x => (Sdk.TxtRecord)(x as TxtRecord).ToMamlRecord()).ToList();
                break;

            case RecordType.SOA:
                properties.SoaRecord = (Sdk.SoaRecord)resourceRecords[0].ToMamlRecord();
                break;

            case RecordType.CAA:
                properties.CaaRecords = resourceRecords.Select(x => (Sdk.CaaRecord)(x as CaaRecord).ToMamlRecord()).ToList();
                break;
            }
        }
Exemplo n.º 32
0
 public frmSearch3(RecordSet rs, int Cols, string LabelID, string eff_ym, string sub_id1, string sub_id2, string rcv_dt1, string rcv_dt2, string keep_amount)
 {
     this._Cols    = Cols;
     this._rs      = rs;
     this._LabelID = LabelID;
     //	this.sel=false;
     this.eff_ym      = eff_ym;
     this.sub_id1     = sub_id1;
     this.sub_id2     = sub_id2;
     this.rcv_dt1     = rcv_dt1;
     this.rcv_dt2     = rcv_dt2;
     this.keep_amount = keep_amount;
     InitializeComponent();
 }
        public void QueryPredicate1()
        {
            int begin = 10;
            int end   = 45;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(setName);
            stmt.SetFilter(Filter.Range(binName, begin, end));
            stmt.SetPredExp(
                PredExp.IntegerBin("bin2"),
                PredExp.IntegerValue(40),
                PredExp.IntegerGreater(),
                PredExp.IntegerBin("bin2"),
                PredExp.IntegerValue(44),
                PredExp.IntegerLess(),
                PredExp.And(2),
                PredExp.IntegerBin("bin2"),
                PredExp.IntegerValue(22),
                PredExp.IntegerEqual(),
                PredExp.IntegerBin("bin2"),
                PredExp.IntegerValue(9),
                PredExp.IntegerEqual(),
                PredExp.Or(3),
                PredExp.IntegerBin(binName),
                PredExp.IntegerBin("bin2"),
                PredExp.IntegerEqual(),
                PredExp.And(2)
                );

            RecordSet rs = client.Query(null, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    //Console.WriteLine(rs.Record.GetValue(binName));
                    count++;
                }
                // 22, 41, 42, 43
                Assert.AreEqual(4, count);
            }
            finally
            {
                rs.Close();
            }
        }
 public static void CarregarGruposDeItensPermitidos()
 {
     _gruposDeItensPermitidos.Clear();
     using (var recordset = new RecordSet())
     {
         var rs = recordset.DoQuery("SELECT DISTINCT U_ItmsGrpCod FROM [@UPD_OCTC]");
         while (!rs.EoF)
         {
             string grupoDeItem = rs.Fields.Item("U_ItmsGrpCod").Value;
             _gruposDeItensPermitidos.Add(grupoDeItem);
             rs.MoveNext();
         }
     }
 }
Exemplo n.º 35
0
        public async Task DnsUpdateARecordMultiRecord()
        {
            var namespaceName = Recording.GenerateAssetName("sdk-RecordSet");
            var aRecords      = new ChangeTrackingList <ARecord>
            {
                new ARecord {
                    Ipv4Address = "123.32.1.0"
                }
            };
            var recordName     = "a_multi_record";
            var testARecordSet = new RecordSet("test_id", recordName, "A", null, this.metadata, 60, null, null, null, aRecords, this.dummyAaaaRecords, this.dummyMxRecords,
                                               this.dummyNsRecords, this.dummyPtrRecords, this.dummySrvRecords, this.dummyTxtRecords, null, null, this.dummyCaaRecords);

            var createRecordSetResponse = await RecordSetsOperations.CreateOrUpdateAsync(resourceGroup, this.zoneNameForList, recordName, RecordType.A, testARecordSet);

            Assert.True(Helper.AreEqual(createRecordSetResponse, testARecordSet, ignoreEtag: true));
            var getResponseARecord = await RecordSetsOperations.GetAsync(this.resourceGroup, this.zoneNameForList, recordName, RecordType.A);

            var aRecord = getResponseARecord.Value;

            aRecord.TTL = 120; //update TTL from 60 to 120
            aRecord.ARecords.Clear();
            var aList = new List <ARecord>
            {
                new ARecord {
                    Ipv4Address = "123.32.1.0"
                },
                new ARecord {
                    Ipv4Address = "101.10.0.1"
                },
                new ARecord {
                    Ipv4Address = "22.33.44.55"
                },
            };

            ((List <ARecord>)aRecord.ARecords).AddRange(aList);
            var updateResponse = await RecordSetsOperations.CreateOrUpdateAsync(this.resourceGroup, this.zoneNameForList, recordName, RecordType.A, aRecord);

            var updatedRecords = updateResponse.Value;

            Assert.AreEqual(updatedRecords.TTL, 120);
            for (int i = 0; i < aList.Count; i++)
            {
                Assert.True(updatedRecords.ARecords[i].Ipv4Address == aList[i].Ipv4Address);
            }
            Assert.False(string.IsNullOrWhiteSpace(updatedRecords.Etag));
            var deleteRecordSetResponse = await RecordSetsOperations.DeleteAsync(resourceGroup, this.zoneNameForList, recordName, RecordType.A);

            Assert.NotNull(deleteRecordSetResponse);
        }
Exemplo n.º 36
0
        //────────────────────────────────────────
        /// <summary>
        /// レコードセットの追加。
        /// </summary>
        /// <param name="eName"></param>
        /// <param name="recordSet"></param>
        /// <param name="log_Reports"></param>
        public void Add(
            Expression_Node_String ec_Name, RecordSet recordSet,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "Add",log_Reports);
            //
            //

            string sName = ec_Name.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim();

            try
            {
                this.dictionary_Recordset.Add(sName, recordSet);

                //// debug: 追加したレコードセットの内容。
                //{
                //    ystem.Console.WriteLine(Info_N.LibraryName + ":" + this.GetType().Name + "#Add: 追加したレコードセットの内容"+
                //        " fld=["+oRecordSet.NField.E_Execute(EnumHitcount.Unconstraint, log_Reports)+"]" +
                //        " lookup-value=["+oRecordSet.NLookupValue.E_Execute(EnumHitcount.Unconstraint, log_Reports)+"]" +
                //        " required=[" + oRecordSet.NRequired.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" +
                //        " from=[" + oRecordSet.NFrom.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" +
                //        " description=[" + oRecordSet.NDescription.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" +
                //        " Storage=[" + oRecordSet.NStorage.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]"
                //        );

                //}
            }
            catch (ArgumentException ex)
            {
                //return;

                {
                    Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                    tmpl.SetParameter(1, sName, log_Reports);//名前
                    tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Name.Cur_Configuration), log_Reports);//設定位置パンくずリスト
                    tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(ex), log_Reports);//例外メッセージ

                    memoryApplication.CreateErrorReport("Er:6042;", tmpl, log_Reports);
                }
            }

            //
            //
            //
            //

            log_Method.EndMethod(log_Reports);
        }
Exemplo n.º 37
0
        } //scanTweetsCallback

        public void queryTweetsByUsername()
        {
            Console.WriteLine("\n********** Query Tweets By Username **********\n");

            RecordSet rs = null;

            try
            {
                //Birkere çalışması gerekiyor:
                //IndexTask task = client.CreateIndex(null, "test", "tweets", "username_index", "username", IndexType.STRING);
                //task.Wait();

                // Get username
                string username;
                Console.WriteLine("\nEnter username:"******"tweet" };
                    Statement stmt = new Statement();
                    stmt.SetNamespace("test");
                    stmt.SetSetName("tweets");
                    stmt.SetIndexName("username_index");
                    stmt.SetBinNames(bins);
                    stmt.SetFilter(Filter.Equal("username", username));

                    Console.WriteLine("\nHere's " + username + "'s tweet(s):\n");

                    rs = client.Query(null, stmt);
                    while (rs.Next())
                    {
                        Record r = rs.Record;
                        Console.WriteLine(r.GetValue("tweet"));
                    }
                }
                else
                {
                    Console.WriteLine("ERROR: User record not found!");
                }
            }
            finally
            {
                if (rs != null)
                {
                    // Close record set
                    rs.Close();
                }
            }
        } //queryTweetsByUsername
Exemplo n.º 38
0
        public static RecordSet UpdateRecords(RecordSet existingRecordSet, RecordSet requestRecordSet)
        {
            List <Record> listOfRecords = new List <Record>(existingRecordSet);

            Field keyField = (from f in existingRecordSet.Schema.Fields
                              where f.IsKey == true
                              select f).FirstOrDefault();

            if (keyField == null)
            {
                throw new Exception("No key field found.");
            }

            int keyFieldPosition = existingRecordSet.Schema.Fields.IndexOf(keyField);

            int requestKeyFieldPosition = requestRecordSet.Schema.Fields.IndexOf(keyField);

            if (requestKeyFieldPosition == -1)
            {
                throw new Exception("Key field in request record set is missing.");
            }

            foreach (var requestRecord in requestRecordSet)
            {
                object keyValue      = requestRecord[requestKeyFieldPosition];
                Record changedRecord = (from e in listOfRecords
                                        where e[keyFieldPosition].Equals(keyValue)
                                        select e).FirstOrDefault();

                if (changedRecord == null)
                {
                    throw new Exception(String.Format("Record with key '{0}' not found in '{1}'", keyValue, existingRecordSet.Schema.InternalName));
                }

                for (int i = 0; i < existingRecordSet.Schema.Fields.Count; i++)
                {
                    Field field = existingRecordSet.Schema.Fields[i];
                    int   requestFieldPosition = requestRecordSet.Schema.Fields.IndexOf(field);

                    if (requestFieldPosition != -1)
                    {
                        changedRecord[i] = requestRecord[requestFieldPosition];
                    }
                }
            }

            existingRecordSet.SetData(listOfRecords);

            return(existingRecordSet);
        }
Exemplo n.º 39
0
 public ReturnMsg<string> Print(RecordSet data, ReportGenConfig printerConfig)
 {
     ReturnMsg<string> msg = new ReturnMsg<string>() { result = false };
     try
     {
         IReportGen gen = new TecITGener();
         gen.Print(data, printerConfig);
         msg.result = true;
         msg.content = "打印成功";
         msg.level = MsgLevel.Successful;
     }
     catch (Exception e) {
         msg.content = e.Message;
         msg.level = MsgLevel.Mistake;
     }
     return msg;
 }
        public static void BuildRecordSets(IHermesDevice device)
        {
            //Загружаем один раз официантов и меню
            ComReader.BufferMembers = ComReader.GetMembers();
            ComReader.BufferMenu = ComReader.GetMenuToBuffer();
            //Разбираем меню в массив
            var xml = new MenuXml();
            ComReader.ListMenu = xml.MenuXmlToList(ComReader.BufferMenu);

            // Append a dictionary to the device which hold's all application specific data
            if (device.Tag == null)
                device.Tag = new Dictionary<string, object>(2);
            var nextId = 0;
            //Создаем Dictionary для сохранения RecordSet
            IDictionary<string, RecordSet> recSets = new Dictionary<string, RecordSet>();
            #region Строим RecordSet Официанты
            var list = ComReader.BufferMembers; //BufferMembers.xml список официантов
            // Recordset всегда!!! основывается на recorddefinition построеном с помощью Orderman Screen Designed.
            // (Recorddefinition определяют вид и формат записей)
            // В Sol есть Record-Definition USERS - это официанты
            RecordDefinition def = device.Resources.RecordDefinitions["USERS"];
            //Каждой записи Recordset необходим уникальный ID. Мы просто используем счетчик nextId
            var usersSet = new RecordSet(nextId++, def, RSET_USERS); //usersSet - официанты; public const string RSET_USERS = "Users";
            var name = from p in list.Elements("Элемент")
                       select p;
            foreach (var p in name)
            {
                //Каждый официант - свой Record
                var rec = new Record(def);
                rec.Tag = p; //user - это объект со всеми данными типа имя/пароль. Т.е в Tag прячем всю информацию
                //Заполняем данные для отображения
                rec.Cells[0].Value = device.Resources.Images[0x0009];
                rec.Cells[1].Value = p.Attribute("Наименование").Value;
                usersSet.Add(rec);
            }
            //Добавляем в Dictionary RecordSt официанты
            recSets.Add(usersSet.Name, usersSet); //usersSet.Name - "Users"
            #endregion
            #region Строим RecordSet menu and StringTables
            recSets = BuildOrderRecordSet(recSets, device, ref nextId);
            recSets = BuildMenuStringTablesFolder(recSets, device, ref nextId);
            recSets = BuildMenuStringTablesChildren(recSets, device, ref nextId);
            #endregion
            GetDeviceData(device)[RSET_NAME] = recSets;
        }
Exemplo n.º 41
0
        void BuildRecordSets()
        {
            RecordDefinition recDef = this.Device.Resources.RecordDefinitions["static"];

            var sets = new Dictionary<string, RecordSet>();
            this.AppData[AppDataElements.RECORDS] = sets;

            // IMPORTANT --> TAKE CARE THAT EVERY RecordSet has it's unique ID!!!
            var set1 = new RecordSet(0, recDef, RECORDSET1);
            sets.Add(set1.Name, set1);

            // IMPORTANT --> TAKE CARE THAT EVERY RecordSet has it's unique ID!!!
            var set2 = new RecordSet(1, recDef, RECORDSET2);
            sets.Add(set2.Name, set2);

            for (int i = 0; i < 20; i++)
            {
                // add new records to the record sets

                // add to _set1
                var rec = new Record(recDef);
                rec.Cells[0].Value = "item - Set1 - " + (i + 1).ToString();
                rec.Tag = i;
                set1.Add(rec);

                // add to _set2
                rec = new Record(recDef);
                rec.Cells[0].Value = "item - Set2 - " + (i + 1).ToString();
                rec.Tag = i;
                set2.Add(rec);
            }

            // Download the record sets to the device --> than these will be useable to work with lists
            _pBar.Value = 0;
            this.Device.Data.Download(set1);
            _pBar.Value = 50;
            this.Device.Transmit();
            this.Device.Data.Download(set2);
            _pBar.Value = 100;
            this.Device.Transmit();
        }
Exemplo n.º 42
0
 public PrintDataMessage GenSingleTrayLabel(string trayId,string dateFormat,string[] keepers)
 {
     PrintDataMessage pdm = new PrintDataMessage();
     ValidateMsg<Trays> msg = TraysHelper.TrayCanPrint(trayId);
     if (msg.Valid)
     {
         List<TrayPackView> tpv = TrayPackViewHelper.GetTPVByTrayIdsGropSumPartNr(new List<string>() { trayId });
         string[] dateFormats = dateFormat.Split(',');
         List<PrintTask> tasks = new List<PrintTask>();
         foreach (string keeper in keepers)
         {
             RecordSet rs = new RecordSet();
             PrintTask task = new PrintTask() { DataSet = rs };
             foreach (TrayPackView t in tpv)
             {
                 RecordData label = new RecordData();
                 label.Add("TrayId", t.trayId);
                 label.Add("Warehouse", t.warehouse);
                 label.Add("Position", t.position);
                 label.Add("customerPNr", t.customerPartNr);
                 label.Add("PartNr", t.partNr);
                 label.Add("Capa", t.capa.ToString());
                 label.Add("Keeper", keeper);
                 label.Add("CreateTime",t.createTime.ToString(dateFormats[0]));
                 label.Add("StoreCreateTime", t.createTime.ToString(dateFormats[1]));
                 rs.Add(label);
             }
             tasks.Add(task);
         }
         pdm.PrintTask = tasks;
         pdm.ReturnedResult = true;
     }
     else
     {
         pdm.ReturnedResult = false;
         pdm.ReturnedMessage.Add(msg.ToString());
     }
     return pdm;
 }
        private IDictionary<string, RecordSet> BuildPrinterTablesRecordSet(IDictionary<string, RecordSet> recSets, IHermesDevice device, ref int nextId)
        {
            var def = this.Device.Resources.RecordDefinitions["DropDown"];
            var itemsSet = new RecordSet(nextId++, def, "Printers");

            var printers = ComReader.GetPrinters();
            var pp = printers.Descendants("Принтер");
            foreach (var element in pp)
            {
                var r = new Record(def);
                r.Cells[0].Value = Device.Resources.Images[0x002B];
                r.Cells[1].Value = element.Attribute("ИмяПринтера").Value;
                r.Tag = element.Attribute("Идентификатор").Value;
                itemsSet.Add(r);
            }
            recSets.Add(itemsSet.Name, itemsSet);
            Device.Data.Download(itemsSet);
            return recSets;
        }
Exemplo n.º 44
0
        //────────────────────────────────────────
        /// <summary>
        /// フィールドから値を取得。
        /// 
        /// TODO:セルタイプ以外にも対応したい。
        /// </summary>
        /// <param name="RecordSet_toSave">ヌル不可</param>
        /// <param name="eSelectedFldName">選択フィールド</param>
        /// <param name="RecordSetSaveTo_or_null"></param>
        /// <param name="log_Reports"></param>
        /// <returns>行リスト<列リスト></returns>
        public List<List<string>> P5_Select_CellType(
            RecordSet dst_Rs_toSave,
            Selectstatement selectSt_ToSave,
            Expressionv_4ASelectRecord ecv_selRec_OrNull,//where
            Configuration_Node parent_Cf_Query,//this
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "P5_Select",log_Reports);
            //
            //

            List<List<string>> reslt_sFieldListList = new List<List<string>>();

            //
            // (1)テーブル
            Table_Humaninput o_Table;
            {
                o_Table = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(
                    selectSt_ToSave.Expression_From, true, log_Reports);

                if (null == o_Table)
                {
                    // エラー。
                    goto gt_Error_NullTable;
                }
            }
            if (!log_Reports.Successful)
            {
                //
                // エラーが出ていたら、さっさと抜ける。
                goto gt_EndMethod;
            }

            //
            //
            //
            //
            // 条件
            //
            //
            //
            //
            Fielddefinition keyFldDefinition = null;
            string err_SSelectedFldName = null;
            Exception err_Exception = null;
            Recordcondition err_Recordcondition = null;
            foreach (Recordcondition recCond in selectSt_ToSave.List_Recordcondition)
            {
                err_Recordcondition = recCond;

                //
                // (2)検索のキーフィールドの定義を調べます。

                // キーフィールド定義
                {

                    List<string> sList_KeyFldName;
                    {
                        // 要素数1個。
                        sList_KeyFldName = new List<string>();
                        sList_KeyFldName.Add(recCond.Name_Field);
                    }

                    RecordFielddefinition recordFielddefinition;
                    bool bHit = o_Table.TryGetFieldDefinitionByName(
                         out recordFielddefinition,
                        sList_KeyFldName,
                        false,
                        log_Reports
                        );
                    if (!log_Reports.Successful || !bHit)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    keyFldDefinition = recordFielddefinition.ValueAt(0);
                }

                //
                // (3)選択対象のフィールドの定義を調べます。
                RecordFielddefinition recordFieldDefinition_Selected;
                {
                    bool bHit = o_Table.TryGetFieldDefinitionByName(
                        out recordFieldDefinition_Selected,
                        selectSt_ToSave.List_SName_SelectField,
                        true,
                        log_Reports
                        );
                    if (!log_Reports.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }
                }

                //
                // (4)
                if (null == keyFldDefinition)
                {
                    // エラー。
                    goto gt_Error_NullKeyFldDefinition;
                }

                List<string> list_FldImpl3 = new List<string>();

                recordFieldDefinition_Selected.ForEach(delegate(Fielddefinition fielddefinition_Selected,ref bool isBreak2,Log_Reports log_Reports2)
                {
                    string sSelectField = fielddefinition_Selected.Name_Trimupper;

                    //
                    // (5)
                    if (null == fielddefinition_Selected)
                    {
                        // エラー。
                        isBreak2 = true;
                        goto gt_Error_NullSelectedFldDefinition;
                    }

                    //
                    // (6)欠番

                    //
                    // (7)
                    if (null == dst_Rs_toSave || dst_Rs_toSave.List_Field.Count < 1)
                    {
                        bool bExpectedValueRequired;
                        {
                            bool parseSuccessful = bool.TryParse(selectSt_ToSave.Required, out bExpectedValueRequired);
                        }

                        //
                        // 条件
                        //
                        string name_KeyField;
                        Fielddefinition fielddefinition_Key;
                        string value_Expected;
                        P2_ReccondImpl sel2 = new P2_ReccondImpl();
                        sel2.GetFirstAwhrReccond(
                            out name_KeyField,
                            out fielddefinition_Key,
                            out value_Expected,
                            selectSt_ToSave.List_Recordcondition,
                            o_Table,
                            log_Reports
                            );
                        List<DataRow> dst_Row = new List<DataRow>();

                        SelectPerformerImpl sp = new SelectPerformerImpl();
                        sp.Select(
                            out dst_Row,
                            name_KeyField,
                            value_Expected,
                            bExpectedValueRequired,
                            fielddefinition_Key,
                            o_Table.DataTable,
                            parent_Cf_Query,
                            log_Reports
                            );

                        dst_Rs_toSave.AddList(dst_Row, log_Reports);
                        if (!log_Reports.Successful)
                        {
                            // 既エラー。
                            isBreak2 = true;
                            goto gt_EndInnermethod;
                        }

                        if (null == dst_Rs_toSave)
                        {
                            // (7-2)

                            isBreak2 = true;
                            goto gt_Error_UndefinedPrimitiveType;
                        }
                    }
                    else
                    {
                        // レコードセットは、一時記憶から取得済み。
                    }

                    // (8)
                    if (log_Reports.Successful)
                    {

                        // キー_フィールドの型別に、処理。
                        switch (keyFldDefinition.Type_Field)
                        {
                            case EnumTypeFielddefinition.String:
                                {
                                    // (8-1)キーが string型フィールドなら

                                    // この行の、選択対象のフィールドの値。

                                    foreach (Dictionary<string, Value_Humaninput> record in dst_Rs_toSave.List_Field)
                                    {
                                        // 値。

                                        Value_Humaninput selectedCellData;
                                        try
                                        {
                                            selectedCellData = (Value_Humaninput)record[sSelectField];
                                        }
                                        catch (KeyNotFoundException ex)
                                        {
                                            selectedCellData = null;
                                            err_SSelectedFldName = sSelectField;
                                            err_Exception = ex;
                                            isBreak2 = true;
                                            goto gt_Error_NotFoundFld;
                                        }

                                        Expression_Node_String ec_SelectedValue = this.GetSelectedFieldValue(
                                            fielddefinition_Selected,
                                            selectedCellData,
                                            parent_Cf_Query,
                                            log_Reports
                                            );

                                        list_FldImpl3.Add(ec_SelectedValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                                    }
                                }
                                break;
                            case EnumTypeFielddefinition.Int:
                                {
                                    //
                                    // (8-2) キー・フィールドが int型の場合。

                                    foreach (Dictionary<string, Value_Humaninput> record in dst_Rs_toSave.List_Field)
                                    {
                                        // この行の、選択対象のフィールドの値。

                                        if (null != log_Reports && !log_Reports.Successful)//無限ループ防止
                                        {
                                            // エラー発生時は無視。
                                        }
                                        else
                                        {
                                            Value_Humaninput selectedCellData;
                                            try
                                            {
                                                selectedCellData = record[sSelectField];
                                            }
                                            catch (KeyNotFoundException ex)
                                            {
                                                selectedCellData = null;
                                                err_SSelectedFldName = sSelectField;
                                                err_Exception = ex;
                                                isBreak2 = true;
                                                goto gt_Error_NotFoundFld;
                                            }

                                            {
                                                // 値。
                                                Expression_Node_String ec_SelectedValue = this.GetSelectedFieldValue(
                                                    fielddefinition_Selected,
                                                    selectedCellData,
                                                    parent_Cf_Query,
                                                    log_Reports
                                                    );

                                                list_FldImpl3.Add(ec_SelectedValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                                            }
                                        }
                                    }
                                }
                                break;
                            case EnumTypeFielddefinition.Bool:
                                {
                                    // (8-3) キーが、bool型フィールド

                                    // 値。
                                    foreach (Dictionary<string, Value_Humaninput> record in dst_Rs_toSave.List_Field)
                                    {
                                        // この行の、選択対象のフィールドの値。
                                        Value_Humaninput selectedCellData;
                                        try
                                        {
                                            selectedCellData = (Value_Humaninput)record[sSelectField];
                                        }
                                        catch (KeyNotFoundException ex)
                                        {
                                            selectedCellData = null;
                                            err_SSelectedFldName = sSelectField;
                                            err_Exception = ex;
                                            isBreak2 = true;
                                            goto gt_Error_NotFoundFld;
                                        }

                                        Expression_Node_String ec_SelectedValue = this.GetSelectedFieldValue(
                                            fielddefinition_Selected,
                                            selectedCellData,
                                            parent_Cf_Query,
                                            log_Reports
                                            );

                                        list_FldImpl3.Add(ec_SelectedValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                                    }
                                }
                                break;
                            default:
                                {
                                    //
                                    // (8-4)

                                    //
                                    // 既にエラー対策済み。

                                    if (null != log_Reports)//無限ループ防止
                                    {
                                        //
                                        // エラー。
                                        isBreak2 = true;
                                        goto gt_Error_UndefinedPrimitiveType;
                                    }

                                    //
                                    // 非エラー中断。
                                    isBreak2 = true;
                                    goto gt_EndInnermethod;
                                }
                                break;
                        }

                    }

                    goto gt_EndInnermethod;
                //
                    #region 異常系
                //────────────────────────────────────────
                gt_Error_NullSelectedFldDefinition:
                    {
                        Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                        tmpl.SetParameter(1, o_Table.Name, log_Reports);//テーブル名
                        tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(parent_Cf_Query), log_Reports);//設定位置パンくずリスト

                        this.Owner_MemoryApplication.CreateErrorReport("Er:6026;", tmpl, log_Reports);
                    }
                goto gt_EndInnermethod;
                //────────────────────────────────────────
                gt_Error_UndefinedPrimitiveType:
                    {
                        Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                        tmpl.SetParameter(1, keyFldDefinition.ToString_Type(), log_Reports);//キー・フィールド定義型名
                        tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(parent_Cf_Query), log_Reports);//設定位置パンくずリスト

                        this.Owner_MemoryApplication.CreateErrorReport("Er:6027;", tmpl, log_Reports);
                    }
                goto gt_EndInnermethod;
                //────────────────────────────────────────
                gt_Error_NotFoundFld:
                    {
                        Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                        tmpl.SetParameter(1, err_SSelectedFldName, log_Reports);//選択フィールド名
                        tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(parent_Cf_Query), log_Reports);//設定位置パンくずリスト
                        tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Exception), log_Reports);//例外メッセージ

                        this.Owner_MemoryApplication.CreateErrorReport("Er:6028;", tmpl, log_Reports);
                    }
                goto gt_EndInnermethod;
                //────────────────────────────────────────
                    #endregion
                    //
                gt_EndInnermethod:
                    ;
                }, log_Reports);//select列1つ

                if (0 < list_FldImpl3.Count)
                {
                    // フィールドがあれば追加。
                    reslt_sFieldListList.Add(list_FldImpl3);
                }
            }

            goto gt_EndMethod;
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NullTable:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();

                this.Owner_MemoryApplication.CreateErrorReport("Er:6024;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_NullKeyFldDefinition:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(parent_Cf_Query), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6025;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return reslt_sFieldListList;
        }
Exemplo n.º 45
0
        /// <summary>
        /// Get all candidates and remove null from list. 
        /// If candidate with maximum score present and locator is primary - remove other candidates.
        /// </summary>
        /// <param name="geocodedAddress">Record set with candidates from server.</param>
        /// <param name="includeDisabledLocators">Is need to add candidates from disabled locators.</param>
        /// <returns>Correct candidates list.</returns>
        private AddressCandidate[] _GetNeededAddressCandidates(RecordSet geocodedAddress, bool includeDisabledLocators)
        {
            AddressCandidate[] addressCandidates = _GetAllAddressCandidates(geocodedAddress, includeDisabledLocators);

            List<AddressCandidate> addressCandidatesList = _RemoveNullElements(addressCandidates);

            // Remove candidates with score less than minimum.
            for (int index = addressCandidatesList.Count - 1; index >= 0; index--)
            {
                if (addressCandidatesList[index] != null &&
                    addressCandidatesList[index].Score < _geocodingServiceInfo.MinimumCandidateScore)
                {
                    addressCandidatesList.RemoveAt(index);
                }
            }

            addressCandidates = addressCandidatesList.ToArray();

            return addressCandidates;
        }
Exemplo n.º 46
0
        /// <summary>
        /// Get AddressCandidate array from geocode service response.
        /// </summary>
        /// <param name="geocodedAddress">Source address to get candidates.</param>
        /// <param name="includeDisabledLocators">Is need to add candidates from disabled locators.</param>
        /// <returns>Address candidates array.</returns>
        private AddressCandidate[] _GetAllAddressCandidates(RecordSet geocodedAddress, bool includeDisabledLocators)
        {
            int recordCount = geocodedAddress.Records.Length;
            List<AddressCandidate> result = new List<AddressCandidate>();

            // Get requred fields indexes.
            int pointFieldIndex = -1;
            int scoreFieldIndex = -1;
            int matchAddrFieldIndex = -1;
            int locNameFieldIndex = -1;
            int addrTypeFieldIndex = -1;
            int addressOIDFieldIndex = -1;

            int fieldCount = geocodedAddress.Fields.FieldArray.Length;
            for (int index = 0; index < fieldCount; index++)
            {
                Field field = geocodedAddress.Fields.FieldArray[index];
                if (field.Name.Equals(SHAPE_PROPERTY_KEY, StringComparison.OrdinalIgnoreCase))
                    pointFieldIndex = index;
                else if (field.Name.Equals(SCORE_PROPERTY_KEY, StringComparison.OrdinalIgnoreCase))
                    scoreFieldIndex = index;
                else if (field.Name.Equals(MATCHADDR_PROPERTY_KEY, StringComparison.OrdinalIgnoreCase))
                    matchAddrFieldIndex = index;
                else if (field.Name.Equals(LOCNAME_PROPERTY_KEY, StringComparison.OrdinalIgnoreCase))
                    locNameFieldIndex = index;
                else if (field.Name.Equals(ADDRTYPE_PROPERTY_KEY, StringComparison.OrdinalIgnoreCase))
                    addrTypeFieldIndex = index;
                else if (field.Name.Equals(
                    PROPERTY_WHICH_MAP_TO_ADDRESS_OID_PROPERTY_KEY, StringComparison.OrdinalIgnoreCase))
                    addressOIDFieldIndex = index;
            }

            // This code is for batch geocoding.
            // We can get address candidates in new order, not in which we send address to batch.
            // Since OID property in request is from 0 to addresses count we should sort
            // received candidates by property which maps to OID property to make sure
            // that candidate is matched to corresponding address.
            var records = geocodedAddress.Records.ToList();
            if(addressOIDFieldIndex != -1)
                records = records.OrderBy(record => (int)record.Values[addressOIDFieldIndex]).ToList();

            // Get AddressCandidate from record.
            for (int index = 0; index < recordCount; index++)
            {
                AddressCandidate candidate = _GetAddressCandidateFromRecord(records[index],
                    pointFieldIndex, scoreFieldIndex, matchAddrFieldIndex, locNameFieldIndex,
                    includeDisabledLocators, addrTypeFieldIndex);

                // In case of locator is not enable candidate is null.
                result.Add(candidate);
            }

            return result.ToArray();
        }
        //Создаем стринг таблицы детей папок / строим на основе разобранного меню
        private static IDictionary<string, RecordSet> BuildMenuStringTablesChildren(IDictionary<string, RecordSet> recSets, IHermesDevice device, ref int nextId)
        {
            var def = device.Resources.RecordDefinitions["ITEMS-2"];
            foreach (var o in ComReader.ListMenu.Children.Where(z => z.IdFather == "This folder!"))
            {
                var userSet = new RecordSet(nextId++, def, o.Id);
                try
                {
                    //Папки уже создали, они не полезут
                    recSets.Add(userSet.Name, userSet);
                    var items = from q in ComReader.ListMenu.Children
                                where q.IdFather == o.Id
                                select q;

                    foreach (var p in items)
                    {
                        var itemRec = new Record(def);
                        itemRec.Cells[0].Value = p.Name;
                        itemRec.Cells[1].Value = p.Id;
                        itemRec.Cells[2].Value = p.Price;
                        itemRec.Tag = p.Id;
                        if (p.Marker == null) p.Marker = "ITEMNAME";
                        itemRec.TemplateName = p.Modifikators.Any() ? "POPUP" : p.Marker;
                        userSet.Add(itemRec);
                    }
                    //IDictionary<string, RecordSet> - добавляем ее в словарь
                    //itemsSet.Name - это наш guidId
                    recSets.Add(userSet.Name, userSet);
                }
                catch (Exception)
                {
                }
            }
            return recSets;
        }
        //Создаем стринг таблицы верхних папок
        private static IDictionary<string, RecordSet> BuildMenuStringTablesFolder(IDictionary<string, RecordSet> recSets,
            IHermesDevice device, ref int nextId)
        {
            var manuName = new string[3] { "ПИЦЦА", "КУХНЯ", "БАР" };
            //def Описывает структуру заданную в редакторе
            var def = device.Resources.RecordDefinitions["ITEMS-2"];
            for (var tab = 0; tab < 3; tab++)
            {
                //Создаем запись: nextId - номер записи, guidId - имя присваемое нами
                var userSet = new RecordSet(nextId++, def, manuName[tab]);
                var menu = GetXElements(manuName[tab]);

                foreach (var p in menu)
                {
                    var rec = new Record(def);
                    var element = p.Element("Наименование");
                    if (element != null) rec.Cells[0].Value = element.Value;
                    element = p.Element("IdItemName");
                    if (element != null) rec.Cells[1].Value = element.Value;
                    rec.Cells[2].Value = "This folder!";
                    rec.TemplateName = "ITEMNAME";
                    userSet.Add(rec);
                }
                //IDictionary<string, RecordSet> - добавляем ее в словарь
                //itemsSet.Name - это наш guidId
                recSets.Add(userSet.Name, userSet);
            }
            return recSets;
        }
		/// <summary>
		/// Generic function to output RecordSet (Stops, Barriers, or Routes) in a DataDrid Control
		/// </summary> 
		private void OutputRecSetToDataGrid(RecordSet recSet, System.Windows.Forms.DataGrid outDataGrid)
		{

			Fields fields = recSet.Fields;
			Field[] fldArray = fields.FieldArray;

			DataSet dataSet = new DataSet("dataSet");
			DataTable dataTable = new DataTable("Results");
			dataSet.Tables.Add(dataTable);

			DataColumn dataColumn = null;
			for (int f = 0; f < fldArray.Length; f++)
			{
				dataColumn = new DataColumn(fldArray[f].Name);
				dataTable.Columns.Add(dataColumn);
			}

			// Populate DataGrid rows by RecordSet
			DataRow newDataRow;
			Record[] records = recSet.Records;
			Record record = null;
			object[] values = null;
			for (int j = 0; j < records.Length; j++)
			{
				newDataRow = dataTable.NewRow();
				record = records[j];
				values = record.Values;
				for (int l = 0; l < values.Length; l++)
				{
					if (values[l] != null)
						newDataRow[l] = values[l].ToString();
				}
				dataTable.Rows.Add(newDataRow);
			}

			outDataGrid.SetDataBinding(dataSet, "Results");
			outDataGrid.Visible = true;
		}
Exemplo n.º 50
0
 public void ShowChildren(List menu, RecordSet record)
 {
     //var id = record[0].Cells[1].Value.ToString();
     var id = record[0].Tag.ToString();
     menu.Group.Append(this.RecordSets[id]);
 }
 //Строим Recordset для верхнего окна _lstOrders ORDERS
 //5 наборов черный/зеленый/красный для детей и папок
 //красный один и тот же
 //Пока используются только черные 2 набора
 private static IDictionary<string, RecordSet> BuildOrderRecordSet(IDictionary<string, RecordSet> recSets,
     IHermesDevice device, ref int nextId)
 {
     var def = device.Resources.RecordDefinitions["ORDERS"];
     foreach (var q in (RecSets.MarkerOrder[])Enum.GetValues(typeof(RecSets.MarkerOrder)))
     {
         var id = 0;
         foreach (var p in ComReader.ListMenu.Children)
         {
             //q + p.Id - строим новые ключи
             var itemsSet = new RecordSet(nextId++, def, q + p.Id);
             var itemRec = new Record(def);
             itemRec.Cells[0].Value = "1";
             itemRec.Cells[1].Value = id++;
             itemRec.Tag = q.ToString() + p.Id;
             itemRec.TemplateName = q.ToString();
             itemsSet.Add(itemRec);
             try
             {
                 recSets.Add(itemsSet.Name, itemsSet);
             }
             catch (Exception)
             {
                 var i = "Это дубль";
             }
         }
     }
     return recSets;
 }
 //throws RecognitionException, TokenStreamException
 public void table()
 {
     try {      // for error handling
         match(T_TABLE);
         match(WS);
         RecordSetName = LT(1).getText();
                             CurrentRecordSet = new RecordSet(RecordSetName);
                             LoadRecordSet = new SADLRecordSet(RecordSetName);
         match(T_NAME);
         match(WS);
         match(T_WITH);
         match(WS);
         match(T_DATA);
         match(WS);
         Buf1 = LT(1).getText(); CurrentRecordSet.SetRecordSetType(Buf1);
         {
             switch ( LA(1) )
             {
             case T_FILE:
             {
                 match(T_FILE);
                 break;
             }
             case T_NAME:
             {
                 match(T_NAME);
                 break;
             }
             default:
             {
                 throw new NoViableAltException(LT(1), getFilename());
             }
              }
         }
         match(WS);
         {
             switch ( LA(1) )
             {
             case T_FROM:
             {
                 match(T_FROM);
                 break;
             }
             case T_TO:
             {
                 match(T_TO);
                 break;
             }
             default:
             {
                 throw new NoViableAltException(LT(1), getFilename());
             }
              }
         }
         match(WS);
         Buf1 = LT(1).getText(); Buf2 = Buf1.Substring(1, Buf1.Length - 2);
                 CurrentRecordSet.SetRecordSetSemantics(Buf1);
         match(T_QUOTE);
         match(WS);
         match(T_SCHEMA);
         match(WS);
         Buf1 = LT(1).getText(); LoadRecordSet.SetSchema(Buf1);
         match(T_NAME);
         match(WS);
         AllRecordSets.Add(AllRecordSets.Count + 1, CurrentRecordSet);
                 Console.WriteLine("RecordSet: " + RecordSetName);
                 AllSADLRecordSets.Add(AllSADLRecordSets.Count + 1, LoadRecordSet);
     }
     catch (RecognitionException ex)
     {
         reportError(ex);
         recover(ex,tokenSet_2_);
     }
 }
        private List<SyndicationItem> CreateItemCollection(RecordSet results, GeoRSSExportProperties feedProperties)
        {
            List<SyndicationItem> items = new List<SyndicationItem>();
            ICursor cursor;
            SimpleGeometryFactory simpleFactory = new SimpleGeometryFactory();
            GMLGeometryFactory gmlFactory = new GMLGeometryFactory();

            try
            {
                //create a feed item for each record
                cursor = results.get_Cursor(false);

                Exporter.logger.LogMessage(ESRI.ArcGIS.SOESupport.ServerLogger.msgType.infoStandard, "CreateItemCollection", 999999, "Cursor Set");
                IRow row = cursor.NextRow();

                int rowCount = 0;

                if (row != null)
                {
                    while (row != null)
                    {
                        //on the first row log out the field name and field alias
                        if (rowCount == 0)
                        {
                            for (int r = 0; r < row.Fields.FieldCount; r++)
                            {
                                IField field = row.Fields.get_Field(r);

                                Exporter.logger.LogMessage(ESRI.ArcGIS.SOESupport.ServerLogger.msgType.infoDetailed,
                                "CreateItemCollection",
                                999999,
                                "field Name: " + field.Name +
                                " field alias: " + field.AliasName
                                );
                            }
                        }

                        SyndicationItem item = new SyndicationItem();

                        //set the item properties
                        foreach (KeyValuePair<string, GeoRSSExportItem> itemConfig in feedProperties.Items)
                        {
                            GeoRSSExportItem itemExportProperty = itemConfig.Value;

                            if (itemExportProperty != null)
                            {
                                SetItemValues(row, ref item, itemConfig, itemExportProperty);

                            }

                        }

                        //process the geometry

                        int fieldIndex = row.Fields.FindField(feedProperties.GeometryField);

                        if (fieldIndex == -1)
                            throw new Exception("Could not locate geometry field:" + feedProperties.GeometryField);

                        if (row.get_Value(fieldIndex) != null)
                        {
                            IGeometry geom = row.get_Value(fieldIndex) as IGeometry;
                            GeoRSSGeometry geometry = null;
                            switch (feedProperties.GetGeoRSSGeomtryType())
                            {
                                case GeoRSSGeometryFormat.Simple:
                                    geometry = simpleFactory.GetGeometry(geom);
                                    break;
                                case GeoRSSGeometryFormat.GML:
                                    geometry = gmlFactory.GetGeometry(geom);
                                    break;
                                default:
                                    break;
                            }

                            if (geom != null)
                                item.ElementExtensions.Add(geometry.GeometryAsXML);
                        }

                        items.Add(item);

                        row = cursor.NextRow();

                        rowCount++;

                    }
                }
                return items;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cursor = null;
            }
        }
 //Строим построчно блюда для Bill
 private IDictionary<string, RecordSet> BuildBillRecordSet(IDictionary<string, RecordSet> recSets, IHermesDevice device, ref int nextId)
 {
     var def = device.Resources.RecordDefinitions["BILL"];
     foreach (var q in (RecSets.Bill[])Enum.GetValues(typeof(RecSets.Bill)))
     {
         var id = 0;
         foreach (var p in ComReader.ListMenu.Children)
         {
             //todo "BILL" имена совпадают с ORDERS
             var itemsSet = new RecordSet(nextId++, def, "BILL" + q + p.Id);
             var itemRec = new Record(def);
             itemRec.Cells[0].Value = "1";
             itemRec.Cells[1].Value = id++; //p.Name;
             //itemRec.Tag = p.Id;
             itemRec.TemplateName = q.ToString();
             itemsSet.Add(itemRec);
             try
             {
                 recSets.Add(itemsSet.Name, itemsSet);
             }
             catch (Exception)
             {
                 var i = "Это дубль";
             }
         }
     }
     return recSets;
 }
        //Modifier
        private IDictionary<string, RecordSet> BuildModifiersTablesRecordSet(IDictionary<string, 
            RecordSet> recSets, IHermesDevice device, ref int nextId)
        {
            var def = device.Resources.RecordDefinitions["MODIFIER"];
            foreach (var p in ComReader.ListMenu.Children.Where(p => p.Modifikators.Any()))
            {
                var itemsSet = new RecordSet(nextId++, def, RecSets.Modifier.Modifier.ToString() + p.Id);

                foreach (var q in p.Modifikators.OrderByDescending(z => z.Value.Required))
                {
                    var itemRec = new Record(def);
                    itemRec.Cells[0].Value = Device.Resources.Images[0x0018];
                    itemRec.Cells[1].Value =  q.Value.Name;
                    itemRec.Cells[2].Value = q.Value.Id;
                    itemRec.TemplateName = q.Value.Required == "1" ? "Required" : "NoRequired";
                    itemsSet.Add(itemRec);
                }
                try
                {
                    recSets.Add(itemsSet.Name, itemsSet);
                }
                catch (Exception)
                {
                    var i = "Это дубль";
                }
            }
            return recSets;
        }
Exemplo n.º 56
0
        /// <summary>
        /// Create RecordSet for Addresses.
        /// </summary>
        /// <param name="addresses">Addresses to make batch geocode.</param>
        /// <returns>Addresses record set.</returns>
        private RecordSet _GetAddressesRecordSet(Address[] addresses)
        {
            RecordSet addressTable = new RecordSet();

            addressTable.Fields = _GetAddressFieldsForBatchGeocoding();
            addressTable.Records = _GetAddressValuesForBatchGeocoding(addresses);

            return addressTable;
        }
 private Dictionary<string, RecordSet> BuildMenuModifiersStringTables(Dictionary<string, RecordSet> stringTables, ref int nextId)
 {
     var id = 0;
     var def = RecordDataDefinition.CreateStringTable();
     var dishName = new RecordSet(nextId++, def, RecSets.StringTables.Menu.ToString());
     stringTables.Add(dishName.Name, dishName);
     foreach (var p in ComReader.ListMenu.Children)
     {
         var textAndId = new Record(def);
         textAndId.Cells[0].Value = id++;
         textAndId.Cells[1].Value = p.Name;
         dishName.Add(textAndId);
     }
     //Модификаторы
     var duplicate = new Dictionary<string, int>();
     //dishName = new RecordSet(nextId++, def, RecSets.StringTables.Modifiers.ToString());
     foreach (var p in ComReader.ListMenu.Children.Where(p => p.Modifikators.Any()))
     {
         foreach (var q in p.Modifikators.OrderByDescending(z => z.Value.Required))
         {
             int user;
             if (duplicate.TryGetValue(q.Value.Name, out user)) continue;
             var textAndId = new Record(def);
             textAndId.Cells[0].Value = id++;
             textAndId.Cells[1].Value = q.Value.Name;
             dishName.Add(textAndId);
             duplicate.Add(q.Value.Name, id);
         }
     }
     return stringTables;
 }
        //Строим группы столов в залах
        private IDictionary<string, RecordSet> BuildTablesRecordSet(IDictionary<string, RecordSet> recSets, 
            IHermesDevice device, ref int nextId)
        {
            var def = device.Resources.RecordDefinitions["TABLES"];
            var doc = ComReader.GetTablesRecordSet();
            var element = doc.Descendants("Зал");
            var xElements = element as XElement[] ?? element.ToArray();
            foreach (var p in xElements)
            {
                var userSet = new RecordSet(nextId++, def, p.Attribute("Наименование").Value);

                foreach (var q in p.Descendants("Столы").OrderBy(z => z.Attribute("ИмяСтола").Value))
                {
                    var rec = new Record(def);
                    rec.Cells[0].Value = Device.Resources.Images[0x0001];
                    rec.Cells[1].Value = q.Attribute("ИмяСтола").Value;
                    rec.TemplateName = RecSets.Tables.FREE.ToString();
                    rec.Tag = q.Attribute("Num").Value;
                    userSet.Add(rec);
                }
                recSets.Add(userSet.Name, userSet);
            }
            return recSets;
        }