Ejemplo n.º 1
0
        public async void BuscarInformacoesIniciais()
        {
            try
            {
                IsBusy = true;
                try
                {
                    var pedLogic = new PedidoLogic();
                    LstPedidos = await pedLogic.GetPedidos(sdsFiltro, ddtInicial, ddtFinal, bboFinalizados, true);

                    VL_TOTAL = 0;
                    if (LstPedidos != null)
                    {
                        nenhumPedido = false;
                        LstPedidos   = new ObservableCollection <PedidoSistemaModel>(LstPedidos.OrderBy(ped => Convert.ToDateTime(string.IsNullOrEmpty(ped.DT_PREVENTREGA) ? DateTime.Now.ToString() : ped.DT_PREVENTREGA)));
                        foreach (var ped in LstPedidos)
                        {
                            VL_TOTAL += ped.VL_TOTAL;
                        }
                    }
                    else
                    {
                        nenhumPedido = true;
                    }
                }
                catch
                {
                }
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 2
0
        public async void BuscarInformacoesIniciais()
        {
            try
            {
                if (IsBusy)
                {
                    return;
                }

                IsBusy = true;
                try
                {
                    var ddtInicial = DateTime.Now.Date;
                    var ddtFinal   = DateTime.Now.Date;

                    var pedLogic = new PedidoLogic();
                    LstPedidos = await pedLogic.GetPedidos("", ddtInicial, ddtFinal, false, true);

                    if (LstPedidos != null)
                    {
                        LstPedidos = new ObservableCollection <PedidoSistemaModel>(LstPedidos.Where(ped => //ped.itens.Where(item => string.IsNullOrEmpty(item.DT_FIMCOZINHA)).Count() > 0 &&
                                                                                                    ped.BO_COZINHAPENDENTE &&
                                                                                                    Convert.ToDateTime(ped.DT_PREVENTREGA) < DateTime.Now.AddMinutes(75))
                                                                                   .ToList().OrderBy(ped => ped.ID_PEDIDO));

                        var i = 1;
                        foreach (var ped in LstPedidos)
                        {
                            ped.sdsOrdem = i + "º";
                            MontarItems(ped, i);
                            i++;
                        }
                    }
                }
                catch
                {
                }
            }
            finally
            {
                IsBusy = false;

                if (LstPedidos == null)
                {
                    nenhumPedido = true;
                }
                else
                {
                    nenhumPedido = false;
                }
            }
        }
Ejemplo n.º 3
0
        internal async void IniciarFinalizarPedido(long nidPedido, string sdsAcao)
        {
            try
            {
                if (IsBusy)
                {
                    return;
                }

                var retorno  = "";
                var pedLogic = new PedidoLogic();
                if (sdsAcao == "I")
                {
                    retorno = await pedLogic.IniciarCozinha(nidPedido);
                }
                else
                {
                    retorno = await pedLogic.FinalizarCozinha(nidPedido);
                }
                retorno = retorno.Replace("\"", "");
                if (sdsAcao == "F" && retorno == "OK")
                {
                    LstPedidos.Remove(LstPedidos.FirstOrDefault(p => p.ID_PEDIDO == nidPedido));
                }
                else if (sdsAcao == "I" && retorno == "OK")
                {
                    LstPedidos.FirstOrDefault(p => p.ID_PEDIDO == nidPedido).DT_INICIOPRODUCAO = DateTime.Now.ToString();
                }

                if (retorno != "OK")
                {
                    new Exception(retorno);
                }
            }
            catch { throw; }
        }