Ejemplo n.º 1
0
 public frm_edit_scheme(ProbDatabase probDatabase_2, string scheme)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     this.probDatabase = probDatabase_2;
     this.scheme       = scheme;
 }
Ejemplo n.º 2
0
        internal static ProbDatabase OpenExistingDatabase(ProbDatabase probDatabase)
        {
            ProbDatabase newProbDatabase = new ProbDatabase(probDatabase);
            try
            {

                List<ProbScheme> Schemes = new List<ProbScheme>();
                Schemes = new ProbScheme().getAllScheme();
                newProbDatabase.Schemes = Schemes;


                List<ProbRelation> relations = new List<ProbRelation>();
                relations = new ProbRelation().getAllRelation();
                newProbDatabase.Relations = relations;

                List<ProbQuery> querys = new List<ProbQuery>();
                querys = new ProbQuery().getAllQuery();
                newProbDatabase.Queries = querys;


            }
            catch (Exception)
            {
                return null;
            }
            return newProbDatabase;

        }
Ejemplo n.º 3
0
 public frm_Delete_relation(ProbDatabase probDatabase, string relationName)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     this.probDatabase = probDatabase;
     this.relationName = relationName.ToLower();
 }
Ejemplo n.º 4
0
 public frm_delete_query(ProbDatabase probDatabase, string QueryName)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     this.probDatabase = probDatabase;
     this.QueryName    = QueryName;
 }
Ejemplo n.º 5
0
 public frm_Delete_Scheme(ProbDatabase probDatabase, string SchemeName)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     this.probDatabase = probDatabase;
     this.SchemeName   = SchemeName.ToLower();
     this.list         = this.probDatabase.ListOfSchemeNameToLower();
 }
Ejemplo n.º 6
0
        internal static bool SaveDatabase(ProbDatabase probDatabase)
        {
            try
            {
                //Drop data base
                DropDatabaseData();
                int schemeID = 0;
                int attributeID = 0;

                #region Save Scheme
                foreach (ProbScheme scheme in probDatabase.Schemes)
                {
                    /// Save Schemes 
                    schemeID++;
                    scheme.SchemeName = scheme.SchemeName.ToLower().Trim();
                    scheme.IDScheme = schemeID;
                    scheme.Insert();


                    ///Save attributes of the scheme to the System Attribute Table
                    foreach (ProbAttribute attr in scheme.Attributes)
                    {
                        attributeID++;
                        attr.probScheme = scheme;
                        attr.AttributeName = attr.AttributeName.Trim();
                        attr.IDAttribute = attributeID;
                        attr.Insert();
                    }
                }
                #endregion

                #region // Save Relations //


                int relationID = 0;
                foreach (ProbRelation relation in probDatabase.Relations)
                {
                    relationID++;
                    relation.IDRelation = relationID;
                    relation.RelationName = relation.RelationName.ToLower().Trim();
                    relation.InsertSystemRelation();

                    /// Create Table <Relation> //
                    relation.CreateTableRelation();

                    // Insert tuples into Talbe <Relation> //
                    relation.InsertTupleIntoTableRelation();

                }

                #endregion

                #region Save Query
                int queryID = 0;
                foreach (ProbQuery item in probDatabase.Queries)
                {

                    queryID++;
                    item.QueryName = item.QueryName.ToLower().Trim();
                    item.IDQuery = queryID;
                    item.Insert();
                }

                #endregion


            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
                return false;
            }
            return true;
        }