예제 #1
0
        public override void CompleteObject(Brokermqtt o, DataAccessLayer dal, bool completeRelatedObjects = true)
        {
            if (o == null)
            {
                throw new ArgumentNullException("brokermqtt");
            }

            var dao        = new BrokermqttDal(dal);
            var connOpened = dal.ConnectionOpened;

            try
            {
                dal.OpenConnection(!connOpened);
                dao.CompleteObject(o);
                CompleteRelatedObjects(o, dal);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dal.CloseConnection(!connOpened);
            }
        }
예제 #2
0
        public List <Brokermqtt> GetList()
        {
            using (var dal = DatabaseConnection.GetDataAccessLayer())
            {
                var dao = new BrokermqttDal(dal);

                try
                {
                    return(dao.GetList());
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
예제 #3
0
        public void Delete(Brokermqtt o)
        {
            using (var dal = DatabaseConnection.GetDataAccessLayer())
            {
                var dao = new BrokermqttDal(dal);

                try
                {
                    dao.Delete(o);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
예제 #4
0
        public List <Brokermqtt> GetList(string conditions = null, bool completeRelatedObjects = false)
        {
            using (var dal = DatabaseConnection.GetDataAccessLayer())
            {
                var dao = new BrokermqttDal(dal);

                try
                {
                    var list = dao.GetList(conditions);
                    foreach (Brokermqtt p in list)
                    {
                        CompleteRelatedObjects(p, dal);
                    }
                    return(list);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
예제 #5
0
        public Brokermqtt GetObject(int idBrokermqtt)
        {
            using (var dal = DatabaseConnection.GetDataAccessLayer())
            {
                var dao = new BrokermqttDal(dal);

                try
                {
                    dal.OpenConnection();
                    var teste = dao.GetObject(idBrokermqtt);
                    CompleteRelatedObjects(teste, dal);
                    return(teste);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    dal.CloseConnection();
                }
            }
        }
예제 #6
0
        public void Save(Brokermqtt o)
        {
            using (var dal = DatabaseConnection.GetDataAccessLayer())
            {
                var dao = new BrokermqttDal(dal);

                try
                {
                    if (!o.Persisted)
                    {
                        dao.Insert(o);
                    }
                    else
                    {
                        dao.Update(o);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }