예제 #1
0
        private void fillForEdit(int id, int user_type)
        {
            btnCadastrar.Text = "Alterar";
            DataTable info = new DataTable();

            info           = merm.selecionarParaEdicao(id);
            txtRazSoc.Text = info.Rows[0]["Razão_Social"].ToString();
            txtCPNJ.Text   = info.Rows[0]["CPNJ"].ToString();
            txtCEP.Text    = info.Rows[0]["CEP"].ToString();
            txtBairro.Text = info.Rows[0]["Bairro"].ToString();
            txtCidade.Text = info.Rows[0]["Cidade"].ToString();
            txtEstado.Text = info.Rows[0]["Estado"].ToString();
            txtEnd.Text    = info.Rows[0]["Logradouro"].ToString();
            txtNum.Text    = info.Rows[0]["Número"].ToString();
            txtEmail.Text  = info.Rows[0]["Email"].ToString();
            txtTel1.Text   = info.Rows[0]["tel1"].ToString();
            txtTel2.Text   = info.Rows[0]["tel2"].ToString();
            byte[] img = merm.selecionaImagemParaEdicao(id);
            if (img != null)
            {
                MemoryStream mstream = new MemoryStream(img);
                pictureBox1.Image = System.Drawing.Image.FromStream(mstream);
            }
            if (id != 0 && user_type == 1)
            {
                user             = user_type;
                mer_id           = id;
                txtUser.Enabled  = false;
                txtSenha.Enabled = false;
                txtTel1.Enabled  = false;
                txtTel2.Enabled  = false;
                txtEmail.Enabled = false;
            }
            else if (id != 0 && user_type == 2)
            {
                user               = user_type;
                mer_id             = id;
                txtRazSoc.Enabled  = false;
                txtCPNJ.Enabled    = false;
                txtCEP.Enabled     = false;
                txtBairro.Enabled  = false;
                txtCidade.Enabled  = false;
                txtEstado.Enabled  = false;
                txtEnd.Enabled     = false;
                txtNum.Enabled     = false;
                btnValidar.Enabled = false;
                txtUser.Text       = info.Rows[0]["username"].ToString();
                txtSenha.Text      = info.Rows[0]["senha"].ToString();
            }
        }
예제 #2
0
        public Menu_Mercado()
        {
            InitializeComponent();

            mer_id = Login.user_id;
            MercadoModel m = new MercadoModel();

            lbNomeMercado.Text = m.consultarNomeMercado(mer_id);
            lbPedido.Text      = m.contaPedidosEmAguardo(mer_id).ToString();
            byte[] img = m.selecionaImagemParaEdicao(mer_id);
            if (img != null)
            {
                MemoryStream mstream = new MemoryStream(img);
                pictureBox1.Image = System.Drawing.Image.FromStream(mstream);
            }
        }