public PSchema Delete(PSchema pSchema) { if (!checkDelSch(pSchema)) { throw new Exception("The Schema have some relation!"); } using (var conn = ConcreteDb.Instance.BeginTransaction()) { try { //del attr AttributeService.Instance().DeleteAllAttributeByScheme(pSchema, false); if (ConcreteDb.Instance.Update("DELETE FROM SystemScheme Where ID = " + pSchema.id, false) < 0) { throw new Exception(ConcreteDb.Instance.errorMessage); } conn.Commit(); } catch (Exception ex) { conn.Rollback(); throw new Exception(String.Format("Cannot delete Schema {0} : {1}", pSchema.SchemaName, ex.Message)); } ConcreteDb.Instance.closeConnection(); } return(pSchema); }
public PSchema getSchemeById(int id) { PSchema newSchema = new PSchema(); var dts = new DataSet(); dts.Tables.Add(ConcreteDb.Instance.getDataTable("SELECT * FROM SystemScheme where ID = " + id, "system_scheme")); foreach (DataRow row in dts.Tables["system_scheme"].Rows) { IList <PAttribute> attributes = AttributeService.Instance().getListAttributeByScheme(new PSchema(Convert.ToInt16(row[0]))); newSchema = new PSchema(Convert.ToInt16(row[0]), row[1].ToString(), attributes); } return(newSchema); }
public IList <PSchema> getAllScheme() { var newSchemas = new List <PSchema>(); var dts = new DataSet(); try { dts.Tables.Add(ConcreteDb.Instance.getDataTable("SELECT * FROM SystemScheme", "system_scheme")); foreach (DataRow row in dts.Tables["system_scheme"].Rows) { IList <PAttribute> attributes = AttributeService.Instance().getListAttributeByScheme(new PSchema(Convert.ToInt16(row[0]))); newSchemas.Add(new PSchema(Convert.ToInt32(row[0]), row[1].ToString(), attributes)); } } catch { } return(newSchemas); }
public PAttribute Delete(PAttribute pAttribute) { return(AttributeService.Instance().Delete(pAttribute)); }
public PAttribute Update(PAttribute pAttribute) { return(AttributeService.Instance().Update(pAttribute)); }
public PAttribute Insert(PAttribute pAttribute) { return(AttributeService.Instance().Insert(pAttribute)); }
public int getNextIdAttr() { return(AttributeService.Instance().getNextIdAttr()); }