public void alteraLinhas(int quant) { if (quant == 0) { quant = 1; } int result = quant - quantidade; if (result > 0) { for (int x = 0; x < result; x++) { Linha l = new Linha(); l.nome = string.Format("Linha produtiva {0}", x + quantidade + 1); l.id = x + quantidade; Linhas.Add(l); } } if (result < 0) { for (int x = Linhas.Count - 1; x >= quant; x--) { Linhas.RemoveAt(x); } } quantidade = Linhas.Count; }
/// <summary> /// Calcula o Bloco 9 - /// É necessário que as linhas já estejam geradas. Gere manualmente ou utilize a função "GerarLinhas()". /// </summary> /// <param name="totalizarblocos">Calcula o totalizados de todos os blocos, ex: 0990, C990, ...</param> public virtual void CalcularBloco9(bool totalizarblocos = true) { if (Linhas == null || !Linhas.Any()) { throw new Exception("Não é possível calcular o bloco 9 sem as linhas. Execute a função \"GerarLinhas()\", gere as linhas manualemnte ou leia um arquivo para preencher as linhas."); } }
public object this[int linha, int coluna] { get { if (!_dados.ContainsKey(linha)) { return(null); } if (!_dados[linha].ContainsKey(coluna)) { return(null); } return(_dados[linha][coluna]); } set { if (!_dados.ContainsKey(linha)) { if (!Linhas.Exists(x => x == linha)) { Linhas.Add(linha); } _dados.Add(linha, new Dictionary <int, object>()); } _dados[linha][coluna] = value; } }
public void AdicionarLinha(List <string> linha) { if (linha.Count != Colunas.Count) { throw new ArgumentException(nameof(linha)); } Linhas.Add(linha); }
public double ItensDistintos(int coluna) { double result = 0; result = Linhas.Select(x => this[x, coluna]).Distinct().Count(); return(result); }
public double Minimo(int coluna) { double result = 0; result = Linhas.Min(x => Convert.ToDouble(((this[x, coluna] != null && this[x, coluna].ToString() != string.Empty) ? this[x, coluna] : 0))); return(result); }
public virtual void Ler(string path, Encoding encoding = null) { Erros = new List <string>(); Linhas = File.ReadAllLines(path, encoding ?? Encoding.Default).ToList(); //Remove linhas em branco Linhas.RemoveAll(l => string.IsNullOrEmpty(l.Trim())); }
public void Escrever(string path, Encoding encoding = null) { if (Linhas == null || !Linhas.Any()) { throw new Exception("Não é possível escrever sem as linhas. Execute a função \"GerarLinhas()\", gere as linhas manualemnte ou leia um arquivo para preencher as linhas."); } File.WriteAllLines(path, Linhas.ToArray(), encoding ?? Encoding.Default); }
public void RemoveSelectedItem(ClasseTeste item) { if (item != null) { Mvx.Resolve <IAlertMessage> ().Confirm("Deseja remover está linha ?", async() => { Linhas.Remove(item); }, "Remover Linha", "Sim", "Não"); } }
public OEE(int _linhas) { for (int x = 0; x < _linhas; x++) { Linha l = new Linha(); l.nome = string.Format("Linha produtiva {0}", x + 1); l.id = x; Linhas.Add(l); } quantidade = _linhas; }
/// <summary> /// Adicionar um objeto do tipo RegistroBaseSped no atributo "Linhas". /// Caso existe alguma falha na geração, adiciona a falha no atributo "Erros" /// </summary> protected void EscreverLinha(RegistroBaseSped registro) { string erro; string texto = registro.EscreverCampos(out erro, null, true); if (!string.IsNullOrEmpty(erro)) { Erros.Add(erro); } Linhas.Add(texto); }
private void AddLinha() { if (!Validate("ALL")) { return; } Linhas.Add( new ClasseTeste() { Id = Codigo, Valor = Valor }); ToJson(); }
public async Task <bool> CreateLines([FromBody] Linhas newLinha) { DAL bd = new DAL(); try { string sql = $"insert into line values (uuid(), '{newLinha.Number}', '{newLinha.Ticket.ID}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{newLinha.Description}')"; bd.ExecutarComandoSQL(sql); bd.FecharConexao(); return(true); } catch (Exception ex) { return(false); } }
private void CriaLinhasMatriz() { for (int i = 1; i <= 9; i++) { var linha = new SDLinhaModel() { NumeroSequencial = i }; for (int j = 1; j <= 9; j++) { var celula = new SDCelulaModel() { PosicaoLinha = i, PosicaoColuna = j }; linha.Celulas.Add(celula); } Linhas.Add(linha); } }
public async static Task <bool> CreateLines(Linhas newLinha) { return(await PostAsync <bool>("", $"Linhas/CreateLines", newLinha)); }
public IEnumerable <object> Itens(int coluna) { return(Linhas.Select(x => this[x, coluna])); }
public DBModel executarQuery(string query, string message = null, bool exibirMsg = true) { OleDbCommand commando = new OleDbCommand(query, conexao); DBModel retorno = new DBModel(); Colunas colunas = new Colunas(); colunas.nome = new List <string>(); Linhas linhas = new Linhas(); linhas.linhas = new List <Linha>(); try { //Abertura da conexão conexao.Open(); //Executar o comando e ler os dados retornados OleDbDataReader dados = commando.ExecuteReader(); bool temRetorno = false; int primeiroLaço = 0; while (dados.Read()) { Linha linha = new Linha(); linha.item = new List <string>(); if (primeiroLaço == 0) { var table = dados.GetSchemaTable(); var nameCol = table.Columns["ColumnName"]; foreach (DataRow row in table.Rows) { colunas.nome.Add(row[nameCol].ToString()); temRetorno = true; } retorno.colunas = colunas; } primeiroLaço++; for (int i = 0; i < dados.FieldCount; i++) { linha.item.Add(dados[i].ToString()); } linhas.linhas.Add(linha); } retorno.linhas = linhas; if (!temRetorno) { if (exibirMsg) { MessageBox.Show(message != null ? message : "Comando Executado Com Sucesso"); } return(null); //retorno = "Comando Executado Com Sucesso"; } return(retorno); //return retorno; // if (succ == 0) //{ // MessageBox.Show("Query Executado com sucesso"); //} else //{ // MessageBox.Show("Erro ao Executar Query"); //} ////commando.ExecuteReader(); //return succ.ToString(); } catch (Exception exc) { MessageBox.Show(exc.Message, "Erro ao Executar Query"); //throw new Exception(exc.Message); //return exc.Message; return(null); } finally { conexao.Close(); } }