private void DefinirDadosComplementaresNaSessao(Cliente Cliente) { if (InfoCliente == null) { InfoCliente = new DadosComplementaresCliente(); } InfoCliente.Email = Cliente.Email; InfoCliente.Rua = Cliente.Rua; InfoCliente.Numero = Cliente.Numero; InfoCliente.Complemento = Cliente.Complemento; InfoCliente.Bairro = Cliente.Bairro; InfoCliente.Cidade = Cliente.Cidade; InfoCliente.Estado = Cliente.Estado; InfoCliente.CEP = Cliente.CEP; InfoCliente.DtNascimento = Cliente.DtNascimento; }
private void tabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!(e.Source is TabControl)) { return; } if (InfoCliente == null) { InfoCliente = new DadosComplementaresCliente(); } if (this.tabControl.SelectedIndex == 0) //copia os dados complementares do cliente { InfoCliente.Email = this.txtEmail.Text; InfoCliente.Rua = this.txtEndRua.Text; InfoCliente.Numero = this.txtEndNumero.Text; InfoCliente.Complemento = this.txtEndComplemento.Text; InfoCliente.Bairro = this.txtEndBairro.Text; InfoCliente.Cidade = this.txtEndCidade.Text; InfoCliente.Estado = this.txtEndEstado.Text; InfoCliente.CEP = this.txtEndCep.Text; if(this.dtpkDataNascimento.SelectedDate != null && this.dtpkDataNascimento.SelectedDate != default(DateTime)) { InfoCliente.DtNascimento = this.dtpkDataNascimento.SelectedDate.GetValueOrDefault(); } } if (this.tabControl.SelectedIndex == 2) //volta a exibir os dados se já existir { this.txtEmail.Text = this.InfoCliente.Email; this.txtEndRua.Text = this.InfoCliente.Rua; this.txtEndNumero.Text = this.InfoCliente.Numero; this.txtEndComplemento.Text = this.InfoCliente.Complemento; this.txtEndBairro.Text = this.InfoCliente.Bairro; this.txtEndCidade.Text = this.InfoCliente.Cidade; this.txtEndEstado.Text = this.InfoCliente.Estado; this.txtEndCep.Text = this.InfoCliente.CEP; this.dtpkDataNascimento.SelectedDate = this.InfoCliente.DtNascimento; } if (this.tabControl.SelectedIndex == 1) { if (this.ClienteAtendimento != null && this.ClienteAtendimento.Codigo > 0) { List<ItemConsumo> items = Persistencia.PersistenciaItemConsumo.ConsultarItemsConsumo(this.ClienteAtendimento.Codigo); this.dataGrid.ItemsSource = items; //List<Atendimento> atendimentos = Persistencia.PersistenciaAtendimento.ConsultarAtendimentos(new Atendimento() { CodigoCliente = ClienteAtendimento.Codigo }); List<HistoricoAtendimento> atendimentos = Persistencia.PersistenciaAtendimento.ConsultarHistoricoAtendimento(this.ClienteAtendimento.Codigo); this.dataGridAtendimentos.ItemsSource = atendimentos.OrderByDescending(d => d.DataAtendimento); } } }