Ejemplo n.º 1
0
        private void btnLimpar_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            if (View.Id == "ConsultaProjeto_DetailView")
            {
                ConsultaProjeto tela = (ConsultaProjeto)e.CurrentObject;
                tela.Projetos = null;
            }

            if (View.Id == "ConsultarTarefa_DetailView")
            {
                ConsultarTarefa tela = (ConsultarTarefa)e.CurrentObject;
                tela.Tarefas = null;
            }
        }
Ejemplo n.º 2
0
        private void btnPesquisar_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            #region Consultar Projeto
            if (View.Id == "ConsultaProjeto_DetailView")
            {
                ConsultaProjeto tela = (ConsultaProjeto)e.CurrentObject;
                //if(tela?.Status == null || tela?.Gerente == null) { throw new UserFriendlyException("Favor Verificar se Todos os Campos Estão Prenchidos"); }
                string   filtro   = "";
                object[] valores  = { null, null, null, null, null };
                int      nvalores = 0;

                if (tela.Gerente != null)
                {
                    if (filtro == "")
                    {
                        filtro += "[Gerente] = ?";
                        valores[nvalores++] = tela.Gerente.Oid;
                    }
                    else
                    {
                        filtro += " && [Gerente] = ?";
                        valores[nvalores++] = tela.Gerente.Oid;
                    }
                }


                if (tela.Status != StatusProjetoEnum.Todos)
                {
                    if (filtro == "")
                    {
                        filtro += "[StatusProjeto] = ?";
                        valores[nvalores++] = tela.Status;
                    }
                    else
                    {
                        filtro += " && [StatusProjeto] = ?";
                        valores[nvalores++] = tela.Status;
                    }
                }

                if (tela.DataInicio > DateTime.MinValue)
                {
                    if (filtro == "")
                    {
                        filtro += "[DataInicio] >= ?";
                        valores[nvalores++] = tela.DataInicio.Date;
                    }
                    else
                    {
                        filtro += " && [DataInicio] >= ?";
                        valores[nvalores++] = tela.DataInicio.Date;
                    }
                }
                if (tela.DataFim > DateTime.MinValue)
                {
                    if (filtro == "")
                    {
                        filtro += "[DataFim] >= ?";
                        valores[nvalores++] = tela.DataFim.Date;
                    }
                    else
                    {
                        filtro += " && [DataFim] >= ?";
                        valores[nvalores++] = tela.DataFim.Date;
                    }
                }
                CriteriaOperator       criteria = CriteriaOperator.Parse(filtro, valores[0], valores[1], valores[2], valores[3], valores[4]);
                XPCollection <Projeto> xp       = new XPCollection <Projeto>(((XPObjectSpace)ObjectSpace).Session, criteria);

                tela.Projetos = xp;
            }
            #endregion

            #region Consultar Tarefa
            if (View.Id == "ConsultarTarefa_DetailView")
            {
                ConsultarTarefa tela = (ConsultarTarefa)e.CurrentObject;

                String   filtro   = "";
                object[] valores  = { null, null, null, null, null };
                int      nvalores = 0;

                if (tela.Status != StatusTarefaEnum.Todos)
                {
                    if (filtro == "")
                    {
                        filtro += "[StatusTarefa] = ?";
                        valores[nvalores++] = tela.Status;
                    }
                    else
                    {
                        filtro += " && [StatusTarefa] = ?";
                        valores[nvalores++] = tela.Status;
                    }
                }

                if (tela.Projeto != null)
                {
                    if (filtro == "")
                    {
                        filtro += "[Projeto] = ?";
                        valores[nvalores++] = tela.Projeto;
                    }
                    else
                    {
                        filtro += " && [Projeto] = ?";
                        valores[nvalores++] = tela.Projeto;
                    }
                }

                if (tela.Usuario != null)
                {
                    if (tela.ContemEm != PerfilUsuarioEnum.Todos)
                    {
                        if (tela.ContemEm == PerfilUsuarioEnum.Desenvolvedor)
                        {
                            if (filtro == "")
                            {
                                filtro += "SubTarefa[Desenvolvedor = ?]";
                                valores[nvalores++] = tela.Usuario;
                            }
                            else
                            {
                                filtro += " && SubTarefa[Desenvolvedor = ?]";
                                valores[nvalores++] = tela.Usuario;
                            }
                        }

                        if (tela.ContemEm == PerfilUsuarioEnum.Analista)
                        {
                            if (filtro == "")
                            {
                                filtro += "SubTarefa[Analista = ?]";
                                valores[nvalores++] = tela.Usuario;
                            }
                            else
                            {
                                filtro += " && SubTarefa[Analista = ?]";
                                valores[nvalores++] = tela.Usuario;
                            }
                        }

                        if (tela.ContemEm == PerfilUsuarioEnum.Teste)
                        {
                            if (filtro == "")
                            {
                                filtro += "SubTarefa[Teste = ?]";
                                valores[nvalores++] = tela.Usuario;
                            }
                            else
                            {
                                filtro += " && SubTarefa[Teste = ?]";
                                valores[nvalores++] = tela.Usuario;
                            }
                        }

                        if (tela.ContemEm == PerfilUsuarioEnum.Gerente)
                        {
                            if (filtro == "")
                            {
                                filtro += "[Projeto.Gerente] = ?";
                                valores[nvalores++] = tela.Usuario;
                            }
                            else
                            {
                                filtro += " && [Projeto.Gerente] = ?";
                                valores[nvalores++] = tela.Usuario;
                            }
                        }
                    }
                }

                CriteriaOperator      criteria = CriteriaOperator.Parse(filtro, valores[0], valores[1], valores[2], valores[3], valores[4]);
                XPCollection <Tarefa> tar      = new XPCollection <Tarefa>(((XPObjectSpace)ObjectSpace).Session, criteria);

                tela.Tarefas = tar;
            }
            #endregion

            #region Consultar Versão
            if (View.Id == "VersionarProjeto_DetailView")
            {
                VersionarProjeto _telaVersionar = (VersionarProjeto)e.CurrentObject;

                if (_telaVersionar.Projeto == null)
                {
                    throw new UserFriendlyException("Favor Selecionar um Projeto");
                }
                //Cria Lista de Tarefas Desenvolvidas
                XPCollection <Tarefa> tarefas = new XPCollection <Tarefa>(((XPObjectSpace)ObjectSpace).Session, CriteriaOperator.Parse("StatusTarefa = 'Desenvolvido' && Projeto.Oid = ? ", _telaVersionar.Projeto.Oid));


                _telaVersionar.Tarefas = tarefas;
            }
            #endregion
            View.Refresh();
        }
