Esempio n. 1
0
 static void EntityType_BeforeDel(Xy.Data.Procedure procedure, Xy.Data.DataBase DB)
 {
     short inID = Convert.ToInt16(procedure.GetItem("ID"));
     EntityType _type = GetInstance(inID);
     System.Data.DataTable _childTypies = GetChildType(inID);
     foreach (System.Data.DataRow _childTypeRow in _childTypies.Rows) {
         EntityType _childType = new EntityType();
         _childType.Fill(_childTypeRow);
         Del(_childType.ID);
     }
     StringBuilder _dropTableProcedure = new StringBuilder();
     foreach (System.Data.DataRow _multiAttrsRow in EntityAttribute.GetByTypeID(inID).Rows) {
         EntityAttribute _attr = new EntityAttribute();
         _attr.Fill(_multiAttrsRow);
         if (_attr.IsMultiple) {
             _dropTableProcedure.AppendLine(string.Format(_commandPartern_Del, "Entity_" + _type.Key + "_" + _attr.Key));
         }
     }
     _dropTableProcedure.AppendLine(string.Format(_commandPartern_Del, "Entity_" + _type.Key));
     Xy.Data.Procedure _deleteRelativeTable = new Xy.Data.Procedure("DeleteRelativeTable", _dropTableProcedure.ToString());
     Xy.Data.Procedure _deleteRelativeEntityBase = new Xy.Data.Procedure("DeleteRelativeEntityBase", "Delete from [EntityBase] where [TypeID] = @ID", new Xy.Data.ProcedureParameter[] { new Xy.Data.ProcedureParameter("ID", System.Data.DbType.Int64) });
     _deleteRelativeEntityBase.SetItem("ID", inID);
     _deleteRelativeTable.InvokeProcedure(DB);
     _deleteRelativeEntityBase.InvokeProcedure(DB);
 }
Esempio n. 2
0
 public static EntityType GetInstance(short inID, Xy.Data.DataBase DB = null)
 {
     System.Data.DataTable result = Get(inID, DB);
     if (result.Rows.Count > 0) {
         EntityType temp = new EntityType();
         temp.Fill(result.Rows[0]);
         return temp;
     }
     return null;
 }