public long Add(object obj)
        {
            var objModel = JObject.Parse(obj.ToString());
            var status   = objModel.ToObject <Status>();

            if (IsDuplicate(status.Code, status.Id, status.Id) == false)
            {
                return(_statusRepository.Add(status));
            }
            else
            {
                Expression <Func <Status, bool> > res = x => x.Code == status.Code && x.CustomerId == status.CustomerId && x.IsActive == false;
                var model = _statusRepository.Get(res);

                if (model != null)
                {
                    status.Id       = model.Id;
                    status.IsActive = true;

                    _statusRepository.Detach(model);

                    _statusRepository.Update(status);
                    return(status.Id);
                }
                else
                {
                    return(0);
                }
            }
        }
Пример #2
0
        public ActionResult <IEnumerable <ComprasDTO> > Busca_status(int idstatus)
        {
            var existe = _statusRepository.Get(idstatus);

            if (existe != null)
            {
                return(new OkObjectResult(Find(_comprasRepository.FindBystatus(idstatus))));
            }
            return(new NotFoundResult());
        }
Пример #3
0
        public ActionResult <StatusEntity> Get(int id)
        {
            var statusExiste = _statusRepository.Get(id);

            if (statusExiste != null)
            {
                return(new OkObjectResult(statusExiste));
            }
            else
            {
                return(new BadRequestObjectResult("Nao existe esse ID"));
            }
        }
Пример #4
0
        public PotentialClientsModel GetViewModel(PotentialClientsModel model)
        {
            var result = _potentialClientRepository.GetIncludeFull();


            if (model.selectedStatuses != null)
            {
                if (model.selectedManagers != null && model.selectedManagers.Any())
                {
                    result = result.Where(x => model.selectedManagers.Contains(x.UserId ?? -1));
                }

                if (model.selectedStatuses.Any())
                {
                    result = result.Where(x => model.selectedStatuses.Contains(x.StatusId));
                }

                if (!string.IsNullOrEmpty(model.q))
                {
                    result = result.Where(x => x.Name.ToLower().Contains(model.q.ToLower()));
                }
            }
            else
            {//defaul filters
                model.selectedStatuses = _statusRepository.Get(RootTypes.PotentialCLient)
                                         .Where(x => !x.IsHide)
                                         .Select(x => x.Id)
                                         .ToList();

                result = result.Where(x => model.selectedStatuses.Contains(x.StatusId));

                // model.pageViewModel = new PageViewModel(result.Count(), 1, PotentialClientsModel.ItemsPerPage);
            }

            model.Pclients = result
                             //.Skip((model.pageViewModel.PageNumber-1)*PotentialClientsModel.ItemsPerPage)
                             //.Take(PotentialClientsModel.ItemsPerPage)
                             .ToList()
                             .Select(x => Map(x))
                             .OrderByDescending(x => x.Created)
                             .ToList();


            model.PStatuses = _statusRepository.Get(RootTypes.PotentialCLient);
            model.userList  = _userRepository.GetFullUsers().Where(x => x.IsManager)
                              .ToList();

            return(model);
        }
