Exemple #1
0
    /// <summary>
    /// Καλείται όταν πατηθεί ΟΚ από το Modal Συναρτησιακής Εξάρτησης.
    /// </summary>
    protected void btnNewFDOKClick(object sender, EventArgs e)
    {
        FD fd = new FD();

        foreach (GridViewRow item in gridViewLeftFD.Rows)
        {
            if ((item.Cells[0].FindControl("checkBoxLeftFD") as CheckBox).Checked)
            {
                fd.AddLeft(attrList[item.RowIndex]);
            }
        }

        foreach (GridViewRow item in gridViewRightFD.Rows)
        {
            if ((item.Cells[0].FindControl("checkBoxRightFD") as CheckBox).Checked)
            {
                fd.AddRight(attrList[item.RowIndex]);
            }
        }

        if (FDCreate(fd))
        {
            populateFdGridView(fdList);
            log.InnerText = "FD inserted: " + fd.ToString();
            ClientScript.RegisterStartupScript(Page.GetType(), "alertBoxSuccess", " $('#alertBoxSuccessText').html('<strong>Επιτυχία!</strong> Η συναρτησιακή εξάρτηση δημιουργήθηκε επιτυχώς!'); $('#alertBoxSuccess').show();", true);
        }
        else
        {
            log.InnerText = "Cannot insert FD: FD already exists..";
            ClientScript.RegisterStartupScript(Page.GetType(), "alertBoxFail", " $('#alertBoxFailText').html('<strong>Σφάλμα!</strong> Αδυναμία δημιουργίας συναρτησιακής εξάρτησης. Η συναρτησιακή εξάρτηση υπάρχει ήδη..'); $('#alertBoxFail').show();", true);
        }
    }
Exemple #2
0
    /// <summary>
    /// Η επεξεργασμένη πλέον συναρτησιακή εξάρτηση προστίθεται στην λίστα fdList.
    /// </summary>
    protected void btnEditFDΟΚClick(object sender, EventArgs e)
    {
        int index = Int32.Parse(gridViewFDHiddenField.Value);

        if (index >= 0)
        {
            FD fd = new FD(); // Η προσωρινή.

            foreach (GridViewRow item in gridViewEditLeftFD.Rows)
            {
                if ((item.Cells[0].FindControl("checkBoxEditLeftFD") as CheckBox).Checked)
                {
                    fd.AddLeft(attrList[item.RowIndex]);
                }
            }

            foreach (GridViewRow item in gridViewEditRightFD.Rows)
            {
                if ((item.Cells[0].FindControl("checkBoxEditRightFD") as CheckBox).Checked)
                {
                    fd.AddRight(attrList[item.RowIndex]);
                }
            }

            if (!FDExists(fd, index))
            {
                fdList[index] = fd;

                populateFdGridView(fdList);
                log.InnerText = "FD Updated: " + fd.ToString();
                ClientScript.RegisterStartupScript(Page.GetType(), "alertBoxSuccess", " $('#alertBoxSuccessText').html('<strong>Επιτυχία!</strong> Η συναρτησιακή εξάρτηση επεξεργάστηκε επιτυχώς!'); $('#alertBoxSuccess').show();", true);
            }
            else
            {
                log.InnerText = "Cannot insert FD: FD already exists..";
                ClientScript.RegisterStartupScript(Page.GetType(), "alertBoxFail", " $('#alertBoxFailText').html('<strong>Σφάλμα!</strong> Αδυναμία επεξεργασίας συναρτησιακής εξάρτησης. Η συναρτησιακή εξάρτηση υπάρχει ήδη..'); $('#alertBoxFail').show();", true);
            }
        }
        else
        {
            log.InnerText = "You must select an attribute first.";
            ClientScript.RegisterStartupScript(Page.GetType(), "alertBoxWarning", " $('#alertBoxWarningText').html('<strong>Προσοχή!</strong> Πρέπει να επιλέξετε μια συναρτησιακή εξάρτηση.'); $('#alertBoxWarning').show();", true);
            return;
        }
    }
Exemple #3
0
    /// <summary>
    /// Μέθοδος που φορτώνει το παράδειγμα με το δοσμένο όνομα.
    /// </summary>
    /// <param name="selectedSchema">Το όνομα του παραδείγματος.</param>
    private bool LoadSelectedSchema(string selectedSchema)
    {
        lblSchemaId.Text = dbConnect.getSchemaId(selectedSchema).ToString();
        dbConnect.TrackStat(selectedSchema, lblSchemaId.Text, "nLoad");

        string[] lines;
        try
        {
            // Φορτώνεται το αρχείο το οποίο έχει επιλεχθεί.
            lines = System.IO.File.ReadAllLines(Directory.GetCurrentDirectory() + "/Schemas/" + selectedSchema);
        }
        catch (Exception e)
        {
            return(false);
        }


        int i = 0; // τρέχων γραμμή.

        // Η 1η εγγραφή πρέπει να φέρει την ένδειξη NOR.
        if (lines[i++] != "NOR")
        {
            log.InnerText = "Μη έγκυρη μορφή αρχείου σχήματος.";
            return(false);
        }

        // Καθαρίζω τις λίστες για να προσθέσω τα καινούργια δεδομένα.
        attrList.Clear();
        fdList.Clear();

        i++; //προσπερνάω συμβατότητα.

        // Διαβάζεται η περιγραφή του σχήματος.
        string schemaDescription = lines[i++];

        // Διαβάζεται το πλήθος των γνωρισμάτων.
        int numberOfAttributes = Int32.Parse(lines[i++]);

        // Διαβάζονται ένα προς ένα τα γνωρίσματα (όνομα και τύπος) για κάθε ένα από αυτά, δημιουργείται ένα αντικείμενο τύπου Attr.
        string sName, sType;

        for (int j = 0; j < numberOfAttributes; j++)
        {
            sName = lines[i++];
            sType = lines[i++];
            AttrCreate(sName, sType);
        }

        // Διαβάζεται το πλήθος των συναρτησιακών εξαρτήσεων και για κάθε ένα από αυτά δημιουργείται ένα αντικείμενο FD.
        int numberofFDs = Int32.Parse(lines[i++]);

        for (int j = 0; j < numberofFDs; j++)
        {
            FD fd = new FD();

            // Διαβάζεται η ένδειξη αν η συναρτησιακή εξάρτηση είναι τετριμμένη.
            fd.IsTrivial = bool.Parse(lines[i++]);

            // Προσδιορίζεται το πλήθος των γνωρισμάτων που υπάρχουν στα δύο σκέλη της συναρτησιακής εξάρτησης.
            int left;
            int right;
            left  = Int32.Parse(lines[i++]);
            right = Int32.Parse(lines[i++]);

            // Προσδιορίζεται το αντικείμενο attr που αντιστοιχεί στη μεταβλητή str και προστίθεται στο αριστερό ή το δεξί σκέλος της συναρτησιακής εξάρτησης.
            Attr attrRead;
            string str;
            for (int y = 0; y < left; y++)
            {
                str      = lines[i++];
                attrRead = AttrGetObject(str);
                fd.AddLeft(attrRead);
            }
            for (int y = 0; y < right; y++)
            {
                str      = lines[i++];
                attrRead = AttrGetObject(str);
                fd.AddRight(attrRead);
            }
            FDCreate(fd);
        }

        // Φόρτωση γνωρισμάτων στον πίνακα γνωρισμάτων και των συναρτησιακών εξαρτήσεων.
        populateAttrGridView(attrList);
        populateFdGridView(fdList);

        lblSchemaName.Text        = selectedSchema;
        lblSchemaDescription.Text = schemaDescription;

        return(true);
    }