コード例 #1
0
        /// <summary>
        /// Executa a pesquisa para situações
        /// </summary>
        /// <param name="sender">objeto sender</param>
        /// <param name="e">argumentos da ação</param>
        private void SingleChoiceActionSituacao_Execute(object sender, SingleChoiceActionExecuteEventArgs e)
        {
            ListView listView = (ListView)View;

            Session session = ((ObjectSpace)View.ObjectSpace).Session;

            CriteriaOperator criteria = null;

            if (!e.SelectedChoiceActionItem.Caption.Equals("Todas"))
            {
                ConfiguracaoDocumentoSituacao result = session.FindObject <ConfiguracaoDocumentoSituacao>(CriteriaOperator.Parse(
                                                                                                              String.Format("Oid = '{0}'", e.SelectedChoiceActionItem.Data)));

                if (result != null)
                {
                    Colaborador.RnSalvarSituacaoUltimaSEOT(session, result.Oid, Colaborador.GetColaboradorCurrent(session));

                    criteria = CriteriaOperator.Parse("Situacao = ?", result.Oid);
                }
            }
            else
            {
                Colaborador.RnSalvarSituacaoUltimaSEOT(session, Guid.Empty, Colaborador.GetColaboradorCurrent(session));

                if (!singleChoiceActionUsuarios.SelectedItem.Caption.Equals("Todos"))
                {
                    Colaborador result = session.FindObject <Colaborador>(CriteriaOperator.Parse(String.Format("Usuario = '{0}'",
                                                                                                               singleChoiceActionUsuarios.SelectedItem.Data)));

                    if (result != null)
                    {
                        criteria = CriteriaOperator.Parse("Responsavel = ?", result.Oid);
                    }
                }
            }

            listView.CollectionSource.Criteria["FiltroPorSituacao"] = criteria;
        }