Beispiel #1
0
        /// <summary>
        /// Converts the list of students into a c.Flip object, to be inserted as a table in the db.
        /// </summary>
        private void ConvertListIntoFlip()
        {
            string[] colNames = new string[5];
            colNames[0] = "name";
            colNames[1] = "gender";
            colNames[2] = "age";
            colNames[3] = "dob";
            colNames[4] = "outstandingfee";

            object[] colData = new object[5];

            string[] names = new string[StudentNames.Count];
            string[] genders = new string[StudentNames.Count];
            int[] ages = new int[StudentNames.Count];
            DateTime[] dobs = new DateTime[StudentNames.Count];
            double[] outstandingFees = new double[StudentNames.Count];

            int a = 0;
            foreach (Student stud in StudentNames)
            {
                names[a] = stud.Name;
                genders[a] = stud.Gender;
                ages[a] = stud.Age;
                dobs[a] = stud.DOB;
                outstandingFees[a] = stud.OutStandingFee;

                a++;
            }

            colData[0] = names;
            colData[1] = genders;
            colData[2] = ages;
            colData[3] = dobs;
            colData[4] = outstandingFees;

            c.Dict dict = new c.Dict(colNames, colData);
            c.Flip flipData = new c.Flip(dict);

            _queries.LoadStudentsToDB(flipData);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a c.Flip object only containing the version number of a fictional
        /// db, then loads it into the q session.
        /// </summary>
        private void ConvertDBVersionDataIntoFlip()
        {
            string[] colnames = new string[1];
            colnames[0] = "dbversion";

            object[] colData = new object[1];
            string[] dbVersion = new string[1];

            dbVersion[0] = "dbversion";

            colData[0] = dbVersion;

            c.Dict dict = new c.Dict(colnames, colData);
            c.Flip flipData = new c.Flip(dict);
            _queries.LoadDBVersionData(flipData);
        }