コード例 #1
0
        public override global::System.Data.DataSet Clone()
        {
            rows cln = ((rows)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
コード例 #2
0
        public string insertRow(rows newRow, out Guid rowId
                                , string tag = "")
        {
            string ret;

            newRow.rowId = getNewId("rows", tag);
            rowId        = newRow.rowId;
            ret          = rowL.Insert(newRow);
            return(ret);
        }
コード例 #3
0
            public tables(int row, int col, int sizes, string titles)
            {
                int i = 0;

                rrows = new rows[row];
                size  = sizes;
                for (i = 0; i < row; i++)
                {
                    rrows[i] = new rows(col);
                }
                title = titles;
            }
コード例 #4
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            rows ds = new rows();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
コード例 #5
0
        public JsonResult GetTest(int pageSize, int pageNumber, string searchString)
        {
            string resultMeeting = string.Empty;
            //string resultMeeting = GetGreeting("小强", ChineseGreeting);
            //GreetingManager greetingManager = new GreetingManager();
            //resultMeeting = greetingManager.GetGreeting("John", EnglishGreeting);
            //resultMeeting += greetingManager.GetGreeting("强", ChineseGreeting);
            GreetingDelegate greetingDelegate;

            greetingDelegate  = EnglishGreeting;
            greetingDelegate += ChineseGreeting;
            resultMeeting     = greetingDelegate("Jon");
            resultMeeting     = greetingDelegate("强");

            //resultMeeting += greetingManager.GetGreeting("John", EnglishGreeting);
            List <rows> list = new List <rows>();

            for (int i = 0 + (pageSize - 10); i < pageSize * pageNumber; i++)
            {
                rows r = new rows();
                r.id   = "TEST" + i.ToString();
                r.link = "www.baidu.com";
                r.zwmc = "ZWMC" + i.ToString();
                r.gsmc = "GSMC" + i.ToString();
                r.zwyx = "ZWYX" + i.ToString();
                r.gzdd = "GZDD" + i.ToString();
                r.gxsj = "GXSJ" + i.ToString();
                list.Add(r);
            }

            Test t = new Test();

            t.total        = pageSize * 2;
            t.rows         = list;
            t.searchString = searchString;
            t.meeting      = resultMeeting;


            return(Json(t, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
 Assert.Equal(expectedList, hintFieldCalculator.FindSurroundingInBoundCells(currentRow, currentCol, rows, cols));
コード例 #7
0
        //protected string deleteDataTable(DataTable dt)
        //{
        //    string ret = "";
        //    string tableName = DataTableName(dt);
        //    return ret;
        //}
        public string ImportDataTableSaveas(DataTable dt
                                            , string saveAsNewTablename = "", bool append = false)
        {
            string ret = "";

            Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " ImportDataTableSaveas 1");
            if (saveAsNewTablename == "")
            {
                saveAsNewTablename = DataTableName(dt);
            }
            // import datatable save as new table
            // if new table existed, append false to overwrite

            // delete target table
            if (!append)
            {
                Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " ImportDataTableSaveas 2b");
                dbBig.deleteTag(saveAsNewTablename);
                Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " ImportDataTableSaveas 2");
                dbBig.deleteTable(saveAsNewTablename);
            }

            Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " ImportDataTableSaveas 3");
            // write to tables
            tables tbl = new tables();

            tbl.tableName = saveAsNewTablename;
            Guid tableId;

            ret = dbBig.insertTable(tbl, out tableId,
                                    saveAsNewTablename);

            Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " ImportDataTableSaveas 4");
            // write to fields
            List <string>             colNames = DataTableColumnNames(dt);
            List <string>             colTypes = DataTableColumnTypes(dt);
            Dictionary <string, Guid> name2id  = new Dictionary <string, Guid>();

            for (int i = 0; i < colNames.Count && i < colTypes.Count; i++)
            {
                fields fld = new fields();
                fld.fieldName    = colNames[i];
                fld.fieldDesc    = colTypes[i];
                fld.tableId      = tableId;
                fld.defaultOrder = i + 1;
                Guid fieldId = Guid.Empty;
                ret = dbBig.insertField(fld, out fieldId,
                                        saveAsNewTablename);
                name2id.Add(fld.fieldName, fieldId);
                //Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " ImportDataTableSaveas 5 i="+i);
            }

            Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " ImportDataTableSaveas 6");
            List <Dictionary <string, string> > dtCells =
                DataTableCellValue(dt);
            int j = 0;

            foreach (Dictionary <string, string> rowCols in dtCells)
            {
                // write to rows
                Guid rowId = Guid.Empty;
                rows rw    = new rows();
                rw.tableId = tableId;
                ret        = dbBig.insertRow(rw, out rowId,
                                             saveAsNewTablename);

                if (++j % 10000 == 0)
                {
                    Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") +
                                      $" ImportDataTableSaveas 7 [{j}/{dtCells.Count}]");
                }
                // write to field values
                foreach (KeyValuePair <string, string> pair in rowCols)
                {
                    fieldValues fv = new fieldValues();
                    fv.rowId      = rowId;
                    fv.fieldId    = name2id[pair.Key];
                    fv.fieldValue = pair.Value;
                    ret           = dbBig.insertFieldValue(fv);
                }
            }
            Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " ImportDataTableSaveas 8 end");
            return(ret);
        }
