コード例 #1
0
ファイル: frm_edit_scheme.cs プロジェクト: AnhTran30/KLTN
 public frm_edit_scheme(ProbDatabase probDatabase_2, string scheme)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     this.probDatabase = probDatabase_2;
     this.scheme       = scheme;
 }
コード例 #2
0
ファイル: DALProbDatabase.cs プロジェクト: AnhTran30/KLTN
        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;

        }
コード例 #3
0
 public frm_Delete_relation(ProbDatabase probDatabase, string relationName)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     this.probDatabase = probDatabase;
     this.relationName = relationName.ToLower();
 }
コード例 #4
0
ファイル: frm_delete_query.cs プロジェクト: AnhTran30/KLTN
 public frm_delete_query(ProbDatabase probDatabase, string QueryName)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     this.probDatabase = probDatabase;
     this.QueryName    = QueryName;
 }
コード例 #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();
 }
コード例 #6
0
ファイル: DALProbDatabase.cs プロジェクト: AnhTran30/KLTN
        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;
        }