示例#1
0
        private void login_Load(object sender, EventArgs e)
        {
            this.Width = 231;
            conexao objConexao = new conexao();

            objConexao.preencheCB(cbLojas, "Select * from ubloja",Form1.conexao);
            txtUsuario.Focus();
        }
示例#2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            int abrePorta = ECFSWEDA.ECF_AbrePortaSerial();
            if (abrePorta == 1) {
                ECFSWEDA.ECF_ZAUTO("1");
            }

            ECFSWEDA.ECF_NumeroCaixa(caixa);

            try
            {
                MySqlParameter[] parametros1 = new MySqlParameter[2];

                parametros1[0] = new MySqlParameter("?caixa", caixa.ToString());
                parametros1[1] = new MySqlParameter("?loja", login.idLoja);

                string comandoT = "select vendaCodigo, vendaCoo,VendaCodCli from ubvenda where vendaCaixa = ?caixa and vendaLoja = ?loja and vendaFinalizada <> 1 and vendaFinalizada <> 2 and vendaCupom ='C' order by vendaCodigo desc limit 1";
                DataRow drCupom =  objBanco.RetornaDataRow(conexao, CommandType.Text, comandoT, parametros1);

                codVenda = Convert.ToInt32(drCupom["vendaCodigo"]);
                stCodVenda.Text = "CÓDIGO DA VENDA: " + codVenda.ToString();
                string cooCupom = drCupom["vendaCoo"].ToString();
                lblCoo.Text = "COO: " + cooCupom;

                atualizarItensCancelar(codVenda);

                MySqlParameter[] parametros2 = new MySqlParameter[1];

                parametros2[0] = new MySqlParameter("?Cliente", drCupom[2].ToString());

                string comandoC = "select id,cfNome, cfDTel, cfTel, cfCadastroPJ, cftipoCli,cfStatus  from ubclifor where id = ?Cliente";
                DataRow drCliente = objBanco.RetornaDataRow(conexao, CommandType.Text, comandoC, parametros2);
                txtCodigoCliente.Text = drCliente["id"].ToString();
                txtNomeCliente.Text = drCliente["cfNome"].ToString().ToUpper();
                txtTelefone.Text = drCliente["cfDTel"].ToString().ToUpper() + drCliente["cfTel"].ToString().ToUpper();
                txtCpfCnpj.Text = drCliente["cfCadastroPJ"].ToString().ToUpper();
                if (drCliente[4].ToString().ToUpper() == "V")
                {
                    cbTipoCliente.SelectedIndex = 1;
                }
                if (drCliente["cftipoCli"].ToString().ToUpper() == "A")
                {
                    cbTipoCliente.SelectedIndex = 0;
                }

                if (drCliente["cfStatus"].ToString().ToUpper() == "B")
                {
                    cbBloquear.SelectedIndex = 0;
                }
                if (drCliente["cfStatus"].ToString().ToUpper() == "D")
                {
                    cbBloquear.SelectedIndex = 1;
                }

            }
            catch
            {

            }

            ArrayList ar = new ArrayList();
            ar.Add(new combo("Bloqueado","B"));
            ar.Add(new combo("Desbloqueado", "D"));

            cbBloquear.DisplayMember = "Nome";
            cbBloquear.ValueMember = "Valor";
            cbBloquear.DataSource = ar;

            cbBloquear.SelectedIndex = 1;

            ar = new ArrayList();
            ar.Add(new combo("Atacadista", "A"));
            ar.Add(new combo("Varejista", "V"));

            cbTipoCliente.DisplayMember = "Nome";
            cbTipoCliente.ValueMember = "Valor";
            cbTipoCliente.DataSource = ar;

            cbTipoCliente.SelectedIndex = 1;

            cbTroca.SelectedIndex = 1;

            conexao con = new conexao();

            MySqlParameter[] parametros = new MySqlParameter[2];

            parametros[0] = new MySqlParameter("?idl",login.idLoja);
            parametros[1] = new MySqlParameter("?idf", login.idUsuario);

            //DataRow dr = con.executarComando("Select ubloja.ljNome,ubfuncionario.fcNome from ubloja,ubfuncionario where ubloja.id = ?idl and ubfuncionario.id =?idf", parametros);

            DataRow dr = objBanco.RetornaDataRow(conexao, CommandType.Text, "Select ubloja.ljNome,ubfuncionario.fcNome,ubloja.ljLista from ubloja,ubfuncionario where ubloja.id = ?idl and ubfuncionario.id =?idf", parametros);

            stLoja.Text = "LOJA: " + dr[0].ToString().ToUpper();
            stOperador.Text = "OPERADOR: " + dr[1].ToString().ToUpper();

            //Atualiza hora na barra de status
            timerHora.Tick += new EventHandler(timerHora_Tick);

            con.preencheCB(cbTipoBateria, "select sukgunid,suprod from ubsucataprod;",conexao);
            con.preencheCB(cbFormaPagamento, "select nome,nome from ubformapag;",conexao);

            getListaComissao();
        }