Ejemplo n.º 1
0
 public void loadFull(String owner, Ticket t)
 {
     if (loadCompetencias(owner, t))
     {
         foreach (Competencia comp in competencias.Values)
         {
             comp.loadFull(owner);
         }
     }
 }
Ejemplo n.º 2
0
        public bool GenerateReport(String templatePath, String destinationPath, DateTime dataDocumento, Pessoa self, Ticket ticket, Projecto proj, string endMarker)
        {
            try
            {
                this.rootPath = templatePath;
                this.destPath = destinationPath;
                this._self = self;
                this._ticket = ticket;
                this._projecto = proj;
                this._endMarker = endMarker;

                _Modelo = ModeloCompetencias.getDBModelo("JC", ModeloCompetencias.getPessoaModelo(_self.PessoaID, _projecto.ProjectoID));
                _Modelo.loadFull(_projecto.owner, null);

                repCalcs = new RamkoersCalculations(_Modelo, _self.PessoaID, _projecto);

                if (!repCalcs.Init())
                    repCalcs = null;

                CountUps = 0;
                CountHoriz = 0;
                CountDown = 0;
            }
            catch (Exception e)
            {
                return false;
            }

            // tudo inicializado, podemos iniciar a geração do relatório
            this.Start();

            return true;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Carrega competências de uma família
        /// </summary>
        public bool loadCompetencias(string owner, Ticket t)
        {
            SqlConnection conn = new SqlConnection(DBHelper.ConnectionString);
            SqlCommand command = new SqlCommand();
            command.Connection = conn;
            command.CommandText = "getCompetencias";
            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("familiaID", familiaID));
            command.Parameters.Add(new SqlParameter("modeloID", modelo.ModeloID));
            command.Parameters.Add(new SqlParameter("owner", owner));

            SqlDataAdapter da = new SqlDataAdapter(command);
            DataSet ds = new DataSet();

            conn.Open();
            da.Fill(ds);
            conn.Close();

            if (ds.Tables[0].Rows.Count <= 0)
                return false;

            // se estamos com tickets que necessitam de retirar partes do modelo
            String[] toRemove;
            List<int> IDsToRemove = new List<int>();
            if (t != null)
            {
                if (t.QuestionPattern != null && t.QuestionPattern.Trim() != "")
                {
                    toRemove = t.QuestionPattern.Split(';');

                    foreach (string remove in toRemove)
                    {
                        if (remove.StartsWith("C"))
                        {
                            IDsToRemove.Add(int.Parse(remove.Replace("C", "")));
                        }
                    }

                }
            }

            Competencia com;
            int allow;
            Boolean temCompetencias = false;
            foreach (DataRow dr in ds.Tables[0].Rows)
            {

                if (IDsToRemove.Contains(Convert.ToInt32(dr["ID"]))) continue;
                temCompetencias = true;
                com = new Competencia();
                com.CreationDate = Convert.ToDateTime(dr["creationDate"]);
                com.Description = Convert.IsDBNull(dr["Description"]) ? null : Convert.ToString(dr["Description"]);
                com.IntroText = Convert.IsDBNull(dr["IntroText"]) ? null : Convert.ToString(dr["IntroText"]);
                com.Name = Convert.ToString(dr["Name"]);
                com.PublicName = Convert.ToString(dr["PublicName"]);
                com.CompetenciaID = Convert.ToInt32(dr["ID"]);
                com.SortIndex = Convert.ToInt32(dr["sortIndex"]); ;
                allow = Convert.IsDBNull(dr["AllowComments"]) ? 0 : Convert.ToInt32(dr["AllowComments"]) == 0 ? 0 : 1;
                com.AllowRespondentComments = allow == 0 ? false : true;
                com.CommentsText = Convert.IsDBNull(dr["commentsText"]) ? null : Convert.ToString(dr["commentsText"]);
                allow = Convert.IsDBNull(dr["criticalidade"]) ? 0 : Convert.ToInt32(dr["criticalidade"]) == 0 ? 0 : 1;
                com.Criticalidade = allow == 0 ? false : true;
                if (com.Criticalidade)
                    com.CriticalidadeScale = Convert.IsDBNull(dr["criticalidadeScale"]) ? null : Convert.ToString(dr["criticalidadeScale"]);
                com.CriticalidadeText = Convert.IsDBNull(dr["criticalidadeText"]) ? null : Convert.ToString(dr["criticalidadeText"]);
                com.PlainText = Convert.IsDBNull(dr["plainText"]) ? null : Convert.ToString(dr["plainText"]);
                com.PlainText = com.CriticalidadeText;
                com.Type = Convert.IsDBNull(dr["Type"]) ? null : Convert.ToString(dr["Type"]);
                com.NR = Convert.IsDBNull(dr["NR"]) ? false : Convert.ToBoolean(dr["NR"]);
                com.Opcional = Convert.IsDBNull(dr["Opcional"]) ? false : Convert.ToBoolean(dr["Opcional"]);
                com.Familia = this;
                addCompetencia(com);
            }

            return temCompetencias;
        }
