コード例 #1
0
        private void afterGravar(string vStatus)
        {
            if (gvItens.DataSource == null)
            {
                return;
            }

            if (NR_pedido > 0)
            {
                vpedido.ID_PEDIDO = NR_pedido;
            }

            vpedido.ID_EMPRESA   = 1;
            vpedido.ID_CLIFOR    = St_Delivery ? Cd_Clifor : 1;
            vpedido.ID_MESA      = NrCartao != "0" && NrCartao != "000" ? "" : NrMesa;
            vpedido.ID_CARTAO    = NrCartao;
            vpedido.ST_ATIVO     = gvItens.DataRowCount > 0;
            vpedido.ST_PEDIDO    = vPediuExtrato ? "E" : vStatus;
            vpedido.TP_MOVIMENTO = "S";

            for (int i = 0; i < bsMPedidoItem.Count; i++)
            {
                vpedido.Itens.Add((bsMPedidoItem[i] as MPedidoItem));
            }

            var qPedido          = new QPedido();
            var posicaoTransacao = 0;

            qPedido.Gravar(vpedido, ref posicaoTransacao);

            NR_pedido = qPedido.id_pedido;

            if (St_Delivery)
            {
                var vRegistro = new TB_GOU_DELIVERY();

                vRegistro.ID_PEDIDO = NR_pedido;
                vRegistro.ST        = "A";
                vRegistro.VL        = Vl_Entrega;


                new QDelivery().Gravar(vRegistro, ref posicaoTransacao);
            }
            vComandaCancelada = false;
            if ((NrMesa.Length > 0 && gvItens.DataRowCount == 0) || St_Delivery)
            {
                this.Close();
            }
        }
コード例 #2
0
        public void Gravar(TB_GOU_DELIVERY delivery, ref int posicaoTransacao)
        {
            try
            {
                Conexao.Iniciar(ref posicaoTransacao);

                var existente = Conexao.BancoDados.TB_GOU_DELIVERies.FirstOrDefault(a => a.ID_DELIVERY == delivery.ID_DELIVERY);

                #region Inserção

                if (existente == null)
                {
                    delivery.ID_DELIVERY = (Conexao.BancoDados.TB_GOU_DELIVERies.Any() ? Conexao.BancoDados.TB_GOU_DELIVERies.Max(a => a.ID_DELIVERY) : 0) + 1;
                    Conexao.BancoDados.TB_GOU_DELIVERies.InsertOnSubmit(delivery);
                }

                #endregion

                #region Atualização

                else
                {
                    existente.ID_DELIVERY = delivery.ID_DELIVERY;
                    existente.ID_PEDIDO   = delivery.ID_PEDIDO;
                    existente.ST          = delivery.ST;
                    existente.VL          = delivery.VL;

                    Conexao.Enviar();
                }

                #endregion

                Conexao.Enviar();

                Conexao.Finalizar(ref posicaoTransacao);
            }
            catch (Exception excessao)
            {
                Conexao.Voltar(ref posicaoTransacao);
                throw excessao;
            }
        }
コード例 #3
0
        public void Deletar(TB_GOU_DELIVERY delivery, ref int posicaoTransacao)
        {
            try
            {
                Conexao.Iniciar(ref posicaoTransacao);

                var existente = Conexao.BancoDados.TB_GOU_DELIVERies.FirstOrDefault(a => a.ID_DELIVERY == delivery.ID_DELIVERY);
                if (existente != null)
                {
                    Conexao.BancoDados.TB_GOU_DELIVERies.DeleteOnSubmit(existente);
                }

                Conexao.Enviar();

                Conexao.Finalizar(ref posicaoTransacao);
            }
            catch (Exception excessao)
            {
                Conexao.Voltar(ref posicaoTransacao);
                throw excessao;
            }
        }
