Example #1
0
        public bool D_EliminarRobot(int id)
        {
            try
            {
                TblRobot rob1 = bd.TblRobots.First(r => r.idRobot == id);

                bd.TblRobots.DeleteOnSubmit(rob1);
                bd.SubmitChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Example #2
0
 public bool D_ActualizaRobot(int id, string nombre, string estado, string lider, int idC, int idE)
 {
     try
     {
         TblRobot rob1 = bd.TblRobots.First(r => r.idRobot == id);
         rob1.nomRobot    = nombre;
         rob1.estadoRobot = estado;
         rob1.liderRobot  = lider;
         rob1.idCategoria = idC;
         rob1.idEquipo    = idE;
         bd.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #3
0
        public bool D_ingresaRobot(int id, string nombre, string estado, string lider, int idC, int idE)
        {
            try
            {
                TblRobot rob1 = new TblRobot {
                    idRobot = id, nomRobot = nombre, estadoRobot = estado, liderRobot = lider, idCategoria = idC, idEquipo = idE
                };
                bd.TblRobots.InsertOnSubmit(rob1);
                bd.SubmitChanges();
                return(true);
            }
            catch
            {
                return(false);
            }

            /*try
             * {
             *  clsConexion.abrirConexion();
             *  string sql = "insert into  TblRobot values(@id,@nombre,@estado,@lider,@idC,@idE)";
             *  SqlCommand comando = new SqlCommand(sql, clsConexion.conexion);
             *  comando.Parameters.Add("@id", SqlDbType.Int, 3, "idRobot").Value = id;
             *  comando.Parameters.Add("@nombre", SqlDbType.VarChar, 50, "nomRobot").Value = nombre;
             *  comando.Parameters.Add("@estado", SqlDbType.VarChar, 2, "estadoRobot").Value = estado;
             *  comando.Parameters.Add("@lider", SqlDbType.VarChar, 50, "liderRobot").Value = lider;
             *  comando.Parameters.Add("@idC", SqlDbType.Int, 3, "idCategoria").Value = idC;
             *  comando.Parameters.Add("@idE", SqlDbType.Int, 3, "idEquipo").Value = idE;
             *  comando.ExecuteNonQuery();
             *  return true;
             * }
             * catch (Exception ex)
             * {
             *  throw ex;
             *  return false;
             * }
             * finally
             * {
             *  clsConexion.cerrarConexion();
             * }*/
        }