Ejemplo n.º 3
0
        //Cria Views Do Projeto
        private void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e)
        {
            if (e.Shortcut.ViewId == "ConsultaProjeto_DetailView")
            {
                IObjectSpace    objectspace = Application.CreateObjectSpace();
                ConsultaProjeto x           = objectspace.CreateObject <ConsultaProjeto>();
                DetailView      createView  = Application.CreateDetailView(objectspace, x, true);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }

            if (e.Shortcut.ViewId == "CriarProjeto_DetailView")
            {
                IObjectSpace objectspace = Application.CreateObjectSpace();
                Projeto      x           = objectspace.CreateObject <Projeto>();
                DetailView   createView  = Application.CreateDetailView(objectspace, "CriarProjeto_DetailView", true, x);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }

            if (e.Shortcut.ViewId == "ConsultarTarefa_ListView")
            {
                IObjectSpace    objectspace = Application.CreateObjectSpace();
                ConsultarTarefa x           = objectspace.CreateObject <ConsultarTarefa>();
                DetailView      createView  = Application.CreateDetailView(objectspace, x, true);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }

            if (e.Shortcut.ViewId == "CriarTarefa_DetailView")
            {
                IObjectSpace objectspace = Application.CreateObjectSpace();
                Tarefa       x           = objectspace.CreateObject <Tarefa>();
                DetailView   createView  = Application.CreateDetailView(objectspace, "CriarTarefa_DetailView", true, x);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }

            if (e.Shortcut.ViewId == "SubTarefa_DetailView")
            {
                IObjectSpace objectspace = Application.CreateObjectSpace();
                Tarefa       x           = objectspace.CreateObject <Tarefa>();
                DetailView   createView  = Application.CreateDetailView(objectspace, "SubTarefaVinculada_DetailView", true, x);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }
            if (e.Shortcut.ViewId == "VersionarProjeto_DetailView")
            {
                IObjectSpace     objectspace = Application.CreateObjectSpace();
                VersionarProjeto x           = objectspace.CreateObject <VersionarProjeto>();
                DetailView       createView  = Application.CreateDetailView(objectspace, x, true);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }
            if (e.Shortcut.ViewId == "SubTarefa_DetailView_Criar")
            {
                IObjectSpace objectspace = Application.CreateObjectSpace();
                SubTarefa    tela        = objectspace.CreateObject <SubTarefa>();
                DetailView   createView  = Application.CreateDetailView(objectspace, "SubTarefa_DetailView_Criar", true, tela);
                createView.ViewEditMode = ViewEditMode.Edit;
                e.View    = createView;
                e.Handled = true;
            }
        }