public void LoadListView() { MainListView.BeginUpdate(); // performance foreach (var entry in yvr.Records.Entries.data_items) { string[] row = { FloatUtil.ToString(entry.Position.X), FloatUtil.ToString(entry.Position.Y), FloatUtil.ToString(entry.Position.Z), entry.Time.ToString(), FloatUtil.ToString(entry.Velocity.X), FloatUtil.ToString(entry.Velocity.Y), FloatUtil.ToString(entry.Velocity.Z), FloatUtil.ToString(entry.Right.X), FloatUtil.ToString(entry.Right.Y), FloatUtil.ToString(entry.Right.Z), FloatUtil.ToString(entry.Forward.X), FloatUtil.ToString(entry.Forward.Y), FloatUtil.ToString(entry.Forward.Z), FloatUtil.ToString(entry.Steering), FloatUtil.ToString(entry.GasPedal), FloatUtil.ToString(entry.BrakePedal), entry.Handbrake.ToString(), }; MainListView.Items.Add(new ListViewItem(row)); } MainListView.EndUpdate(); }
public void LoadListView() { MainListView.BeginUpdate(); // performance foreach (var entry in yvr.Records.Entries.data_items) { string[] row = { FloatUtil.ToString(entry.PositionX), FloatUtil.ToString(entry.PositionY), FloatUtil.ToString(entry.PositionZ), entry.Time.ToString(), entry.VelocityX.ToString(), entry.VelocityY.ToString(), entry.VelocityZ.ToString(), entry.RightX.ToString(), entry.RightY.ToString(), entry.RightZ.ToString(), entry.TopX.ToString(), entry.TopY.ToString(), entry.TopZ.ToString(), entry.SteeringAngle.ToString(), entry.GasPedalPower.ToString(), entry.BrakePedalPower.ToString(), entry.HandbrakeUsed.ToString(), }; MainListView.Items.Add(new ListViewItem(row)); } MainListView.EndUpdate(); }
private void ListenWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { if (e.ProgressPercentage == 0) { EmployeeInfo info = (EmployeeInfo)e.UserState; int id = info.id; string name = info.name; foreach (ListViewItem v in MainListView.Items) { if (v.SubItems[1].Text == name) { Console.WriteLine("Found duplicate employee name, changing a little bit..."); name += "_" + id.ToString(); } } var item = new ListViewItem(id.ToString()); item.SubItems.Add(name); item.SubItems.Add("-1"); item.SubItems.Add(info.pc); MainListView.BeginUpdate(); MainListView.Items.Add(item); MainListView.EndUpdate(); Console.WriteLine($"Added {info.counter} employee..."); UpdateEmpNum(info.counter); NotifyNewEmp(id.ToString(), name, info.pc); } else if (e.ProgressPercentage == 1) { UpdateInfo info = (UpdateInfo)e.UserState; MainListView.BeginUpdate(); foreach (ListViewItem items in MainListView.Items) { if (items.Text == info.id.ToString()) { int t = int.Parse(items.SubItems[2].Text); if (t == -1 || info.newtime < t) { Console.WriteLine($"Updating best time for employee {items.Text} was {t}..."); items.SubItems[2].Text = info.newtime.ToString(); } else { Console.WriteLine($"New time is worse than the current time for {items.Text} it's {info.newtime} / {t}"); } break; } } MainListView.EndUpdate(); } }
private void ClearButton_Click(object sender, EventArgs e) { Codigo.Text = ""; CNPJOption.Checked = true; RazaoSocialText.Text = ""; AtividadeText.Text = ""; AtividadeText.Tag = ""; LogradouroText.Text = ""; BairroText.Text = ""; BairroText.Tag = ""; NumeroText.Text = ""; MainListView.BeginUpdate(); MainListView.VirtualListSize = 0; MainListView.EndUpdate(); TotalEmpresa.Text = "0"; SaveDatFile(); }
private void ClearButton_Click(object sender, EventArgs e) { Codigo.Text = ""; PrincipalCheckBox.Checked = false; Inscricao.Text = ""; Proprietario.Text = ""; Proprietario.Tag = ""; Logradouro.Text = ""; Numero.Text = ""; Bairro.Text = ""; Bairro.Tag = ""; Condominio.Text = ""; Condominio.Tag = ""; MainListView.BeginUpdate(); MainListView.VirtualListSize = 0; MainListView.EndUpdate(); TotalImovel.Text = "0"; SaveDatFile(); }
private void LoadListView() { MainListView.BeginUpdate(); MainListView.Items.Clear(); foreach (var entry in ywr.Waypoints.Entries) { string[] row = { FloatUtil.ToString(entry.Position.X), FloatUtil.ToString(entry.Position.Y), FloatUtil.ToString(entry.Position.Z), entry.Unk0.ToString(), entry.Unk1.ToString(), entry.Unk2.ToString(), entry.Unk3.ToString() }; MainListView.Items.Add(new ListViewItem(row)); } MainListView.EndUpdate(); }
private void FindButton_Click(object sender, EventArgs e) { MainListView.BeginUpdate(); MainListView.VirtualListSize = 0; MainListView.EndUpdate(); gtiCore.Ocupado(this); Imovel_bll imovel_Class = new Imovel_bll(_connection); ImovelStruct Reg = new ImovelStruct { Codigo = string.IsNullOrEmpty(Codigo.Text) ? 0 : Convert.ToInt32(Codigo.Text), Proprietario_Principal = PrincipalCheckBox.Checked }; if (Proprietario.Tag == null || Proprietario.Tag.ToString() == "") { Proprietario.Tag = "0"; } Reg.Proprietario_Codigo = Convert.ToInt32(Proprietario.Tag.ToString()); Reg.Distrito = Inscricao.Text.Substring(0, 1).Trim() == "" ? (short)0 : Convert.ToInt16(Inscricao.Text.Substring(0, 1).Trim()); Reg.Setor = Inscricao.Text.Substring(2, 2).Trim() == "" ? (short)0 : Convert.ToInt16(Inscricao.Text.Substring(2, 2).Trim()); Reg.Quadra = Inscricao.Text.Substring(5, 4).Trim() == "" ? (short)0 : Convert.ToInt16(Inscricao.Text.Substring(5, 4).Trim()); Reg.Lote = Inscricao.Text.Substring(10, 5).Trim() == "" ? 0 : Convert.ToInt32(Inscricao.Text.Substring(10, 5).Trim()); Condominio.Tag = Condominio.Tag ?? ""; Reg.CodigoCondominio = string.IsNullOrWhiteSpace(Condominio.Tag.ToString()) ? 0 : Convert.ToInt32(Condominio.Tag.ToString()); Logradouro.Tag = Logradouro.Tag ?? ""; Reg.CodigoLogradouro = string.IsNullOrWhiteSpace(Logradouro.Tag.ToString()) ? 0 : Convert.ToInt32(Logradouro.Tag.ToString()); Bairro.Tag = Bairro.Tag ?? ""; Reg.CodigoBairro = string.IsNullOrWhiteSpace(Bairro.Tag.ToString()) ? (short)0 : Convert.ToInt16(Bairro.Tag.ToString()); Reg.Numero = Numero.Text.Trim() == "" ? (short)0 : Convert.ToInt16(Numero.Text); if (Reg.Codigo == 0 && Reg.Proprietario_Codigo == 0 && Reg.Distrito == 0 && Reg.Setor == 0 & Reg.Quadra == 0 & Reg.Lote == 0 && Reg.CodigoCondominio == 0 && Reg.CodigoLogradouro == 0 && Reg.Numero == 0 && Reg.CodigoBairro == 0) { gtiCore.Liberado(this); // MessageBox.Show("Selecione ao menos um critério para filtrar.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MainListView.ListViewItemSorter = null; ImovelStruct _orderby = new ImovelStruct(); if (OrdemList.SelectedIndex == 0) { _orderby.Codigo = 1; } else if (OrdemList.SelectedIndex == 1) { _orderby.Inscricao = "X"; } else if (OrdemList.SelectedIndex == 2) { _orderby.Proprietario_Nome = "X"; } else if (OrdemList.SelectedIndex == 3) { _orderby.NomeLogradouro = "X"; } else if (OrdemList.SelectedIndex == 4) { _orderby.NomeBairro = "X"; } else if (OrdemList.SelectedIndex == 5) { _orderby.NomeCondominio = "X"; } List <ImovelStruct> Lista = imovel_Class.Lista_Imovel(Reg, _orderby); int _pos = 0, _total = Lista.Count; if (aDatResult == null) { aDatResult = new List <ArrayList>(); } aDatResult.Clear(); foreach (var item in Lista) { ArrayList itemlv = new ArrayList(8) { item.Codigo.ToString("000000"), item.Inscricao.ToString(), item.Proprietario_Nome.ToString(), item.NomeLogradouro.ToString(), item.Numero.ToString(), item.Complemento == null ? "" : item.Complemento.ToString(), item.NomeBairro.ToString(), item.CodigoCondominio == 999 ? "" : item.NomeCondominio.ToString() }; aDatResult.Add(itemlv); _pos++; } MainListView.BeginUpdate(); MainListView.VirtualListSize = aDatResult.Count; MainListView.EndUpdate(); TotalImovel.Text = _total.ToString(); gtiCore.Liberado(this); if (MainListView.Items.Count == 0) { MessageBox.Show("Nenhum imóvel coincide com os critérios especificados", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void FindButton_Click(object sender, EventArgs e) { if (!_bExec) { return; } MainListView.BeginUpdate(); MainListView.VirtualListSize = 0; MainListView.EndUpdate(); gtiCore.Ocupado(this); Empresa_bll empresa_Class = new Empresa_bll(_connection); EmpresaStruct Reg = new EmpresaStruct { Codigo = string.IsNullOrEmpty(Codigo.Text) ? 0 : Convert.ToInt32(Codigo.Text), }; Reg.Razao_social = RazaoSocialText.Text.Trim(); LogradouroText.Tag = LogradouroText.Tag ?? ""; AtividadeText.Tag = AtividadeText.Tag ?? ""; Reg.Atividade_codigo = string.IsNullOrWhiteSpace(AtividadeText.Tag.ToString()) ? 0 : Convert.ToInt32(AtividadeText.Tag.ToString()); Reg.Endereco_codigo = string.IsNullOrWhiteSpace(LogradouroText.Tag.ToString()) ? 0 : Convert.ToInt32(LogradouroText.Tag.ToString()); BairroText.Tag = BairroText.Tag ?? ""; Reg.Bairro_codigo = string.IsNullOrWhiteSpace(BairroText.Tag.ToString()) ? (short)0 : Convert.ToInt16(BairroText.Tag.ToString()); Reg.Numero = NumeroText.Text.Trim() == "" ? (short)0 : Convert.ToInt16(NumeroText.Text); if (CNPJOption.Checked) { Reg.Juridica = true; Reg.Cnpj = CNPJText.Text; Reg.Cpf_cnpj = CNPJText.Text; } else { Reg.Juridica = false; Reg.Cnpj = CPFText.Text; Reg.Cpf_cnpj = CPFText.Text; } int _pos = 0, _total = 0; if (Reg.Codigo == 0 && Reg.Razao_social == "" && Reg.Atividade_codigo == 0 && Reg.Endereco_codigo == 0 && Reg.Bairro_codigo == 0) { MessageBox.Show("Selecione ao menos um critério.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { List <EmpresaStruct> Lista = empresa_Class.Lista_Empresa(Reg); _total = Lista.Count; if (aDatResult == null) { aDatResult = new List <ArrayList>(); } aDatResult.Clear(); foreach (var item in Lista) { ArrayList itemlv = new ArrayList(10) { item.Codigo.ToString("000000"), item.Cpf_cnpj ?? "", item.Razao_social, item.Socios.Count == 0?"":item.Socios[0].Nome, item.Atividade_nome ?? "", item.Atividade_codigo == null?"0":item.Atividade_codigo.ToString(), item.Endereco_nome ?? "", item.Numero == null?"0":item.Numero.ToString(), item.Complemento ?? "", item.Bairro_nome ?? "" }; aDatResult.Add(itemlv); _pos++; } MainListView.BeginUpdate(); MainListView.VirtualListSize = aDatResult.Count; MainListView.EndUpdate(); } TotalEmpresa.Text = _total.ToString(); gtiCore.Liberado(this); }
private void InitEventHandler() { Shown += async(sender, e) => { SearchBox.Focus(); var sentences = await CoreService.GetAllSentence(); MainListView.BeginUpdate(); MainListView.Items.Clear(); MainListView.Items.AddRange(Helper.ConvertSentenceToListViewItem(sentences)); MainListView.EndUpdate(); TotalCountLabel.Text = $@"Total {MainListView.Items.Count} Sentences"; }; SearchBox.TextChanged += async(sender, e) => { var box = sender as TextBox; IEnumerable <Sentence> sentences; if (box?.Text.Length >= 1) { sentences = await CoreService.SearchBySentence(box.Text, Configuration.GetKeywordMaxLength()); } else { sentences = await CoreService.GetAllSentence(); } var sentenceList = sentences as IList <Sentence> ?? sentences.ToList(); MainListView.BeginUpdate(); MainListView.Items.Clear(); MainListView.Items.AddRange(Helper.ConvertSentenceToListViewItem(sentenceList)); MainListView.EndUpdate(); TotalCountLabel.Text = $@"Total {MainListView.Items.Count} Sentences"; }; MainListView.SelectedIndexChanged += (sender, e) => { _listViewFoucsed = true; var listView = sender as ListView; if (listView == null) { return; } if (listView.SelectedIndices.Count == 0) { return; } var index = listView.SelectedIndices[0]; var toCopy = MainListView.Items[index].SubItems[1]; _listViewSelectedRowOffset = index; Clipboard.SetText(toCopy.Text); SentenceLabel.Text = toCopy.Text; StatusLabel.Text = Constant.Copyed; }; SizeChanged += (sender, e) => { MainListView.Columns[1].Width = Size.Width - MainListView.Columns[0].Width - MainListView.Columns[2].Width - 20; }; }
private void Fill_List() { gtiCore.Ocupado(this); //***Construção do filtro **** Processo_bll processo_Class = new Processo_bll(_connection); ProcessoFilter Reg = new ProcessoFilter(); if (!string.IsNullOrEmpty(NumeroProcesso.Text)) { Reg.Ano = processo_Class.ExtractAnoProcesso(NumeroProcesso.Text); Reg.Numero = processo_Class.ExtractNumeroProcessoNoDV(NumeroProcesso.Text); Reg.SNumProcesso = NumeroProcesso.Text; } else { Reg.Ano = 0; Reg.Numero = 0; Reg.SNumProcesso = ""; } Reg.AnoIni = AnoInicial.Text.Trim() == "" ? 0 : Convert.ToInt32(AnoInicial.Text); Reg.AnoFim = AnoFinal.Text.Trim() == "" ? 0 : Convert.ToInt32(AnoFinal.Text); if (gtiCore.IsDate(DataEntrada.Text)) { Reg.DataEntrada = Convert.ToDateTime(DataEntrada.Text); } Reg.Requerente = Requerente.Text.Trim() == "" ? 0 : Convert.ToInt32(Requerente.Text); if (FisicoList.SelectedIndex > 0) { Reg.Fisico = FisicoList.SelectedIndex == 1 ? true : false; } if (InternoList.SelectedIndex > 0) { Reg.Interno = InternoList.SelectedIndex == 1 ? true : false; } CustomListBoxItem selectedItem = (CustomListBoxItem)SetorList.SelectedItem; Reg.Setor = SetorList.SelectedIndex == 0 ? 0 : selectedItem._value; selectedItem = (CustomListBoxItem)AssuntoList.SelectedItem; Reg.AssuntoCodigo = AssuntoList.SelectedIndex == 0 ? 0 : selectedItem._value; Reg.Complemento = Complemento.Text.Trim(); if (Reg.Setor > 0) { Reg.Interno = true; } //******************************** List <ProcessoStruct> Lista = processo_Class.Lista_Processos(Reg); List <ProcessoNumero> aCount = new List <ProcessoNumero>(); //usado na totalização dos processos int _total = 0; if (aDatResult == null) { aDatResult = new List <ArrayList>(); } aDatResult.Clear(); foreach (var item in Lista) { //Array para totalizar os processos distintos, desta forma processos com mais de um endereço serão contados apenas 1 vez. bool bFind = false; for (int i = 0; i < aCount.Count; i++) { if (aCount[i].Ano == item.Ano && aCount[i].Numero == item.Numero) { bFind = true; break; } } if (!bFind) { aCount.Add(new ProcessoNumero { Ano = item.Ano, Numero = item.Numero }); _total++; } string _nome = item.Interno ? item.CentroCustoNome : item.NomeCidadao; //****************************************** ArrayList itemlv = new ArrayList { item.Ano.ToString(), item.Numero.ToString("00000") + "-" + processo_Class.DvProcesso(item.Numero), _nome ?? "", item.Assunto ?? "", Convert.ToDateTime(item.DataEntrada).ToString("dd/MM/yyyy") }; if (item.DataCancelado != null) { itemlv.Add(Convert.ToDateTime(item.DataCancelado).ToString("dd/MM/yyyy")); } else { itemlv.Add(""); } if (item.DataArquivado != null) { itemlv.Add(Convert.ToDateTime(item.DataArquivado).ToString("dd/MM/yyyy")); } else { itemlv.Add(""); } if (item.DataReativacao != null) { itemlv.Add(Convert.ToDateTime(item.DataReativacao).ToString("dd/MM/yyyy")); } else { itemlv.Add(""); } if (item.Interno) { itemlv.Add("S"); } else { itemlv.Add("N"); } if (item.Fisico) { itemlv.Add("S"); } else { itemlv.Add("N"); } string sEndereco = item.LogradouroNome ?? ""; string sNumero = item.LogradouroNumero ?? ""; if (sEndereco != "") { itemlv.Add(sEndereco + ", " + sNumero ?? ""); } else { itemlv.Add(""); } aDatResult.Add(itemlv); } MainListView.BeginUpdate(); MainListView.VirtualListSize = aDatResult.Count; MainListView.EndUpdate(); Total.Text = _total.ToString(); gtiCore.Liberado(this); if (MainListView.Items.Count == 0) { MessageBox.Show("Nenhum contribuinte coincide com os critérios especificados", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void Fill_List() { gtiCore.Ocupado(this); string _valor = BuscaText.Text; Cidadao_bll clsCidadao = new Cidadao_bll(_connection); List <GTI_Models.Models.Cidadao> Lista = new List <GTI_Models.Models.Cidadao>(); if (TitleMenu.Tag.ToString() == "Nome") { Lista = clsCidadao.Lista_Cidadao(_valor, "", ""); } else { if (TitleMenu.Tag.ToString() == "CPF") { Lista = clsCidadao.Lista_Cidadao("", _valor, ""); } else { Lista = clsCidadao.Lista_Cidadao("", "", _valor); } } int _total = Lista.Count; if (aDatResult == null) { aDatResult = new List <ArrayList>(); } aDatResult.Clear(); foreach (var item in Lista) { ArrayList itemlv = new ArrayList { item.Codcidadao.ToString("000000"), item.Nomecidadao }; if (!String.IsNullOrEmpty(item.Cpf) && gtiCore.IsNumeric(item.Cpf)) { itemlv.Add(String.Format(@"{0:000\.000\.000\-00}", Convert.ToDecimal(Regex.Match(item.Cpf, @"\d+").Value))); } else { itemlv.Add(""); } if (!String.IsNullOrEmpty(item.Cnpj)) { itemlv.Add(String.Format(@"{0:00\.000\.000\/0000\-00}", Convert.ToDecimal(Regex.Match(item.Cnpj, @"\d+").Value))); } else { itemlv.Add(""); } aDatResult.Add(itemlv); } MainListView.BeginUpdate(); MainListView.VirtualListSize = aDatResult.Count; MainListView.EndUpdate(); TotalCidadao.Text = _total.ToString(); gtiCore.Liberado(this); if (MainListView.Items.Count == 0) { MessageBox.Show("Nenhum contribuinte coincide com os critérios especificados", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void GerarButton_Click(object sender, EventArgs e) { Processo_bll processo_Class = new Processo_bll(_connection); int _ano = 0, _numero = 0, _pos = 1; string _numero_processo, _assunto, _requerente, _data_entrada; if (aDatResult == null) { aDatResult = new List <ArrayList>(); } aDatResult.Clear(); gtiCore.Ocupado(this); ProcessoFilter Reg = new ProcessoFilter(); Reg.AnoIni = 2017; Reg.AnoFim = 2017; Reg.Arquivado = false; List <ProcessoStruct> ListaProcesso = processo_Class.Lista_Processos(Reg); int _total = ListaProcesso.Count; foreach (ProcessoStruct _processo in ListaProcesso) { if (_pos % 10 == 0) { PBar.Value = _pos * 100 / _total; PBar.Update(); System.Windows.Forms.Application.DoEvents(); break; } _ano = _processo.Ano; _numero = _processo.Numero; _numero_processo = _numero.ToString("00000") + "-" + processo_Class.DvProcesso(_numero).ToString(); _assunto = _processo.Complemento ?? ""; _requerente = _processo.NomeCidadao == null ? _processo.CentroCustoNome : _processo.NomeCidadao; _data_entrada = Convert.ToDateTime(_processo.DataEntrada).ToString("dd/MM/yyyy"); List <TramiteStruct> ListaTramite = processo_Class.DadosTramite((short)_ano, _numero, 0); string _ultimo_tramite = "", _ultimo_despacho = "", _proximo_tramite = ""; DateTime _data_envio = DateTime.Now; if (_numero == 180) { _ano = 23; } for (int i = ListaTramite.Count - 1; i >= 0; i--) { if (!string.IsNullOrWhiteSpace(ListaTramite[i].DataEntrada)) { if (string.IsNullOrWhiteSpace(ListaTramite[i].DataEnvio)) { if (i > 0) { if (string.IsNullOrWhiteSpace(ListaTramite[i - 1].DataEnvio)) { _data_envio = Convert.ToDateTime(ListaTramite[i].DataEntrada); } else { _data_envio = Convert.ToDateTime(ListaTramite[i - 1].DataEnvio); } _ultimo_tramite = ListaTramite[i - 1].CentroCustoNome; _ultimo_despacho = ListaTramite[i - 1].DespachoNome; } else { _data_envio = Convert.ToDateTime(ListaTramite[i].DataEntrada); _ultimo_tramite = ListaTramite[i].CentroCustoNome; _ultimo_despacho = ListaTramite[i].DespachoNome; } _proximo_tramite = ListaTramite[i].CentroCustoNome; } else { if (i == ListaTramite.Count - 1) { goto Proximo; } _data_envio = Convert.ToDateTime(ListaTramite[i].DataEnvio); _ultimo_tramite = ListaTramite[i].CentroCustoNome; _ultimo_despacho = ListaTramite[i].DespachoNome; _proximo_tramite = ListaTramite[i + 1].CentroCustoNome; } break; } } if (_ultimo_despacho.Length > 8 && _ultimo_despacho.Substring(0, 9) == "ARQUIVADO") { goto Proximo; } if (_proximo_tramite == "SETOR DE ARQUIVO" || _proximo_tramite == "SETOR DE PROTOCOLO E DISTRIBUIÇÃO") { goto Proximo; } TimeSpan t; double _numero_dias = 0; t = (DateTime.Now - _data_envio); _numero_dias = (int)t.TotalDays; if (_numero_dias <= 30) { goto Proximo; } ArrayList itemlv = new ArrayList(); itemlv.Add(_ano.ToString()); itemlv.Add(_numero_processo); itemlv.Add(_assunto); itemlv.Add(_requerente); itemlv.Add(_data_entrada); itemlv.Add(_ultimo_tramite); itemlv.Add(_ultimo_despacho); itemlv.Add(_numero_dias.ToString()); itemlv.Add(_proximo_tramite); aDatResult.Add(itemlv); Proximo: _pos++; } gtiCore.Liberado(this); MainListView.BeginUpdate(); MainListView.VirtualListSize = aDatResult.Count; MainListView.EndUpdate(); PBar.Value = 100; Gerar_Excel(); }