public IList <PRelation> getAllRelation()
            {
                //"SELECT * FROM SystemRelation", "system_relation")

                var     relations = new List <PRelation>();
                DataSet dts       = new DataSet();

                try
                {
                    dts.Tables.Add(ConcreteDb.Instance.getDataTable("SELECT * FROM SystemRelation", "system_relation"));
                    foreach (DataRow row in dts.Tables["system_relation"].Rows)
                    {
                        string  relationname = row[1].ToString();
                        PSchema schema       = SchemaService.Instance().getSchemeById(Convert.ToInt16(row[2]));
                        var     tuple        = PTupleService.Instance().getAllTupleByRelationName(relationname, schema.Attributes);
                        if (tuple is null)
                        {
                            tuple = new List <PTuple>();
                        }
                        PRelation relation = new PRelation(Convert.ToInt16(row[0]), schema, relationname, tuple);
                        relations.Add(relation);
                    }
                }
                catch
                {
                }

                return(relations);
            }
            public PTuple insertEmptyTuple(PRelation pRelation, PAttribute pri, String IdTuple)
            {
                var relation = new PRelation()
                {
                    id = pRelation.id
                };

                var tupID = String.Empty;

                //insert empty tuple
                try
                {
                    var tuple = RawDatabaseService.Instance().GetTuplebyId(ref relation, tupID);
                    tuple.valueSet[$"{relation.relationName.ToLower()}.{pri.AttributeName.ToLower()}"] = new List <String>()
                    {
                        "{ " + IdTuple + " }"
                    };

                    foreach (var key in tuple.valueSet.Keys.ToList())
                    {
                        var atr = key.Substring(key.IndexOf(".") + 1);
                        var Pri = $"{relation.relationName.ToLower()}.{pri.AttributeName.ToLower()}";
                        if (!atr.Equals(ContantCls.emlementProb, StringComparison.CurrentCultureIgnoreCase) &&
                            key != Pri)
                        {
                            tuple.valueSet[key] = new List <String>()
                            {
                                "{ Insert Data }"
                            };
                        }
                    }
                    PTupleService.Instance().Insert(tuple, relation);
                    return(tuple);
                }
                catch (Exception Ex)
                {
                    return(null);
                }
            }
 public PTuple insertEmptyTuple(PRelation pRelation, PAttribute pri, String idTuple)
 {
     return(PTupleService.Instance().insertEmptyTuple(pRelation, pri, idTuple));
 }
 public PTuple Update(PTuple pTuple, PRelation pRelation, String key)
 {
     return(PTupleService.Instance().Update(pTuple, pRelation, key));
 }
 public PTuple Insert(PTuple pTuple, PRelation pRelation)
 {
     return(PTupleService.Instance().Insert(pTuple, pRelation));
 }
 public bool DeleteTupleById(PRelation pRelation, PTuple pTuple)
 {
     return(PTupleService.Instance().DeleteTupleById(pRelation, pTuple));
 }