Beispiel #1
0
        public static string getRede(String ativo)
        {
            //cria a string q vai guardar os dados do bando
            string text = "";


            //chama os metodos e retorna o valor deles dentro da string
            text += new oshiDAO().selectRede(ativo).Dominio + "+";
            text += new oshiDAO().selectRede(ativo).Nome + "+";
            text += new oshiDAO().selectRede(ativo).Upload + "+";
            text += new oshiDAO().selectRede(ativo).Download;

            //cria uma variavel q corta a string text e coloca eles dentro de um array
            string[] textSplit = text.Split('+');


            int c = 0;

            //while para percorrer o array
            while (c < textSplit.Length)
            {
                //verica se tem algum dado vazio
                if (textSplit[c] == "")
                {
                    return("");
                }
                c++;
            }


            return(text);
        }
Beispiel #2
0
        public static string getRAM(String ativo)
        {
            //cria a string q vai guardar os dados do bando
            string text = "";


            //chama os metodos e retorna o valor deles dentro da string
            text += new oshiDAO().selectEspacoRAM(ativo).memoriaTotal + "+";
            text += new oshiDAO().selectEspacoRAM(ativo).memoriaDisponivel + "+";
            text += new oshiDAO().selectEspacoRAM(ativo).memoriaUsada;

            //cria uma variavel q corta a string text e coloca eles dentro de um array
            string[] textSplit = text.Split('+');


            int c = 0;

            //while para percorrer o array
            while (c < textSplit.Length)
            {
                //verica se tem algum dado vazio
                if (textSplit[c] == "")
                {
                    return("");
                }
                c++;
            }


            return(text);
        }
Beispiel #3
0
        public static string getCPU(String ativo)
        {
            //cria a string q vai guardar os dados do bando
            string text = "";


            //chama os metodos e retorna o valor deles dentro da string
            text += new oshiDAO().selectCapacidadeCPU(ativo).threads + "+";
            text += new oshiDAO().selectCapacidadeCPU(ativo).processos + "+";
            text += new oshiDAO().selectCapacidadeCPU(ativo).interrupcoes + "+";
            text += new oshiDAO().selectCapacidadeCPU(ativo).versaoCPU + "+";
            text += new oshiDAO().selectCapacidadeCPU(ativo).tempoAtividadeCPU;

            //cria uma variavel q corta a string text e coloca eles dentro de um array
            string[] textSplit = text.Split('+');


            int c = 0;

            //while para percorrer o array
            while (c < textSplit.Length)
            {
                //verica se tem algum dado vazio
                if (textSplit[c] == "")
                {
                    return("");
                }
                c++;
            }


            return(text);
        }
        private void ColocarDadosAtivo()
        {
            oshiDAO      oshi  = new oshiDAO();
            List <Ativo> items = oshi.selectAtivo2();

            int cont = 0;

            while (items.Count > cont)
            {
                DropDownListAtivo.Items.Insert(cont, new ListItem(items[cont].id, items[cont].id));
                cont++;
            }


            DropDownListAtivo.DataBind();
        }
        protected int btn_editar(int idPossui, String idAtivo, String nomeAtivo)
        {
            usuarioDAO usuario = new usuarioDAO();
            oshiDAO    oshi    = new oshiDAO();
            int        editar  = 0;
            int        editar2 = 0;

            editar  = usuario.editarAtivo(idPossui, DropDownListUsuario2.SelectedItem.Value);
            editar2 = usuario.cadastroNome(idAtivo, txt_nome_ativo2.Text);

            if (editar > 0 && editar2 > 0)
            {
                Response.Write("<script>alert('Editado com sucesso')</script>");
                //Response.Redirect("dashboard2.aspx");
                return(editar);
            }
            else
            {
                Response.Write("<script>alert('Falha ao editar')</script>");
                return(editar);
            }
        }
        protected void btn_cadastrar(object sender, EventArgs e)
        {
            usuarioDAO usuario      = new usuarioDAO();
            oshiDAO    oshi         = new oshiDAO();
            int        cadastro     = 0;
            int        cadastro2    = 0;
            bool       tem_cadastro = false;
            int        cont         = 0;

            while (oshi.selectAtivo(Int32.Parse(DropDownListUsuario.SelectedItem.Value)).Count > cont)
            {
                if (oshi.selectAtivo(Int32.Parse(DropDownListUsuario.SelectedItem.Value))[cont].id == DropDownListAtivo.SelectedItem.Value)
                {
                    tem_cadastro = true;
                    break;
                }
                cont++;
            }


            if (tem_cadastro == false)
            {
                cadastro  = usuario.cadastroAtivo(DropDownListAtivo.SelectedItem.Value, DropDownListUsuario.SelectedItem.Value);
                cadastro2 = usuario.cadastroNome(DropDownListAtivo.SelectedItem.Value, txt_nome_maquina.Text);
                if (cadastro > 0 && cadastro2 > 0)
                {
                    Response.Write("<script>alert('Cadastrado com sucesso')</script>");
                    //Response.Redirect("dashboard2.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Falha no Cadastro')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Usuario já possui este ativo')</script>");
            }
        }