Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using Interop.StdBE900;
- namespace SaasConsulangApi
- {
- public partial class frmTiposentidade : Form
- {
- List<TipoEntidade> tipoEntidades;
- Dictionary<string, TipoEntidade[]> TEntidades;
- public frmTiposentidade()
- {
- InitializeComponent();
- }
- private void frmTiposentidade_Load(object sender, EventArgs e)
- {
- }
- private void btnCancelar_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void btnCarrega_Click(object sender, EventArgs e)
- {
- StdBELista lista = new StdBELista();
- DataTable dt = new DataTable();
- dt.Columns.Add("TipoEntidade");
- dt.Columns.Add("Descricao");
- lista = GeralErp.BSO.Consulta("select distinct TipoEntidade,case TipoEntidade when 'C' then 'Cliente' when 'F' then 'Forncedor' when 'S' then 'Acionista/sócio' when 'E' then 'Estado/Ente Público' when 'I' then 'Forn.Imobilizado' when 'N' then 'Sindicato' when 'A' then 'Subscritores de Capital' when 'L' then 'Cred. subs. n/liberada' when 'T' then 'Cons. Assessor Inter.' when 'G' then 'Obrigacionista' when 'R' then 'Outro Credor' when 'D' then 'Outro Devedor' when 'B' then 'Conta Bancária' else TipoEntidade end as Descricao from V_Entidades ");
- //dt.Rows.Clear();
- while (!lista.NoFim())
- {
- dt.Rows.Add(lista.Valor("TipoEntidade"), lista.Valor("Descricao"));
- lista.Seguinte();
- }
- dtgvTiposentidade.DataSource = dt;
- dtgvTiposentidade.Refresh();
- }
- private void btnExport_Click(object sender, EventArgs e)
- {
- TipoEntidade t = new TipoEntidade();
- StdBELista lista = new StdBELista();
- DataTable dt = new DataTable();
- dt.Columns.Add("TipoEntidade");
- dt.Columns.Add("Descricao");
- lista = GeralErp.BSO.Consulta("select distinct TipoEntidade,case TipoEntidade when 'C' then 'Cliente' when 'F' then 'Forncedor' when 'S' then 'Acionista/sócio' when 'E' then 'Estado/Ente Público' when 'I' then 'Forn.Imobilizado' when 'N' then 'Sindicato' when 'A' then 'Subscritores de Capital' when 'L' then 'Cred. subs. n/liberada' when 'T' then 'Cons. Assessor Inter.' when 'G' then 'Obrigacionista' when 'R' then 'Outro Credor' when 'D' then 'Outro Devedor' when 'B' then 'Conta Bancária' else TipoEntidade end as Descricao from V_Entidades ");
- // dt.Rows.Clear();
- while (!lista.NoFim())
- {
- TipoEntidade TipoEnt = new TipoEntidade();
- TipoEnt.codigo = lista.Valor("TipoEntidade");
- TipoEnt.descricao = lista.Valor("Descricao");
- TipoEnt = Api.postDataToWebAPI<TipoEntidade>(Api.EnderecoWebAPI + "/rest/api/v1/tipoentidade", TipoEnt, new TipoEntidade { });
- if (TipoEnt != null)
- {
- if (TipoEnt.ID == 0)
- {
- Console.WriteLine("Erro");
- }
- }
- //BancoCtrl.postDataToWebAPI(ba);
- lista.Seguinte();
- }
- //b.codigo
- //b.descricao
- TEntidades = Api.getDataFromWebAPI_EX<TipoEntidade[]>(Api.EnderecoWebAPI + "/rest/api/v1/tipoentidade", new TipoEntidade[] { });
- /// Auth a = Api.postDataToWebAPI<Auth>(Api.EnderecoWebAPI + "/rest/login", new Login { Username = username, Password = password }, new Auth { });
- // MessageBox.Show(Api.Token + " - " + Api.TokenType);
- dt = new DataTable();
- dt.Columns.Add("TipoEntidade");
- dt.Columns.Add("Descricao");
- if (TEntidades.Count > 0)
- {
- tipoEntidades = TEntidades["tipoEntidade"].ToList();
- foreach (TipoEntidade tipo in tipoEntidades)
- {
- dt.Rows.Add(tipo.codigo, tipo.descricao);
- }
- dtgvTiposentidade.DataSource = dt;
- }
- }
- private void btnImportar_Click(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement