示例#1
0
            public void ApagarFicharioSQLREL()
            {
                try
                {
                    var sql = $"SELECT * FROM TB_Cliente WHERE Id = {this.Id}";
                    var db  = new SQLServerClass();
                    var dt  = db.SQLQuery(sql);

                    if (dt.Rows.Count == 0)
                    {
                        db.Close();
                        throw new Exception($"Identificador não existente: {this.Id}");
                    }
                    else
                    {
                        sql = $"DELETE FROM TB_Cliente WHERE Id = '{this.Id}'";
                        db.SQLCommand(sql);
                        db.Close();
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception($"Erro ao excluir o conteúdo do identificador: {ex.Message}");
                }
            }
示例#2
0
 public void IncluirFicharioSQLREL()
 {
     try
     {
         var sql = this.ToInsert();
         var db  = new SQLServerClass();
         db.SQLCommand(sql);
         db.Close();
     }
     catch (Exception ex)
     {
         throw new Exception($"Inclusão não permitida. Identificador: {this.Id}, erro: {ex.Message}");
     }
 }
示例#3
0
            public Unit BuscarFicharioSQLREL(string id)
            {
                try
                {
                    var sql = $"SELECT * FROM TB_Cliente WHERE Id = {id}";
                    var db  = new SQLServerClass();
                    var dt  = db.SQLQuery(sql);
                    db.Close();

                    if (dt.Rows.Count == 0)
                    {
                        throw new Exception($"Identificador não existente: {id}");
                    }
                    else
                    {
                        Unit u = this.DataRowToUnit(dt.Rows[0]);
                        return(u);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception($"Erro ao buscar o conteúdo do identificador: {ex.Message}");
                }
            }