public List<Andamento> selectAndamento(Andamento a, Processo p) { string sql = " SELECT " + " [id_controle] " + ",[data_andamento] " + ",[texto] " + " FROM " + p.cliente + ".dbo.PROCESSO_ANDAMENTO" + " WHERE " + " ID_PROCESSO_CADASTRO = " + p.idProcessoCadastro + " AND DATA_ANDAMENTO = '" + a.dia.Replace("'", "''") + "'"; try { SqlDataReader reader = bd.select(sql); List<Andamento> lista_registros = new List<Andamento>(); while (reader.Read()) { Andamento andamento = new Andamento(); andamento.id = int.Parse(reader[0].ToString()); andamento.dia = reader[1].ToString(); andamento.texto = reader[2].ToString(); lista_registros.Add(andamento); } return lista_registros; } catch (Exception ex) { throw ex; } }
public string insert(Andamento a, Processo p) { string sql = "INSERT INTO " + p.cliente + ".dbo.PROCESSO_ANDAMENTO" + "(" + "ID_PROCESSO_CADASTRO," + "ID_CONTROLE," + "DATA_ANDAMENTO," + "TEXTO" + ")" + "VALUES" + "(" + p.idProcessoCadastro + "," + a.id + "," + " '" + a.dia.Replace("'","''") + "'," + " '" + a.texto.Replace("'", "''") + "'" + ");" + "SELECT SCOPE_IDENTITY() as idProcessoAndamento"; try { //Console.WriteLine(sql); return bd.insert(sql); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + sql); insert(a,p); return "ERRO:" + ex.Message; } }
private Andamento[] castAndamento(Tecno2.RobowsApiAndamento[] andamentos) { List<Andamento> andLocal = new List<Andamento>(); foreach(Tecno2.RobowsApiAndamento and in andamentos) { Andamento andamento = new Andamento(); andamento.dia = and.dia; andamento.dia_incluido = and.dia_incluido; andamento.id = and.id; andamento.processo = and.processo; andamento.texto = and.texto; andLocal.Add(andamento); } return andLocal.ToArray<Andamento>(); }
private Andamento[] castAndamento(Tecno2Novo.ArrayOfProcessoAndamentosUltimosResponseresultandamento[] andamentos) { List<Andamento> andLocal = new List<Andamento>(); foreach (Tecno2Novo.ArrayOfProcessoAndamentosUltimosResponseresultandamento and in andamentos) { Andamento andamento = new Andamento(); andamento.dia = and.dia; andamento.id = and.id; andamento.texto = and.texto; andLocal.Add(andamento); } return andLocal.ToArray<Andamento>(); }