Ejemplo n.º 1
0
    /// <summary>
    /// 执行Json脚本
    /// </summary>
    /// <returns></returns>
    public int Execute()
    {
        string sql = GetNormalSQLString();

        gSC.Clear();

        using (Ly.Data.SQLClient Conn = new Ly.Data.SQLClient(gstrConn)) {
            Conn.ExecuteReader(sql);
            while (Conn.DataReader.Read())
            {
                Structure st = new Structure();
                for (int i = 0; i < Conn.DataReader.FieldCount; i++)
                {
                    string sName = Conn.DataReader.GetName(i);
                    st[sName] = Conn.DataReader[i].ToString();
                }
                gSC.Add(st);
            }
        }

        return(gSC.Count);
    }
        /// <summary>
        /// Removes all structures and clears all data that depends on it, either directly or indirectly.
        /// </summary>
        /// <param name="failureMechanism">The <see cref="StabilityPointStructuresFailureMechanism"/> to
        /// clear the structures from.</param>
        /// <returns>All objects that are affected by this operation.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public static IEnumerable <IObservable> RemoveAllStructures(StabilityPointStructuresFailureMechanism failureMechanism)
        {
            if (failureMechanism == null)
            {
                throw new ArgumentNullException(nameof(failureMechanism));
            }

            IEnumerable <StructuresCalculation <StabilityPointStructuresInput> > calculations =
                failureMechanism.Calculations.Cast <StructuresCalculation <StabilityPointStructuresInput> >();

            StructuresCalculation <StabilityPointStructuresInput>[] calculationWithRemovedStructure = calculations
                                                                                                      .Where(c => c.InputParameters.Structure != null)
                                                                                                      .ToArray();

            List <IObservable> changedObservables = ClearStructureDependentData(calculationWithRemovedStructure);

            StructureCollection <StabilityPointStructure> structures = failureMechanism.StabilityPointStructures;

            structures.Clear();
            changedObservables.Add(structures);

            return(changedObservables);
        }