Beispiel #1
0
        /// <summary>
        /// Insert new record based on given fields.
        /// </summary>
        /// <param name="fields">The set of fields.</param>
        /// <returns>Result of SQL-query execution.</returns>
        public int Insert(THashtable fields)
        {
            var keys        = new TEnumerator(fields.Keys.GetEnumerator());
            var fieldNames  = "";
            var fieldValues = "";

            Object[] pars = ARR();
            //pars.SetPullValues(true);
            var n = 0;

            while (keys.MoveNext())
            {
                var key = (String)keys.GetCurrent();
                if (n != 0)
                {
                    fieldNames += ", ";
                }
                if (n != 0)
                {
                    fieldValues += ", ";
                }
                fieldNames  += key;
                fieldValues += "?";
                pars         = ADD(pars, this.SetFunction(key), fields[key]);
                n++;
            }
            var query = Strings.Concat(
                " insert into ", this.tableName, " (", fieldNames, ") ",
                " values (", fieldValues, ")"
                );

            return(this.UpdateInternal(query, pars, "insert"));
        }
Beispiel #2
0
        /// <summary>
        /// Update existing record by ID based on given fields.
        /// </summary>
        /// <param name="id">Unique record ID.</param>
        /// <param name="fields">The set of fields.</param>
        /// <returns>Result of SQL-query execution.</returns>
        public int UpdateById(Object id, THashtable fields)
        {
            var keys      = new TEnumerator(fields.Keys.GetEnumerator());
            var setValues = "";

            Object[] pars = ARR();
            var      n    = 0;

            while (keys.MoveNext())
            {
                var key = (String)keys.GetCurrent();
                if (key == this.idField) //TODO PHP
                {
                    continue;
                }
                if (n != 0)
                {
                    setValues += ", ";
                }
                setValues += CAT(key, " = ?");
                pars       = ADD(pars, this.SetFunction(key), fields[key]);
                n++;
            }
            pars = ADD(pars, this.SetFunction(this.idField), id);
            var query = Strings.Concat(
                " update ", this.tableName, " set ", setValues,
                " where (", this.idField, " = ?)"
                );

            return(this.UpdateInternal(query, pars, "update"));
        }
Beispiel #3
0
 public Enumerator(TEnumerator enumerator, Func <TS, Enumerable <TSubEnumerable, TSubEnumerator, TR> > mapper)
 {
     this.enumerator = enumerator;
     this.mapper     = mapper;
     sub             = new TSubEnumerator();
     first           = true;
 }
Beispiel #4
0
 public Enumerator(IComEnumeratorRelay <TEnumerator, TEnumerated> relay, TEnumerator enumerator, int cacheSize)
 {
     if (enumerator == null)
     {
         throw new ArgumentNullException(nameof(enumerator));
     }
     if (cacheSize <= 0)
     {
         throw new ArgumentOutOfRangeException(nameof(cacheSize));
     }
     _relay                = relay ?? throw new ArgumentNullException(nameof(relay));
     _fetchAgain           = true;
     _wrappedComEnumerator = enumerator;
     _cache                = new TEnumerated[cacheSize];
     _currentIndex         = cacheSize;
     _validCachedItemCount = 0;
 }
        /// <summary>
        /// Get serialized (XML) representation of the DataSet.
        /// </summary>
        /// <returns>Resulting representation.</returns>
        public String ToXml(String EOL)
        {
            var level  = 0;
            var spaces = (String)null;
            var output = "";

            output += CAT("<DataSet Rows=\"", this.rows.Size(), "\">", EOL);
            for (int n = 0; n < this.GetSize(); n++)
            {
                var row = this.GetRow(n);
                level++; spaces = this.AddSpaces(level);
                output         += CAT(spaces, "<Row>", EOL);
                var keys = new TEnumerator(row.Keys.GetEnumerator());
                while (keys.MoveNext())
                {
                    level++; spaces = this.AddSpaces(level);
                    var key   = (String)keys.GetCurrent();
                    var value = row[key];
                    if (NUL(value))
                    {
                        output += CAT(spaces, "<Item Name=\"", key, "\" IsNull=\"True\" />", EOL);
                    }
                    else
                    {
                        output += CAT(spaces, "<Item Name=\"", key, "\">");
                        output += STR(row[key]);
                        output += CAT("</Item>", EOL);
                    }
                    level--; spaces = this.AddSpaces(level);
                }
                output         += CAT(spaces, "</Row>", EOL);
                level--; spaces = this.AddSpaces(level);
            }
            output += CAT("</DataSet>", EOL);
            return(output);
        }
Beispiel #6
0
 public Enumerator(TEnumerator inner, Func <T, TR> map)
     : this()
 {
     this.inner = inner;
     this.map   = map;
 }
 internal AsyncEnumerator(TEnumerable enumerable, CancellationToken cancellationToken)
 {
     enumerator             = enumerable.GetEnumerator();
     this.cancellationToken = cancellationToken;
 }
Beispiel #8
0
 internal Enumerator(AsValueEnumerableEnumerable <TEnumerable, TEnumerator, TSource> enumerable)
 {
     enumerator = Dynamic.GetEnumerator <TEnumerable, TEnumerator, TSource> .Invoke(enumerable.source);
 }
Beispiel #9
0
        internal OperationData(ArticleData articles, MasterTableResourceCapability resourceCapability)
        {
            SawTools = new TEnumerator <M_ResourceCapability>(
                obj: resourceCapability.Capabilities.Single(x => x.Name.Equals(resourceCapability.CUTTING.Name))
                .ChildResourceCapabilities.ToArray());

            DrillTools = new TEnumerator <M_ResourceCapability>(
                obj: resourceCapability.Capabilities.Single(x => x.Name.Equals(resourceCapability.DRILLING.Name))
                .ChildResourceCapabilities.ToArray());

            AssemblyTools = new TEnumerator <M_ResourceCapability>(
                obj: resourceCapability.Capabilities.Single(x => x.Name.Equals(resourceCapability.ASSEMBLING.Name))
                .ChildResourceCapabilities.ToArray());

            BODENPLATTE_BOHREN = new M_Operation
            {
                ArticleId            = articles.BODENPLATTE.Id,
                Name                 = "Bodenplatte bohren",
                Duration             = 5,
                ResourceCapabilityId = DrillTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            BODENPLATTE_ZUSAMMENBAUEN = new M_Operation
            {
                ArticleId            = articles.BODENPLATTE.Id,
                Name                 = "Bodenplatte zusammenbauen",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            ABLAGE_ZUSAMMENBAUEN = new M_Operation
            {
                ArticleId            = articles.ABLAGE.Id,
                Name                 = "Ablage zusammenbauen",
                Duration             = 1,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            DECKPLATTE_BOHREN = new M_Operation
            {
                ArticleId            = articles.DECKPLATTE.Id,
                Name                 = "Deckplatte bohren",
                Duration             = 5,
                ResourceCapabilityId = DrillTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            SEITENWAND_BOHREN = new M_Operation
            {
                ArticleId            = articles.SEITENWAND.Id,
                Name                 = "Seitenwand bohren",
                Duration             = 5,
                ResourceCapabilityId = DrillTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            RÜCKWAND_ZUSAMMENBAUEN = new M_Operation
            {
                ArticleId            = articles.RÜCKWAND.Id,
                Name                 = "Rückwand zusammenbauen",
                Duration             = 1,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            SCHRANKTÜR_BOHREN = new M_Operation
            {
                ArticleId            = articles.SCHRANKTÜR.Id,
                Name                 = "Schranktür bohren",
                Duration             = 5,
                ResourceCapabilityId = DrillTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            SCHRANKTÜR_ZUSAMMENBAUEN = new M_Operation
            {
                ArticleId            = articles.SCHRANKTÜR.Id,
                Name                 = "Schranktür zusammenbauen",
                Duration             = 10,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            RAHMEN_ZUSAMMENBAUEN = new M_Operation
            {
                ArticleId            = articles.RAHMEN.Id,
                Name                 = "Rahmen zusammenbauen",
                Duration             = 10,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            RÜCKWAND_MONTIEREN = new M_Operation
            {
                ArticleId            = articles.RAHMEN_MIT_RÜCKWAND.Id,
                Name                 = "Rückenwand montieren",
                Duration             = 20,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            REGAL_DÜBEL_ANBRINGEN = new M_Operation
            {
                ArticleId            = articles.REGAL.Id,
                Name                 = "Regal: Dübel anbringen",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            REGAL_ABLAGEN_EINBAUEN = new M_Operation
            {
                ArticleId            = articles.REGAL.Id,
                Name                 = "Regal: Ablagen einbauen",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            SCHRANK_KLEIDERSTANGENHALTERUNGEN_ANBRINGEN = new M_Operation
            {
                ArticleId            = articles.SCHRANK.Id,
                Name                 = "Schrank: Kleiderstangenhalterungen anbringen",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            SCHRANK_KLEIDERSTANGE_EINBAUEN = new M_Operation
            {
                ArticleId            = articles.SCHRANK.Id,
                Name                 = "Schrank: Kleiderstange einbauen",
                Duration             = 2,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            SCHRANKTÜR_BEFESTIGEN = new M_Operation
            {
                ArticleId            = articles.SCHRANK.Id,
                Name                 = "Schrank: Tür befestigen",
                Duration             = 10,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 30
            };
        }
Beispiel #10
0
 public Enumerator(TEnumerator inner, Func <T, bool> predicate)
     : this()
 {
     this.inner     = inner;
     this.predicate = predicate;
 }
Beispiel #11
0
 internal Enumerator(ref TEnumerator outer)
 {
     Outer = outer;
 }
Beispiel #12
0
 internal Enumerator(AsReadOnlyCollectionEnumerable <TEnumerable, TEnumerator, TSource> enumerable)
 {
     enumerator = enumerable.source.GetValueEnumerator();
 }
Beispiel #13
0
 internal Enumerator(AsValueReadOnlyCollectionEnumerable <TEnumerable, TEnumerator, TSource> enumerable)
 {
     enumerator = Dynamic.GetEnumerator <TEnumerable, TEnumerator, TSource> .Invoke(enumerable.source);
 }
        internal MasterTableOperation(MasterTableArticle articles
                                      , MasterTableResourceCapability resourceCapability
                                      , bool distributeSetupsExponentially)
        {
            SawTools = new TEnumerator <M_ResourceCapability>(
                obj: resourceCapability.Capabilities.Single(x => x.Name.Equals(resourceCapability.CUTTING.Name)).ChildResourceCapabilities.ToArray()
                , expDistributed: distributeSetupsExponentially);

            DrillTools = new TEnumerator <M_ResourceCapability>(
                obj: resourceCapability.Capabilities.Single(x => x.Name.Equals(resourceCapability.DRILLING.Name)).ChildResourceCapabilities.ToArray()
                , expDistributed: distributeSetupsExponentially);

            AssemblyTools = new TEnumerator <M_ResourceCapability>(
                obj: resourceCapability.Capabilities.Single(x => x.Name.Equals(resourceCapability.ASSEMBLING.Name)).ChildResourceCapabilities.ToArray()
                , expDistributed: distributeSetupsExponentially);


            DUMP_TRUCK_WEDDING = new M_Operation
            {
                ArticleId            = articles.DUMP_TRUCK.Id,
                Name                 = "Dump-Truck: Wedding",
                Duration             = 15,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            GLUE_TRUCK_BED = new M_Operation
            {
                ArticleId            = articles.DUMP_TRUCK.Id,
                Name                 = "Glue Truck-Bed",
                Duration             = 10,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            // assemble Truck
            RACE_TRUCK_WEDDING = new M_Operation
            {
                ArticleId            = articles.RACE_TRUCK.Id,
                Name                 = "Race-Truck: Wedding",
                Duration             = 15,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            GLUE_RACE_WING = new M_Operation
            {
                ArticleId            = articles.RACE_TRUCK.Id,
                Name                 = "Glue Race Wing",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            // assemble chassie Dump-Truck
            DUMP_TRUCK_ASSEMBLE_LAMPS = new M_Operation
            {
                ArticleId            = articles.CHASSIS_TYPE_DUMP.Id,
                Name                 = "Dump-Truck: Assemble Lamps",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            DUMP_TRUCK_MOUNT_ENGINE = new M_Operation
            {
                ArticleId            = articles.CHASSIS_TYPE_DUMP.Id,
                Name                 = "Dump-Truck: Mount Engine to Cabin",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            // assemble chassie Race Truck
            RACE_TRUCK_ASSEMBLE_LAMPS = new M_Operation
            {
                ArticleId            = articles.CHASSIS_TYPE_RACE.Id,
                Name                 = "Race-Truck: Assemble Lamps",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            RACE_TRUCK_MOUNT_ENGINE_EXTENSION = new M_Operation
            {
                ArticleId            = articles.CHASSIS_TYPE_RACE.Id,
                Name                 = "Mount Engine Extension",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            RACE_TRUCK_MOUNT_ENGINE = new M_Operation
            {
                ArticleId            = articles.CHASSIS_TYPE_RACE.Id,
                Name                 = "Race-Truck: Mount Engine to Cabin",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 30
            };

            // assemble Skeleton
            MOUNT_AXIS = new M_Operation
            {
                ArticleId            = articles.SKELETON.Id,
                Name                 = "mount poles with wheels to Skeleton",
                Duration             = 10,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            SCREW_WHEELS = new M_Operation
            {
                ArticleId            = articles.SKELETON.Id,
                Name                 = "Screw wheels onto poles",
                Duration             = 10,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            GLUE_SEMITRAILER = new M_Operation
            {
                ArticleId            = articles.SKELETON.Id,
                Name                 = "Glue Semitrailer",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 30
            };

            // assemble Truck Bed
            GLUE_SIDEWALLS = new M_Operation
            {
                ArticleId            = articles.TRUCK_BED.Id,
                Name                 = "Glue side walls and base plate together",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            MOUNT_HATCHBACK = new M_Operation
            {
                ArticleId            = articles.TRUCK_BED.Id,
                Name                 = "Mount hatchback",
                Duration             = 5,
                ResourceCapabilityId = AssemblyTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            // assemble Race Wing
            RACE_WING_CUT = new M_Operation
            {
                ArticleId            = articles.RACE_WING.Id,
                Name                 = "Race Wing: Cut shape",
                Duration             = 10,
                ResourceCapabilityId = SawTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            RACE_WING_DRILL = new M_Operation
            {
                ArticleId            = articles.RACE_WING.Id,
                Name                 = "Race Wing: Drill Mount Holes",
                Duration             = 5,
                ResourceCapabilityId = DrillTools.GetNext().Id,
                HierarchyNumber      = 20
            };
            // Engine Race Extension
            RACE_EXTENSION_CUT = new M_Operation
            {
                ArticleId            = articles.ENGINE_RACE_EXTENSION.Id,
                Name                 = "Engine Race Extension: Cut shape",
                Duration             = 10,
                ResourceCapabilityId = SawTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            RACE_EXTENSION_DRILL = new M_Operation
            {
                ArticleId            = articles.ENGINE_RACE_EXTENSION.Id,
                Name                 = "Engine Race Extension: Drill Mount Holes",
                Duration             = 5,
                ResourceCapabilityId = DrillTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            // side Walls for Truck-bed
            SIDEWALL_LONG_CUT = new M_Operation
            {
                ArticleId            = articles.SIDEWALL_LONG.Id,
                Name                 = "Side wall long: Cut long side",
                Duration             = 10,
                ResourceCapabilityId = SawTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            SIDEWALL_LONG_DRILL = new M_Operation
            {
                ArticleId            = articles.SIDEWALL_LONG.Id,
                Name                 = "Side wall long: Drill mount holes",
                Duration             = 5,
                ResourceCapabilityId = DrillTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            SIDEWALL_SHORT_CUT = new M_Operation
            {
                ArticleId            = articles.SIDEWALL_SHORT.Id,
                Name                 = "Side wall short: Cut short side",
                Duration             = 5,
                ResourceCapabilityId = SawTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            SIDEWALL_SHORT_DRILL = new M_Operation
            {
                ArticleId            = articles.SIDEWALL_SHORT.Id,
                Name                 = "Side wall short: Drill mount holes",
                Duration             = 5,
                ResourceCapabilityId = DrillTools.GetNext().Id,
                HierarchyNumber      = 20
            };

            BASEPLATE_TRUCK_BED_CUT = new M_Operation
            {
                ArticleId            = articles.BASEPLATE_TRUCK_BED.Id,
                Name                 = "Base plate Truck-Bed: Cut Base plate Truck-Bed",
                Duration             = 10,
                ResourceCapabilityId = SawTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            BASEPLATE_TRUCK_BED_DRILL = new M_Operation
            {
                ArticleId            = articles.BASEPLATE_TRUCK_BED.Id,
                Name                 = "Base plate Truck-Bed: Drill mount holes",
                Duration             = 5,
                ResourceCapabilityId = DrillTools.GetNext().Id,
                HierarchyNumber      = 20
            };
            // Eengin Block
            ENGINE_BLOCK_CUT = new M_Operation
            {
                ArticleId            = articles.ENGINE_BLOCK.Id,
                Name                 = "Engine-Block: Cut Engine-Block",
                Duration             = 10,
                ResourceCapabilityId = SawTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            ENGINE_BLOCK_DRILL = new M_Operation
            {
                ArticleId            = articles.ENGINE_BLOCK.Id,
                Name                 = "Engine-Block: Drill mount holes",
                Duration             = 5,
                ResourceCapabilityId = DrillTools.GetNext().Id,
                HierarchyNumber      = 20
            };
            // cabin
            CABIN_CUT = new M_Operation
            {
                ArticleId            = articles.CABIN.Id,
                Name                 = "Cabin: Cut Cabin",
                Duration             = 10,
                ResourceCapabilityId = SawTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            CABIN_DRILL = new M_Operation
            {
                ArticleId            = articles.CABIN.Id,
                Name                 = "Cabin: Drill mount holes",
                Duration             = 5,
                ResourceCapabilityId = DrillTools.GetNext().Id,
                HierarchyNumber      = 20
            };
            // Base Plate
            BASE_PLATE_CUT = new M_Operation
            {
                ArticleId            = articles.BASE_PLATE.Id,
                Name                 = "Base plate: Cut Base plate",
                Duration             = 10,
                ResourceCapabilityId = SawTools.GetNext().Id,
                HierarchyNumber      = 10
            };

            BASE_PLATE_DRILL = new M_Operation
            {
                ArticleId            = articles.BASE_PLATE.Id,
                Name                 = "Base plate: drill holes for axis mount",
                Duration             = 5,
                ResourceCapabilityId = DrillTools.GetNext().Id,
                HierarchyNumber      = 20
            };
        }
 internal Enumerator(AsEnumerableEnumerable <TEnumerable, TEnumerator, TSource> enumerable)
 {
     enumerator = enumerable.source.GetValueEnumerator();
 }