Пример #5
0
        public Status GetStatusByID(int id, string lang = "")
        {
            Status status = databasePlaceholder.Get(id, lang);

            if (status == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
            return(status);
        }
        public StatusDto Get(int id)
        {
            var status = _statusRepository.Get(id);

            if (status == null)
            {
                throw new NotFoundException("Статус не найден.", "");
            }

            return(status.MapToDtoModel());
        }
Пример #7
0
 public IEnumerable <CompraDTO> Get()
 {
     return(_compraRepository.GetAll().Select(x => new CompraDTO()
     {
         APROVADO = x.APROVADO,
         COD_COMPRA = x.COD_COMPRA,
         DATA_SOLICITACAO = x.DATA_SOLICITACAO,
         DESCRICAO = x.DESCRICAO,
         FINALIZADO = x.FINALIZADO,
         STATUS = _statusRepository.Get(x.COD_STATUS),
         USUARIO = _usuarioRepository.Get(x.COD_USUARIO),
         TITULO = x.TITULO,
         CATEGORIA = _categoriaRepository.Get(x.COD_CATEGORIA),
         ORCAMENTO = _orcamentoRepository.GetOrcamentoByCompra(x.COD_COMPRA).ToList()
     }));
 }
Пример #8
0
        public async Task <IList <CatalogViewModel> > Get()
        {
            IList <CatalogViewModel> result;

            try
            {
                result = await Task.FromResult(statusRepository.Get().Select(e => ModelFormatter.FormatStatusCatalogModel(e)).ToList());
            }
            catch
            {
                result = new List <CatalogViewModel>();
            }
            return(result);
        }
        public async Task <IActionResult> Get(string location, int top)
        {
            if (string.IsNullOrEmpty(location))
            {
                return(BadRequest("location is mandatory"));
            }

            if (top > 150)
            {
                return(BadRequest("max value for top is 150"));
            }

            if (_serviceStatus.Get(location).Status == Model.LoadStatus.StatusItems.STOPPED)
            {
                await _service.LoadUsersFromLocation(location);
            }

            var loadStatus = _serviceStatus.Get(location);

            var dataLoaded = _repository.GetOrderedByReposAndCommits(location, top);

            return(Ok(new UserRankingResult(dataLoaded, loadStatus)));
        }
Пример #10
0
        public IEnumerable <Status> GetAll()
        {
            IEnumerable <Status> items = StatusRepository.Get();

            return(items);
        }
Пример #11
0
 public Estado Get(Guid id)
 {
     return(_statusRepository.Get(id));
 }
Пример #12
0
 public IEnumerable <Status> GetAllStatuses()
 {
     return(_repository.Get().ToList());
 }
Пример #13
0
 public Status GetById(int id)
 {
     return(_statusService.Get(x => x.Id == id));
 }
Пример #14
0
 public List <Status> Get()
 {
     return(_statusRepository.Get().ToList());
 }
Пример #15
0
 public IEnumerable <Status> GetStatuses()
 {
     return(_StatusRepository.Get());
 }
Пример #16
0
 public List <Status> Get()
 {
     return(_iStatusRepository.Get());
 }
 public Task <IEnumerable <models.Status> > GetStatuses()
 {
     return(Task.Run <IEnumerable <models.Status> >(() => {
         return statusRepository.Get();
     }));
 }
Пример #18
0
        public IEnumerable <Status> GetAll()
        {
            IEnumerable <Status> result = _StatusDB.Get();

            return(result);
        }
 public Status Get(long id)
 {
     return(Repo.Get(id));
 }
Пример #20
0
 public StatusEntity Get(int id)
 {
     return(_statusRepository.Get(id));
 }
Пример #21
0
        public Status GetStatusById(int id)
        {
            var obj = _statusRepository.Get(c => c.Id == id);

            return(obj);
        }
Пример #22
0
 public void OnGet(int id)
 {
     status = _statusRepository.Get(id);
 }
Пример #23
0
        public object GetAll()
        {
            var queryValues = Request.RequestUri.ParseQueryString();

            int page  = Convert.ToInt32(queryValues["page"]);
            int start = Convert.ToInt32(queryValues["start"]);
            int limit = Convert.ToInt32(queryValues["limit"]);
            int id    = Convert.ToInt32(queryValues["id"]);
            int orden = Convert.ToInt32(queryValues["orden"]);


            #region Configuramos el orden de la consulta si se obtuvo como parametro
            string strOrder = !string.IsNullOrWhiteSpace(queryValues["sort"]) ? queryValues["sort"] : "";
            strOrder = strOrder.Replace('[', ' ');
            strOrder = strOrder.Replace(']', ' ');

            Sort sort;

            if (!string.IsNullOrWhiteSpace(strOrder))
            {
                sort = JsonConvert.DeserializeObject <Sort>(strOrder);
            }
            else
            {
                sort = new Sort();
            }
            #endregion

            string query = !string.IsNullOrWhiteSpace(queryValues["query"]) ? queryValues["query"] : "";

            int totalRecords = 0;

            try
            {
                if (id == 0)
                {
                    object         json;
                    string         msgError = "";
                    IList <Status> lista;

                    lista = repository.GetList(query, sort, page, start, limit, ref totalRecords, ref msgError);

                    json = new
                    {
                        total   = totalRecords,
                        data    = lista,
                        success = true
                    };

                    return(json);
                }
                else
                {
                    string        msgError = "";
                    Models.Status estatus  = repository.Get(id, ref msgError);

                    object json = new
                    {
                        data    = estatus,
                        success = true,
                        message = msgError
                    };

                    return(json);
                }
            }
            catch (Exception ex)
            {
                LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message);

                object error = new { message = ex.Message };

                object json = new
                {
                    message = ex.Message,
                    success = false
                };

                return(json);
            }
        }
        public Status GetStatus(int ID)
        {
            var result = _statusRepository.Get(ID);

            return(result);
        }