public bool Update(T entities, ref Exception exception)
        {
            ConsoleMessage.ConsoleWrite("Admin - Update(T entities, ref Exception exception) - Çalıştı");
            using (ISession _session = createSession)
            {
                using (ITransaction _transaction = _session.BeginTransaction())
                {
                    try
                    {
                        _session.Update(entities);
                        _transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        if (!_transaction.WasCommitted)
                        {
                            _transaction.Rollback();
                        }

                        exception = ex;
                        return(false);
                    }
                }
            }
            return(true);
        }
        public bool Delete(T entities, ref Exception exception)
        {
            ConsoleMessage.ConsoleWrite("Admin - Delete(T entities, ref Exception exception) - Çalıştı.");

            using (ISession _session = createSession)
            {
                using (ITransaction _transaction = _session.BeginTransaction())
                {
                    try
                    {
                        _session.Delete(entities);
                        _transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        if (!_transaction.WasCommitted)
                        {
                            _transaction.Rollback();
                        }

                        exception = ex;
                        ConsoleMessage.ConsoleWrite("Delete(T entities, ref Exception exception) : " + ex.Message + ", İşlem Geri Alındı.");
                        return(false);
                    }
                }
            }
            return(true);
        }
        public bool Insert(IEnumerable <T> entities, ref Exception exception)
        {
            ConsoleMessage.ConsoleWrite("Admin - Insert(IEnumerable<T> entities, ref Exception exception) - Çalıştı");
            using (ISession _session = createSession)
            {
                using (ITransaction _transaction = _session.BeginTransaction())
                {
                    try
                    {
                        foreach (T entity in entities)
                        {
                            _session.Save(entity);
                        }

                        _transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        if (!_transaction.WasCommitted)
                        {
                            _transaction.Rollback();
                        }

                        exception = ex;
                        return(false);
                    }
                }
            }

            return(true);
        }
示例#4
0
        public bool ReturnModelInsert(T entities, ref T resultModel, ref Exception excection)
        {
            ConsoleMessage.ConsoleWrite("ReturnModelInsert(T entities, ref T resultModel, ref Exception excection) - Çalıştı.");

            using (ISession _session = createSession)
            {
                using (ITransaction _transaction = _session.BeginTransaction())
                {
                    try
                    {
                        _session.Save(entities);
                        _transaction.Commit();

                        resultModel = entities;
                    }
                    catch (Exception ex)
                    {
                        if (!_transaction.WasCommitted)
                        {
                            _transaction.Rollback();
                        }

                        excection = ex;

                        ConsoleMessage.ConsoleWrite("ReturnModelInsert(T entities, ref T resultModel, ref Exception excection) - Hata Oluştu : " + ex.Message + ", İşlem Geri Alındı.");

                        return(false);
                    }
                }
            }
            return(true);
        }
示例#5
0
        public bool Update(IEnumerable <T> entities, ref Exception exception)
        {
            ConsoleMessage.ConsoleWrite("Update(IEnumerable<T> entities, ref Exception exception) - Çalıştı.");

            using (ISession _session = createSession)
            {
                using (ITransaction _transaction = _session.BeginTransaction())
                {
                    try
                    {
                        foreach (T entity in entities)
                        {
                            _session.Update(entity);
                        }

                        _transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        if (!_transaction.WasCommitted)
                        {
                            _transaction.Rollback();
                        }

                        exception = ex;
                        ConsoleMessage.ConsoleWrite("Update(IEnumerable<T> entities, ref Exception exception) - Hata Oluştu : " + ex.Message + " , İşlem Geri Alındı.");
                        return(false);
                    }
                }
            }

            return(true);
        }
 public bool GetList(Expression <Func <T, bool> > expression, ref List <T> List, ref Exception exception)
 {
     ConsoleMessage.ConsoleWrite("Admin - GetList(Expression<Func<T, bool>> expression, ref List<T> List, ref Exception exception) - Çalıştı");
     using (ISession session = createSession)
     {
         try
         {
             List = session.Query <T>().Where(expression).ToList();
         }
         catch (Exception ex)
         {
             exception = ex;
             return(false);
         }
     }
     return(true);
 }
 public bool GetById(int id, ref T gyIdModel, ref Exception exception)
 {
     ConsoleMessage.ConsoleWrite("Admin - GetById(int id, ref T gyIdModel, ref Exception exception) - Çalıştı");
     using (ISession _session = createSession)
     {
         try
         {
             gyIdModel = _session.Get <T>(id);
         }
         catch (Exception ex)
         {
             exception = ex;
             return(false);
         }
     }
     return(true);
 }
示例#8
0
        public bool GetList(ref List <T> List, ref Exception exception)
        {
            ConsoleMessage.ConsoleWrite("GetList(BusinessLayerResult<T> List, ref Exception exception) - Çalıştı.");

            using (ISession _session = createSession)
            {
                try
                {
                    List = _session.Query <T>().ToList();
                }
                catch (Exception ex)
                {
                    exception = ex;
                    ConsoleMessage.ConsoleWrite("GetList(BusinessLayerResult<T> List, ref Exception exception) - Hata Oluştu :." + ex.Message);
                    return(false);
                }
            }
            return(true);
        }