Ejemplo n.º 4
0
        public void loadFull(String owner, Ticket t)
        {
            if (fullLoad) return;
            loadFamilias(owner);

            if (this.familias.Count == 0 && owner != "TEMPLATE")
            {
                loadFull("TEMPLATE", t);
                return;
            }
            foreach (FamiliaCompetencias fam in familias.Values)
            {
                fam.loadFull(owner, t);
            }

            // verifica se todas as famílias têm competências
            // se não tiverem remove a compe

            int[] chaves = new int[familias.Count];
            int count = 0;

            foreach (int key in familias.Keys)
            {
                chaves[count++] = key;
            }

            foreach (int i in chaves)
            {
                if (familias[i].Competencias.Count == 0)
                    familias.Remove(i);
            }

            fullLoad = true;
            if (t != null)
            {
                if (t.LangCode != this.langCode)
                {
                    this.traslateTo(t.LangCode);
                }
            }
        }
Ejemplo n.º 5
0
 public bool GenerateReport(String templatePath, String destinationPath, DateTime dataDocumento, Pessoa self, Ticket ticket, Projecto proj, string endMarker)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 6
0
        public static List<Ticket> getTicketsByIDs(string ListaIDs, String accSignature)
        {
            SqlConnection conn = new SqlConnection(DBHelper.ConnectionString);
            SqlCommand command = new SqlCommand();
            command.Connection = conn;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "getTickets_byID";
            command.Parameters.AddWithValue("listaTicketIDs", ListaIDs);

            SqlDataAdapter da = new SqlDataAdapter(command);
            DataSet ds = new DataSet();

            conn.Open();
            da.Fill(ds);
            conn.Close();

            if (ds.Tables[0].Rows.Count == 0)
                return null;

            List<Ticket> theTicketList = new List<Ticket>();
            Ticket theTicket;
            Pessoa proprio = new Pessoa();
            Projecto proj = new Projecto();

            proj = Projecto.getProjecto(Convert.ToInt32(ds.Tables[0].Rows[0]["projectoID"]), accSignature);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                theTicket = new Ticket();
                theTicket.projecto = proj; // Convert.IsDBNull(dr["projectoID"]) ? null : Projecto.getProjecto(Convert.ToInt32(dr["projectoID"]), accSignature);
                theTicket.modeloID = Convert.ToInt32(dr["modeloID"]);
                theTicket.proprio = Convert.IsDBNull(dr["proprioID"]) ? null : Pessoa.getPessoa(Convert.ToInt32(dr["proprioID"]), accSignature);
                theTicket.avaliado = Convert.IsDBNull(dr["avaliadoID"]) ? null : Pessoa.getPessoa(Convert.ToInt32(dr["avaliadoID"]), accSignature);
                theTicket.chave = Convert.IsDBNull(dr["chave"]) ? "" : Convert.ToString(dr["chave"]);
                theTicket.completo = Convert.IsDBNull(dr["completo"]) ? false : Convert.ToBoolean(dr["completo"]);
                theTicket.dataFim = Convert.IsDBNull(dr["dataFim"]) ? DateTime.MinValue : Convert.ToDateTime(dr["dataFim"]);
                theTicket.dataInicio = Convert.IsDBNull(dr["dataInicio"]) ? DateTime.MinValue : Convert.ToDateTime(dr["dataInicio"]);
                theTicket.qualidade = Convert.IsDBNull(dr["qualidade"]) ? "" : Convert.ToString(dr["qualidade"]);
                theTicket.resposta = Convert.IsDBNull(dr["resposta"]) ? "" : Convert.ToString(dr["resposta"]);
                theTicket.pagina = Convert.IsDBNull(dr["pagina"]) ? 0 : Convert.ToInt32(dr["pagina"]);
                theTicket.ticketID = Convert.ToInt32(dr["id"]);
                theTicket.ticketType = Convert.IsDBNull(dr["ticketType"]) ? "" : Convert.ToString(dr["ticketType"]);
                theTicket.Convite = Convert.IsDBNull(dr["Convite"]) ? "" : Convert.ToString(dr["Convite"]);
                theTicket.dataEntrada = Convert.IsDBNull(dr["dtEntrada"]) ? DateTime.MinValue : Convert.ToDateTime(dr["dtEntrada"]);
                theTicket.LangCode = Convert.IsDBNull(dr["langCode"]) ? null : Convert.ToString(dr["langCode"]);
                theTicket.QuestionPattern = Convert.IsDBNull(dr["QuestionPattern"]) ? "" : Convert.ToString(dr["QuestionPattern"]);
                theTicket.AA = Convert.IsDBNull(dr["AA"]) ? false : Convert.ToBoolean(dr["AA"]);

                if (theTicket.langCode != null)
                    proj.traslateTo(theTicket.langCode);

                theTicket.projecto = proj;

                theTicket.processResposta();

                theTicketList.Add(theTicket);
            }

            return theTicketList;
        }
