public DashboardViewModel GetDataDashboard()
        {
            DashboardViewModel data = new DashboardViewModel();

            try
            {
                _uow.Open(DBConnection.BMIERP);

                var repo = new mstLogRepository(_uow);
                data.GetRequest    = repo.ReadByFilter(x => x.RequestMethod == "GET").ToList().Count();
                data.PutRequest    = repo.ReadByFilter(x => x.RequestMethod == "PUT").ToList().Count();
                data.PostRequest   = repo.ReadByFilter(x => x.RequestMethod == "POST").ToList().Count();
                data.DeleteRequest = repo.ReadByFilter(x => x.RequestMethod == "DELETE").ToList().Count();

                return(data);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                _uow.Dispose();
            }
        }
Ejemplo n.º 2
0
        public bool ValidatePrivilege(mstUserPrivilege param)
        {
            try
            {
                _uow.Open(DBConnection.BMIERP);

                var repo = new mstUserPrivilegeRepository(_uow);
                var data = repo.ReadByFilter(x => x.Token == param.Token && x.Controller == param.Controller && x.RequestMethod == param.RequestMethod).FirstOrDefault();

                if (data != null)
                {
                    return(true);
                }

                return(false);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                _uow.Dispose();
            }
        }
        public void SaveData(mstDocument doc)
        {
            try
            {
                _uow.Open(DBConnection.BMIERP);
                _uow.BeginTransaction();

                var repo = new mstDocumentRepository(_uow);
                repo.Add(doc);

                _uow.CommitTransaction();
            }
            catch (Exception)
            {
                _uow.RollbackTransaction();
                throw;
            }
            finally
            {
                _uow.Dispose();
            }
        }
Ejemplo n.º 4
0
        public void Save()
        {
            try
            {
                _uow.Open(DBConnection.BMIERP);
                _uow.BeginTransaction();

                var repo = new mstLogRepository(_uow);
                repo.Add(_mstLog);

                _uow.CommitTransaction();
            }
            catch (Exception)
            {
                _uow.RollbackTransaction();
            }
            finally
            {
                _uow.Dispose();
            }
        }
        public void Save(CarViewModel vm)
        {
            try
            {
                _uow.Open(DBConnection.BMIERP);
                _uow.BeginTransaction();

                _carDomain.SaveDataFacade(vm.car, _uow);
                vm.sparepart.CarID = vm.car.AutoID;
                _SparePartDomain.SaveDataFacade(vm.sparepart, _uow);

                _uow.CommitTransaction();
            }
            catch (Exception)
            {
                _uow.RollbackTransaction();
                throw;
            }
            finally
            {
                _uow.Dispose();
            }
        }