protected void btnEdit_Click(object sender, EventArgs e)
        {

            try
            {
                if (!String.IsNullOrEmpty(Request.Form[hidItem.UniqueID]))
                {
                    ContatoControl contatoDal = new ContatoControl();
                    int idUsuario = Helper.GetSelectedGridItemID(gvPrincipal, Request.Form[hidItem.UniqueID]);
                    ContatoFields uf = contatoDal.GetItem(idUsuario);
                    Session.Add("idContatoEdit", uf.idContato);
                   
                    mpeNovoContato.Show();
                    DoSearch();
                }
                else
                {
                    MessageBox.Show("Selecione um contato para editar!", MessageBox.MessageType.Error);
                }
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message, MessageBox.MessageType.Error);
            }

        }
예제 #2
0
        private void BindContactFields(int id)
        {
            ContatoControl pc = new ContatoControl();
            ContatoFields pf = pc.GetItem(id);

            if (pf != null)
            {
                txtDescricaoContato.Text = pf.Descricao;
                txtDate.Text = pf.DataContato.ToString("dd/MM/yyyy");

                txtNomeProspect.Enabled = false;

                this.ddlTipo.ClearSelection();
                if (this.ddlTipo.Items.FindByValue(pf.Tipo) != null)
                    this.ddlTipo.Items.FindByValue(pf.Tipo).Selected = true;

                this.ddlSituacao.ClearSelection();
                if (this.ddlSituacao.Items.FindByValue(pf.Situacao) != null)
                    this.ddlSituacao.Items.FindByValue(pf.Situacao).Selected = true;

                AssociacaoControl ac = new AssociacaoControl();
                AssociacaoFields af = ac.FindByfkContato(pf.idContato);
                if (af != null)
                {
                    txtNumConta.Text = af.NumeroConta;
                    txtNumConta.Enabled = true;
                }

            }
        }