Ejemplo n.º 7
0
        public static Ticket getTicket(String chave, String owner)
        {
            SqlConnection conn = new SqlConnection(DBHelper.ConnectionString);
            SqlCommand command = new SqlCommand();
            command.Connection = conn;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "getTicket";
            command.Parameters.AddWithValue("chave", chave);

            SqlDataAdapter da = new SqlDataAdapter(command);
            DataSet ds = new DataSet();

            conn.Open();
            da.Fill(ds);
            conn.Close();

            if (ds.Tables[0].Rows.Count == 0)
                return null;

            Ticket theTicket = new Ticket(); ;
            Pessoa proprio = new Pessoa();
            Projecto proj = new Projecto();

            DataRow dr = ds.Tables[0].Rows[0];

            proprio = Pessoa.getPessoa(Convert.ToInt32(dr["proprioID"]), owner);
            proj = Projecto.getProjectoID(Convert.ToInt32(dr["projectoID"]), owner);
            theTicket.projecto = proj;
            theTicket.modeloID = Convert.ToInt32(dr["modeloID"]);
            theTicket.proprio = proprio;

            if (Convert.IsDBNull(dr["avaliadoID"]))
                theTicket.avaliado = null;
            else
                theTicket.avaliado = Pessoa.getPessoa(Convert.ToInt32(dr["avaliadoID"]),owner);

            theTicket.chave = Convert.IsDBNull(dr["chave"]) ? "" : Convert.ToString(dr["chave"]);
            theTicket.completo = Convert.IsDBNull(dr["completo"]) ? false : Convert.ToBoolean(dr["completo"]);
            theTicket.dataFim = Convert.IsDBNull(dr["dataFim"]) ? DateTime.MinValue : Convert.ToDateTime(dr["dataFim"]);
            theTicket.dataInicio = Convert.IsDBNull(dr["dataInicio"]) ? DateTime.MinValue : Convert.ToDateTime(dr["dataInicio"]);
            theTicket.qualidade = Convert.IsDBNull(dr["qualidade"]) ? "" : Convert.ToString(dr["qualidade"]);
            theTicket.resposta = Convert.IsDBNull(dr["resposta"]) ? "" : Convert.ToString(dr["resposta"]);
            theTicket.pagina = Convert.IsDBNull(dr["pagina"]) ? 0 : Convert.ToInt32(dr["pagina"]);
            theTicket.ticketID = Convert.ToInt32(dr["id"]);
            theTicket.ticketType = Convert.IsDBNull(dr["ticketType"]) ? "" : Convert.ToString(dr["ticketType"]);
            theTicket.Convite = Convert.IsDBNull(dr["Convite"]) ? "" : Convert.ToString(dr["Convite"]);
            theTicket.dataEntrada = Convert.IsDBNull(dr["dtEntrada"]) ? DateTime.MinValue : Convert.ToDateTime(dr["dtEntrada"]);
            theTicket.LangCode = Convert.IsDBNull(dr["langCode"]) ? null : Convert.ToString(dr["langCode"]);
            theTicket.QuestionPattern = Convert.IsDBNull(dr["QuestionPattern"]) ? "" : Convert.ToString(dr["QuestionPattern"]);
            theTicket.AA = Convert.IsDBNull(dr["AA"]) ? false : Convert.ToBoolean(dr["AA"]);

            if (theTicket.langCode != null)
                proj.traslateTo(theTicket.langCode);

            theTicket.projecto = proj;

            theTicket.processResposta();
            return theTicket;
        }