예제 #1
0
        private void SalvarMensagem(string asMensagem, string asIMEI, int aiOrigem)
        {
            long llDataAtual;

            SqLite.ExecutaComando("INSERT INTO CONVERSAS (IMEI, MENSAGEM, DATA_ENVIO, REMETENTE, MENSAGEM_NOVA) VALUES" +
                                  "('" + asIMEI + "', '" + asMensagem + "', " + DateTime.Now.Ticks + ", " + aiOrigem + ", 1)");
        }
예제 #2
0
        private void ExcluirIngrediente()
        {
            int liCodigo = int.Parse(itb_codigo.Text);

            SqLite.ExecutaComando("DELETE FROM ADICIONAIS" +
                                  "                          WHERE CODI_ADICIONAL = ?", new object[1] {
                liCodigo
            });

            AtualizarListaIngredientes();
            SetUltimoIgrediente();
        }
예제 #3
0
        private void SalvarIngrediente()
        {
            if (itb_codigo.Text == "0")
            {
                MessageBox.Show("Não é possivel utilizar '0' como código.", "Código invalido");
                itb_codigo.Focus();
                return;
            }

            if (ExisteChave() && iiStatus == STATUS_NOVO)
            {
                MessageBox.Show("O código informado já existe", "Código invalido");
                itb_codigo.Focus();
                return;
            }

            if (tb_descricao.Text.Trim() == "")
            {
                MessageBox.Show("Informe a descrição do ingrediente", "Descrição invalida");
                tb_descricao.Focus();
                return;
            }

            int     liCodigo    = int.Parse(itb_codigo.Text);
            string  lsDescricao = tb_descricao.Text;
            decimal ldcValor    = dtb_valor.GetValor();

            switch (iiStatus)
            {
            case STATUS_NOVO:
                SqLite.ExecutaComando("INSERT INTO ADICIONAIS(CODI_ADICIONAL, DESCRICAO, VALOR)" +
                                      "                            VALUES (?, ?, ?)", new object[3] {
                    liCodigo, lsDescricao, ldcValor
                });
                break;

            case STATUS_EDITANDO:
                SqLite.ExecutaComando("UPDATE ADICIONAIS SET DESCRICAO = ?," +
                                      "                                  VALOR =?" +
                                      "                            WHERE CODI_ADICIONAL = ? ", new object[3] {
                    lsDescricao, ldcValor, liCodigo
                });
                break;
            }

            AtualizarListaIngredientes();

            NovoIngrediente();
        }
예제 #4
0
        private void NovaConexao(string asEndereco, string asIMEI, string asNome, int aiMesa)
        {
            if (lv_conexoes.Items.ContainsKey(asIMEI))
            {
                int liStatus = Convert.ToInt16(lv_conexoes.GetValor(asIMEI, lvConexao.COLUNA_STATUS));

                if (liStatus == lvConexao.STATUS_CONECTADO)
                {
                    if (CentralTCP.ExisteConexao(asEndereco))
                    {
                        CentralTCP.EnviarNovaMensagem(asEndereco, "IMEI duplicado");
                        CentralTCP.FecharConexao(asEndereco);
                    }
                }
                else
                {
                    lv_conexoes.SetEndereco(asEndereco, asIMEI);
                    lv_conexoes.SetMesa(aiMesa, asIMEI);
                    lv_conexoes.SetStatus(lvConexao.STATUS_CONECTADO, asIMEI);
                    lv_conexoes.AddNotificacao(asIMEI);

                    obj_inf_cliente.SetMesa(aiMesa);
                    obj_inf_cliente.SetNome(asNome);

                    if (lv_conexoes.PossuiLinhaSelecionada())
                    {
                        if (lv_conexoes.IsIMEI == asIMEI)
                        {
                            AtualizarStatusItemSelecionado();
                        }
                    }
                }
            }
            else
            {
                lv_conexoes.AdicionarConexao(asIMEI, asNome, asEndereco, aiMesa);

                if (lv_conexoes.IsIMEI != "")
                {
                    lv_conexoes.SetLinhaSelecionada(lv_conexoes.IsIMEI);
                }

                SqLite.ExecutaComando("UPDATE CONVERSAS SET MENSAGEM_NOVA = 0 WHERE MENSAGEM_NOVA <> 0 AND IMEI = '" + asIMEI + "'");
            }
        }