コード例 #8
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                rows ds = new rows();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "rowDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
コード例 #9
0
 public bool isMatch(rows.IRow row)
 {
     return this.condition.getResult(row);
 }
コード例 #10
0
 public SparseMatrix(IEnumerable <int> rows, IEnumerable <int> cols, IEnumerable <float> values, (int rows, int cols) dims) : this(Combine(rows, cols, values), dims)
コード例 #11
0
ファイル: GridLayout.cs プロジェクト: yesbb12/ParallelBFS
        GetRowsAndColumns
        (
            ICollection <IVertex> oVerticesToLayOut,
            LayoutContext oLayoutContext,
            out Int32 iRows,
            out Int32 iColumns
        )
        {
            Debug.Assert(oVerticesToLayOut != null);
            Debug.Assert(oLayoutContext != null);
            AssertValid();

        #if false
            Some definitions:

            W = rectangle width

                H = rectangle height

                    A = rectangle aspect ratio = W / H

                                                 V = number of vertices in graph

                                                     R = number of grid rows

                                                         C = number of grid columns


                                                             First simulataneous equation, allowing R and C to be fractional for
now:

            R * C = V


                    Second simulataneous equation:

                    C / R = A


                            Combining these equations yields:

                            1 / 2
                            C = (V * A)
        #endif

            Int32 V = oVerticesToLayOut.Count;

            // Compute the aspect ratio.

            RectangleF oRectangleF = oLayoutContext.GraphRectangle;
            Debug.Assert(oRectangleF.Height != 0);
            Double A = oRectangleF.Width / oRectangleF.Height;

            Double C = Math.Sqrt(V * A);
            Debug.Assert(A != 0);
            Double R = C / A;

            // Try the floor/ceiling combinations.

            // C floor, R floor

            iColumns = (Int32)Math.Floor(C);
            iRows    = (Int32)Math.Floor(R);

            if (RowsAndColumnsAreSufficient(iRows, iColumns, V))
            {
                return;
            }

            // C floor, R ceiling

            iRows++;

            if (RowsAndColumnsAreSufficient(iRows, iColumns, V))
            {
                return;
            }

            // C ceiling, R floor

            iColumns = (Int32)Math.Ceiling(C);
            iRows    = (Int32)Math.Floor(R);

            if (RowsAndColumnsAreSufficient(iRows, iColumns, V))
            {
                return;
            }

            // C ceiling, R ceiling

            iRows++;

            Debug.Assert(RowsAndColumnsAreSufficient(iRows, iColumns, V));
        }