private Access()
 {
     this.expert       = null;
     this.project      = null;
     this.analyst      = null;
     this.dbTitrations = new List <DBEntity>();
 }
Esempio n. 2
0
        override protected DBEntity getDBEntity(MySqlDataReader reader)
        {
            Analyst Analyst = new Analyst();
            int     id      = (int)reader[this.ST_ID];
            string  name    = (string)reader[Analyst.ST.ST_NAME];

            Analyst.id   = (id);
            Analyst.name = name;
            return(Analyst);
        }
Esempio n. 3
0
        public FormularioCadastro(IFormPrincipal iformPrincipal)
        {
            int j = 0;

            ST_P_GRAU        = Expert.ST.DEGREES[j]; j++;
            ST_S_GRAU        = Expert.ST.DEGREES[j]; j++;
            ST_CURSO_TECNICO = Expert.ST.DEGREES[j]; j++;
            ST_GRADUACAO     = Expert.ST.DEGREES[j]; j++;
            ST_ESPECIALIDADE = Expert.ST.DEGREES[j]; j++;
            ST_MESTRADO      = Expert.ST.DEGREES[j]; j++;
            ST_DOUTORADO     = Expert.ST.DEGREES[j]; j++;
            InitializeComponent();
            this.iformPrincipal = iformPrincipal;
            //InterfaceBanco banco = InterfaceBanco.getInstance();
            //analistas = banco.retornarAnalistas();
            DBEntity dbProject = new Project();

            access.dbProjects = dbProject.getDataSource();
            int nProjects = access.dbProjects.Count;

            for (int i = 1; i < nProjects; i++)
            {
                CB_project.Items.Add(((Project)access.dbProjects[i]).name);
            }

            DBEntity dbAnalyst = new Analyst();

            access.dbAnalysts = dbAnalyst.getDataSource();
            int nAnalysts = access.dbAnalysts.Count;

            for (int i = 1; i < nAnalysts; i++)
            {
                CB_analista.Items.Add(((Analyst)access.dbAnalysts[i]).name);
            }

            DBEntity dbMethod = new Method(-1);

            dbMethods = dbMethod.getDataSource();
            int nMethods = dbMethods.Count;

            for (int i = 0; i < nMethods; i++)
            {
                if ((((Method)dbMethods[i]).name) != "0")
                {
                    //CB_MetodoEducao.Items.Add (((Method)dbMethods[i]).name);
                    CB_MetodoEducao.Items.Add(new ComboBoxItem(((Method)dbMethods[i]).id.ToString(), ((Method)dbMethods[i]).name));
                    //CB_MetodoTreinamento.Items.Add (((Method)dbMethods[i]).name);
                    CB_MetodoTreinamento.Items.Add(new ComboBoxItem(((Method)dbMethods[i]).id.ToString(), ((Method)dbMethods[i]).name));
                }
            }

            DBEntity dbExpert = new Expert(null);

            this.access.dbExperts = dbExpert.getDataSource();
            int nExperts = this.access.dbExperts.Count;

            CB_email.Items.Clear();
            for (int i = 1; i < nExperts; i++)
            {
                CB_email.Items.Add(((Expert)this.access.dbExperts[i]).email);
            }
        }
        public string[] retornaQueris()
        {
            string[] queris = new string[2];
            projeto      = CLB_ATS_projects.retornaSelecionados();
            analista     = CLB_ATS_analysts.retornaSelecionados();
            email        = CLB_ATS_emails.retornaSelecionados();
            areaAtuacao  = CLB_ATS_professionalProfile.retornaSelecionados();
            intimidadeM  = CLB_ATS_mathDomain.retornaSelecionados();
            intimidadeU  = CLB_ATS_uncertaintyDomain.retornaSelecionados();
            escolaridade = CLB_ATS_degree.retornaSelecionados();

            if (projeto.Count != 0 || analista.Count != 0 || email.Count != 0 || areaAtuacao.Count != 0 ||
                intimidadeM.Count != 0 || intimidadeU.Count != 0)
            {
                this.queryAccuracy  += " where ";
                this.queryEficience += " where ";

                for (int i = 0; i < projeto.Count; i++)
                {
                    if (i == 0)
                    {
                        queryAccuracy  += "(";
                        queryEficience += "(";
                    }
                    Project proj_i = (Project)this.access.dbProjects[Convert.ToInt16(projeto[i])];
                    queryAccuracy  += "prj.nome = " + "'" + proj_i.name + "'" + " or ";
                    queryEficience += "prj.nome = " + "'" + proj_i.name + "'" + " or ";
                }
                if (projeto.Count != 0)
                {
                    queryAccuracy  = corrigeQuery(queryAccuracy);
                    queryEficience = corrigeQuery(queryEficience);
                    //queryAccuracy += ")";
                    //queryEficience += ")";
                }
                for (int i = 0; i < analista.Count; i++)
                {
                    if (i == 0)
                    {
                        queryAccuracy  += "(";
                        queryEficience += "(";
                    }
                    Analyst ana_i = (Analyst)this.access.dbAnalysts[Convert.ToInt16(analista[i])];
                    this.queryAccuracy  += "a.nomeAnalista = " + "'" + ana_i.name + "'" + " or ";
                    this.queryEficience += "a.nomeAnalista = " + "'" + ana_i.name + "'" + " or ";
                }
                if (analista.Count != 0)
                {
                    queryAccuracy  = corrigeQuery(queryAccuracy);
                    queryEficience = corrigeQuery(queryEficience);
                    //queryAccuracy += ")";
                    //queryEficience += ")";
                }

                for (int x = 0; x < access.dbExperts.Count; x++)  // esse for aqui está removendo o especialista nulo
                {
                    if (this.access.dbExperts[x].id == 0)
                    {
                        this.access.dbExperts.RemoveAt(x);
                    }
                }

                for (int i = 0; i < email.Count; i++)
                {
                    if (i == 0)
                    {
                        queryAccuracy  += "(";
                        queryEficience += "(";
                    }
                    Expert exp_i = (Expert)this.access.dbExperts[Convert.ToInt16(email[i]) - 1];
                    this.queryAccuracy  += "e.email = " + "'" + exp_i.email + "'" + " or ";
                    this.queryEficience += "e.email = " + "'" + exp_i.email + "'" + " or ";
                }
                if (email.Count != 0)
                {
                    queryAccuracy  = corrigeQuery(queryAccuracy);
                    queryEficience = corrigeQuery(queryEficience);
                    //queryAccuracy += ")";
                    //queryEficience += ")";
                }

                for (int i = 0; i < escolaridade.Count; i++)
                {
                    if (i == 0)
                    {
                        queryAccuracy  += "(";
                        queryEficience += "(";
                    }
                    this.queryAccuracy  += "t.titulacao = " + "'" + Expert.ST.DEGREES[Convert.ToInt16(escolaridade[i]) - 1] + "'" + " or ";
                    this.queryEficience += "t.titulacao = " + "'" + Expert.ST.DEGREES[Convert.ToInt16(escolaridade[i]) - 1] + "'" + " or ";
                }
                if (escolaridade.Count != 0)
                {
                    queryAccuracy  = corrigeQuery(queryAccuracy);
                    queryEficience = corrigeQuery(queryEficience);
                    //queryAccuracy += ")";
                    //queryEficience += ")";
                }
                for (int i = 0; i < areaAtuacao.Count; i++)
                {
                    if (i == 0)
                    {
                        queryAccuracy  += "(";
                        queryEficience += "(";
                    }
                    this.queryAccuracy  += "e.areaDeAtuacao = " + "'" + Expert.ST.PROFESSINOAL_PROFILES[Convert.ToInt16(areaAtuacao[i]) - 1] + "'" + " or ";
                    this.queryEficience += "e.areaDeAtuacao = " + "'" + Expert.ST.PROFESSINOAL_PROFILES[Convert.ToInt16(areaAtuacao[i]) - 1] + "'" + " or ";
                }
                if (areaAtuacao.Count != 0)
                {
                    queryAccuracy  = corrigeQuery(queryAccuracy);
                    queryEficience = corrigeQuery(queryEficience);
                    //queryAccuracy += ")";
                    //queryEficience += ")";
                }
                for (int i = 0; i < intimidadeM.Count; i++)
                {//essa conversão é para pegra o elemento zero(0) das intimidadesM e U
                    if (i == 0)
                    {
                        queryAccuracy  += "(";
                        queryEficience += "(";
                    }
                    this.queryAccuracy  += "e.intimityMath = " + Convert.ToString(Convert.ToInt16(intimidadeM[i]) - 1) + " or ";
                    this.queryEficience += "e.intimityMath = " + Convert.ToString(Convert.ToInt16(intimidadeM[i]) - 1) + " or ";
                }
                if (intimidadeM.Count != 0)
                {
                    queryAccuracy  = corrigeQuery(queryAccuracy);
                    queryEficience = corrigeQuery(queryEficience);
                    //queryAccuracy += ")";
                    //queryEficience += ")";
                }
                for (int i = 0; i < intimidadeU.Count; i++)
                {
                    if (i == 0)
                    {
                        queryAccuracy  += "(";
                        queryEficience += "(";
                    }
                    this.queryAccuracy  += "e.intimityUncertainty = " + Convert.ToString(Convert.ToInt16(intimidadeU[i]) - 1) + " or ";
                    this.queryEficience += "e.intimityUncertainty = " + Convert.ToString(Convert.ToInt16(intimidadeU[i]) - 1) + " or ";
                }
                if (intimidadeU.Count != 0)
                {
                    queryAccuracy  = corrigeQuery(queryAccuracy);
                    queryEficience = corrigeQuery(queryEficience);
                    //queryAccuracy += ")";
                    //queryEficience += ")";
                }

                this.queryAccuracy   = this.queryAccuracy.Substring(0, queryAccuracy.Length - 5);//retirar o " and " que fica no fim de cada query
                this.queryEficience  = this.queryEficience.Substring(0, queryEficience.Length - 5);
                this.queryAccuracy  += " group by estatisticas.id_estatisticas order by estatisticas.id_processos, estatisticas.id_estatisticas";
                this.queryEficience += " group by time_events.id_time order by time_events.id_processos, time_events.id_time";
            }
            queris[0] = this.queryAccuracy;
            queris[1] = this.queryEficience;
            return(queris);
        }
        public Filter(IFormPrincipal iFPrincipal)
        {
            this.iFPrincipal             = iFPrincipal;
            this.tempo                   = new List <double>();
            this.id_question             = new List <int>();
            this.nome_arquivo_accuracy   = "../../accuracy.txt";
            this.nome_arquivo_efficiency = "../../efficiency.txt";
            this.queryAccuracy           = "select * from estatisticas inner join processos p"
                                           + " on p.id_processos = estatisticas.id_processos"
                                           + " inner join projeto prj on prj.id_projeto = p.id_projeto"
                                           + " inner join analistas a on a.id_analistas = p.id_analistas"
                                           + " inner join especialistas e on e.id_especialista = p.id_especialista"
                                           + " inner join titulacao t on t.id_especialista = e.id_especialista";
            //+"where e.id_especialista = 1 and prj.id_projeto = 1 and a.id_analistas = 1 and t.titulacao = 'Mestrado'";
            this.queryEficience = "select * from time_events inner join processos p"
                                  + " on p.id_processos = time_events.id_processos"
                                  + " inner join projeto prj on prj.id_projeto = p.id_projeto"
                                  + " inner join analistas a on a.id_analistas = p.id_analistas"
                                  + " inner join especialistas e on e.id_especialista = p.id_especialista"
                                  + " inner join titulacao t on t.id_especialista = e.id_especialista";
            //+ "where e.id_especialista = 1 and prj.id_projeto = 1 and a.id_analistas = 1 and t.titulacao = 'Mestrado'";
            InitializeComponent();
            LB_filter.Text = queryAccuracy + "\n" + queryEficience;
            DBEntity dbProject = new Project();

            this.access.dbProjects = dbProject.getDataSource();
            int length = this.access.dbProjects.Count;

            for (int i = 1; i < length; i++)
            {
                Project proj_i = (Project)this.access.dbProjects[i];
                this.CLB_ATS_projects.addItem(proj_i.name);
            }

            DBEntity dbExpert = new Expert(null);

            this.access.dbExperts = dbExpert.getDataSource();
            length = this.access.dbExperts.Count;
            for (int i = 0; i < length; i++)
            {
                Expert exp_i = (Expert)this.access.dbExperts[i];
                if (exp_i.email != "NULL")//não pegar o especialista nulo
                {
                    this.CLB_ATS_emails.addItem(exp_i.email);
                }
            }

            this.CLB_ATS_professionalProfile.addItems(Expert.ST.PROFESSINOAL_PROFILES);
            this.CLB_ATS_mathDomain.addItems(Expert.ST.SCALE_0_10);
            this.CLB_ATS_uncertaintyDomain.addItems(Expert.ST.SCALE_0_10);
            this.CLB_ATS_degree.addItems(Expert.ST.DEGREES);

            DBEntity dbAnalista = new Analyst();

            this.access.dbAnalysts = dbAnalista.getDataSource();
            for (int i = 1; i < this.access.dbAnalysts.Count; i++)
            {
                Analyst ana_i = (Analyst)this.access.dbAnalysts[i];
                this.CLB_ATS_analysts.addItem(ana_i.name);
            }
        }