コード例 #4
0
        /*private void GeraTeclado()
         * {
         *  SimpleButton bt;
         *  for (int i = 1; i < 13; i++)
         *  {
         *      bt = new SimpleButton();
         *      bt.Height = 52;
         *      bt.Width = 64;
         *      bt.Appearance.BorderColor = Color.Black;
         *      bt.AllowFocus = false;
         *      if (i <= 9 || i == 11)
         *      {
         *          if (i == 11)
         *          {
         *              bt.Text = "0";
         *              bt.Name = "0";
         *          }
         *          else
         *          {
         *              bt.Text = i.ToString().PadLeft(2, '0');
         *              bt.Name = i.ToString();
         *          }
         *      }
         *      if (i == 10)
         *          bt.Text = ".";
         *      if (i == 12)
         *          bt.Text = "C";
         *
         *      if (i == 1)
         *          bt.Click += (s, e) => { bt_01_Click("1", e); };
         *      if (i == 2)
         *          bt.Click += (s, e) => { bt_01_Click("2", e); };
         *      if (i == 3)
         *          bt.Click += (s, e) => { bt_01_Click("3", e); };
         *      if (i == 4)
         *          bt.Click += (s, e) => { bt_01_Click("4", e); };
         *      if (i == 5)
         *          bt.Click += (s, e) => { bt_01_Click("5", e); };
         *      if (i == 6)
         *          bt.Click += (s, e) => { bt_01_Click("6", e); };
         *      if (i == 7)
         *          bt.Click += (s, e) => { bt_01_Click("7", e); };
         *      if (i == 8)
         *          bt.Click += (s, e) => { bt_01_Click("8", e); };
         *      if (i == 9)
         *          bt.Click += (s, e) => { bt_01_Click("9", e); };
         *      if (i == 10)
         *          bt.Click += (s, e) => { bt_01_Click(".", e); };
         *      if (i == 11)
         *          bt.Click += (s, e) => { bt_01_Click("0", e); };
         *      if (i == 12)
         *          bt.Click += (s, e) => { bt_01_Click("100", e); };
         *
         *      switch (i)
         *      {
         *          case 1: bt.Location = new System.Drawing.Point(6, 26); break;
         *          case 2: bt.Location = new System.Drawing.Point(77, 26); break;
         *          case 3: bt.Location = new System.Drawing.Point(148, 26); break;
         *          case 4: bt.Location = new System.Drawing.Point(6, 85); break;
         *          case 5: bt.Location = new System.Drawing.Point(77, 85); break;
         *          case 6: bt.Location = new System.Drawing.Point(148, 85); break;
         *          case 7: bt.Location = new System.Drawing.Point(6, 144); break;
         *          case 8: bt.Location = new System.Drawing.Point(77, 144); break;
         *          case 9: bt.Location = new System.Drawing.Point(148, 144); break;
         *          case 10: bt.Location = new System.Drawing.Point(6, 203); break;
         *          case 11: bt.Location = new System.Drawing.Point(77, 203); break;
         *          case 12: bt.Location = new System.Drawing.Point(148, 203); break;
         *          default: break;
         *      }
         *
         *      this.pTeclado.Controls.Add(bt);
         *
         *  }
         * }*/

        private void afterGravar(string vStatus)
        {
            if (gvItens.DataSource == null)
            {
                return;
            }

            if (VendaDireta && !St_Delivery)
            {
                return;
            }

            //if (St_Delivery)
            //{
            //    var frm = new FDelivery_Cadastro();
            //    frm.ShowDialog();

            //    if (frm.DialogResult == DialogResult.OK)
            //    {
            //        Vl_Entrega = frm.Vl_Entrega;
            //        Cd_Clifor = frm.Cd_Clifor;
            //    }
            //    else
            //        return;
            //}

            //var vpedido = new MPedido();

            if (NR_pedido > 0)
            {
                vpedido.ID_PEDIDO = NR_pedido;
            }

            vpedido.ID_EMPRESA   = 1;
            vpedido.ID_CLIFOR    = St_Delivery ? Cd_Clifor : 1;
            vpedido.ID_MESA      = NrCartao != "0" && NrCartao != "000" ? teMesa.Text.Trim() : NrMesa;
            vpedido.ID_CARTAO    = NrCartao;
            vpedido.ST_ATIVO     = gvItens.DataRowCount > 0;
            vpedido.ST_PEDIDO    = vPediuExtrato ? "E" : vStatus;
            vpedido.TP_MOVIMENTO = "S";

            for (int i = 0; i < bsMPedidoItem.Count; i++)
            {
                vpedido.Itens.Add((bsMPedidoItem[i] as MPedidoItem));
            }

            var qPedido          = new QPedido();
            var posicaoTransacao = 0;

            qPedido.Gravar(vpedido, ref posicaoTransacao);

            NR_pedido = qPedido.id_pedido;

            if (St_Delivery)
            {
                var vRegistro = new TB_GOU_DELIVERY();

                vRegistro.ID_PEDIDO = NR_pedido;
                vRegistro.ST        = "A";
                vRegistro.VL        = Vl_Entrega;


                new QDelivery().Gravar(vRegistro, ref posicaoTransacao);
                Imprimir();
            }

            ImprimirComanda();
            vComandaCancelada = false;
            if ((NrMesa.Length > 0 && gvItens.DataRowCount == 0) || St_Delivery)
            {
                this.Close();
            }
        }