public int Alterar(modelo.Servico s) { int rc = 0; try { ta.Update(tbl); } catch (System.Data.SqlClient.SqlException ex) { rc = 1; Console.WriteLine(ex.Message); } return(rc); }
public int Excluir(modelo.Servico s) { int rc = 0; try { ta.Delete(s.Codigo, s.CodigoCliente); } catch (System.Data.SqlClient.SqlException ex) { rc = 1; Console.WriteLine(ex.Message); } return(rc); }
public int Inserir(modelo.Servico s) { if (ta.GetCodigo(s.CodigoCliente, s.Data.Date) != null) { return(int.Parse(ta.GetCodigo(s.CodigoCliente, s.Data.Date).ToString())); } else { int rc = 0; try { ta.Insert(s.CodigoCliente, s.Data.Date); rc = int.Parse(ta.GetCodigo(s.CodigoCliente, s.Data.Date).ToString()); } catch (System.Data.SqlClient.SqlException ex) { rc = -1; Console.WriteLine(ex.Message); } return(rc); } }