/// <summary>
        /// Manipulação de Afastamento para Férias Realizadas
        /// </summary>
        public void RnManipularAfastamentoFeriasRealizadas()
        {
            if ((Realizadas && Oid.Equals(new Guid())) || (planejamentoOld != null && planejamentoOld.Realizadas != Realizadas && Realizadas))
            {
                if (NotExistAfastamento(DtInicio, _DtRetorno))
                {
                    Afastamento = new ColaboradorAfastamento(Session)
                    {
                        Colaborador             = Periodo.Colaborador,
                        DtInicio                = DtInicio,
                        DtTermino               = _DtRetorno,
                        IsCriadoAutomaticamente = true,
                        TipoAfastamento         = TipoAfastamento.GetTipoAfastamentoParaFeriasRealizadas(Session),
                        TxObservacao            = string.Format("Confirmação de férias planejadas para o período aquisitivo de {0:dd/MM/yyyy} a {1:dd/MM/yyyy}.",
                                                                DtInicio, _DtRetorno)
                    };

                    // persistencia
                    Afastamento.Save();
                }
            }
            else if (Afastamento != null)
            {
                ColaboradorAfastamento afast = Afastamento;
                Afastamento = null;
                afast.Delete();
            }
        }
        /// <summary>
        /// Método chamado ao salvar
        /// </summary>
        protected override void OnSaving()
        {
            if (Oid.Equals(new Guid()))
            {
                TxUltimoComentario = "Criação do Documento";
            }

            // Código calculado
            if (oldCliente != Cliente || string.IsNullOrEmpty(txCodigo))
            {
                TxCodigo = String.Format("{0}.{1}/{2}", Cliente.TxSigla, RnCriarNumeroSolicitacao(), DateUtil.ConsultarDataHoraAtual().Year);
                SalvarSolicitacaoOrcamentoHistorico();
            }
            else
            {
                if (Situacao != oldSituacao || Oid.Equals(new Guid()) || !string.IsNullOrEmpty(TxUltimoComentario))
                {
                    SalvarSolicitacaoOrcamentoHistorico();
                }
            }

            //verificando dados da instituição
            VerificarAlteracaoDadosEmpresaInstituicao();

            Colaborador colaborador = Colaborador.GetColaboradorCurrent(Session, UsuarioDAO.GetUsuarioLogado(Session));

            if (colaborador != null)
            {
                colaborador.ColaboradorUltimoFiltro.LastTipoSolicitacaoSEOT    = TipoSolicitacao;
                colaborador.ColaboradorUltimoFiltro.LastEmpresaInstituicaoSEOT = Cliente;
                colaborador.Save();
            }

            base.OnSaving();
        }
        /// <summary>
        /// Ativa o RnCriarRequisitoID ao clicar no botão salvar
        /// </summary>
        protected override void OnSaving()
        {
            if (Oid.Equals(new Guid()))
            {
                RnCriarRequisitoID();
            }

            base.OnSaving();
        }
Exemple #4
0
        public void TestOidEquality()
        {
            var val   = new Oid("4a7067c30a57000000008ecb");
            var other = new Oid("4a7067c30a57000000008ecb");

            Assert.IsTrue(val.Equals(other), "Equals(Oid) did not work");
            Assert.IsTrue(val == other, "== operator did not work");
            Assert.IsTrue(val == val, "Objects should be equal to itself.");
        }
Exemple #5
0
 protected override void OnSaving()
 {
     base.OnSaving();
     if (Session is NestedUnitOfWork || !Session.IsNewObject(this) || !Oid.Equals(Guid.Empty))
     {
         return;
     }
     Oid = XpoDefault.NewGuid();
 }
        /// <summary>
        /// Método que executa a função RnCriarCasoTesteID ao clicar no botão salvar
        /// </summary>
        protected override void OnSaving()
        {
            if (Oid.Equals(new Guid()) || _RequisitoOld != Requisito) /* && id == "1"*/
            {
                RnCriarCasoTesteID();
            }

            DtHoraEData = DateTime.Now;
            base.OnSaving();
        }
Exemple #7
0
        public override bool Equals(object obj)
        {
            CronogramaCapacidadePlan objComparacao = obj as CronogramaCapacidadePlan;

            return(DtDia.Date.Equals(objComparacao.DtDia.Date) && Oid.Equals(objComparacao.Oid) &&
                   HorasCapacidade.Equals(objComparacao.HorasCapacidade) &&
                   HorasDiaAnterior.Equals(objComparacao.HorasDiaAnterior) &&
                   HorasPlanejadas.Equals(objComparacao.HorasPlanejadas) &&
                   CsSituacao.Equals(objComparacao.CsSituacao) &&
                   OidCronograma.Equals(objComparacao.OidCronograma)
                   );
        }
Exemple #8
0
        public void TestOidInEquality()
        {
            var val   = new Oid("4a7067c30a57000000008ecb");
            var other = new Oid("5a7067c30a57000000008ecb");
            Oid nilo  = null;

            Assert.IsFalse(val == null);
            Assert.IsFalse(nilo == val);
            Assert.IsFalse(val == nilo);
            Assert.IsFalse(val == other);
            Assert.IsFalse(val.Equals(other));
            Assert.IsTrue(val != null);
            Assert.IsTrue(val != other);
        }
Exemple #9
0
        /// <summary>
        /// Has the Oid Selected in this block page ?
        /// </summary>
        /// <param name="dataTable"></param>
        /// <param name="selectedOid">Selected Oid.</param>
        /// <returns>True if datatable has the selected Oid.</returns>
        private bool HasTheSelectedOID(DataTable dataTable, Oid selectedOid)
        {
            if (selectedOid != null)
            {
                foreach (DataRow row in dataTable.Rows)
                {
                    Oid lOid = Adaptor.ServerConnection.GetOid(dataTable, row);

                    if (lOid.Equals(selectedOid))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
        /// <summary>
        /// Preenchimento do "Atualizado Por" e "Atualizado Por"
        /// </summary>
        private void RnPreencherAtualizadoPorPlanejadoPor()
        {
            if (IsLoading)
            {
                return;
            }

            if (Oid.Equals(new Guid()))
            {
                TxAtualizado = string.Empty;
                TxPlanejado  = string.Format("{0} - {1:dd/MM/yyyy HH:mm}", UsuarioDAO.GetUsuarioLogado(Session).UserName,
                                             DateUtil.ConsultarDataHoraAtual());
            }
            else
            {
                TxAtualizado = string.Format("{0} - {1:dd/MM/yyyy HH:mm}", UsuarioDAO.GetUsuarioLogado(Session).UserName,
                                             DateUtil.ConsultarDataHoraAtual());
            }
        }
Exemple #11
0
        public virtual bool Equals(IEntity <T> other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (HasOidAssigned && other.HasOidAssigned && Oid.Equals(other.Oid))
            {
                var otherType = other.GetEntityType();
                var thisType  = GetEntityType();

                return(thisType.IsAssignableFrom(otherType) || otherType.IsAssignableFrom(thisType));
            }

            return(false);
        }
Exemple #12
0
        /// <summary>
        /// Ativa a Função ID ao clicar no botão salvar
        /// </summary>
        protected override void OnSaving()
        {
            if (NbEsforcoPlanejado > 100)
            {
                NbEsforcoPlanejado = 100;
            }
            else
            if (NbEsforcoPlanejado < 0 || NbEsforcoPlanejado == 0)
            {
                NbEsforcoPlanejado = 0;
            }

            if (Oid.Equals(new Guid()) || _ModuloPaiOld != ModuloPai)
            {
                RnCriarID();
            }

            //Verifica se tamanho
            RnCalcularEsforcoModuloPai();
            RnCalcularPontosModuloPai();
            RnCalcularPontosSituacao();
            base.OnSaving();
        }
        /// <summary>
        /// Sets the selected index in the ComboBox.
        /// </summary>
        /// <param name="value">List containing the selected Oid.</param>
        private void SetSelectedOids(List <Oid> value)
        {
            // Store previous value
            this.PreviousValue = mComboBoxIT.Text;

            // Select the element of the list that matches the received Oid.
            List <Oid> lOids = value as List <Oid>;

            // If it is null or there are more than one, do not select anyone.
            if (lOids == null || lOids.Count != 1 || mComboBoxIT.DataSource == null)
            {
                mComboBoxIT.SelectedIndex = -1;
                return;
            }

            Oid lOidToFind = lOids[0];

            // Validate the selected OID
            if (!Oid.IsNotNullAndValid(lOidToFind))
            {
                mComboBoxIT.SelectedIndex = -1;
                return;
            }

            DataView table = (DataView)mComboBoxIT.DataSource;

            foreach (DataRowView row in table)
            {
                Oid lOid = Adaptor.ServerConnection.GetOid(table.Table, row.Row);
                if (lOidToFind.Equals(lOid))
                {
                    mComboBoxIT.SelectedItem = row;
                    return;
                }
            }
            mComboBoxIT.SelectedIndex = -1;
        }
        /// <summary>
        /// Ativa a função RnCriarEstoriaID ao clicar no botão save
        /// </summary>
        protected override void OnSaving()
        {
            if (Oid.Equals(new Guid()) || estoriaPaiOld != EstoriaPai ||
                (moduloOld != null && moduloOld != Modulo))
            {
                RnCriarEstoriaID();
            }

            RnSetarPrioridadeZeroComFilhos();

            if (NbPrioridade > 0 && _NbPrioridadeOld > 0)
            {
                OrdenacaoUtil.RnAplicarOrdenacao(this);
            }
            else if (_NbPrioridadeOld == 0 && NbPrioridade >= 1 &&
                     Oid != new Guid() && CsSituacao != CsEstoriaDomain.Pronto)
            {
                // Utilizado quando a entrega é removida(replanejada) de um ciclo
                // e retorna para o backlog. Ou seja, ela desce da prioridade 0 para 1.
                OrdenacaoUtil.RnRepriorizar(this, CsOrdenacaoDomain.DescerOrdem);
            }

            if (estoriaPai != null)
            {
                GetSomaEstoriasFilhas();
            }

            // Chamada do método para recálculo dos pontos do ciclo
            if (Ciclo != null && !Oid.Equals(new Guid()))
            {
                Ciclo.RnCalcularPontosPlanejadosERealizados();
                Ciclo.Save();
            }

            base.OnSaving();
        }
 /// <summary>
 /// Diz se é para ajustar os períodos aquisitivos do Colaborador
 /// </summary>
 /// <returns>True, se for para ajustar e false se não for</returns>
 private bool IsAjustarPeriodosAquisitivosColaborador()
 {
     return((Oid.Equals(new Guid()) && TipoAfastamento != null && !TipoAfastamento.IsRemunerado) ||
            (afastamentoOld != null && afastamentoOld.TipoAfastamento != null && TipoAfastamento != null &&
             afastamentoOld.TipoAfastamento.IsRemunerado != TipoAfastamento.IsRemunerado));
 }
 public void OidEqualSelf()
 {
     Oid o = new Oid(Meta.GetAssetType("Story"), 5, null);
     Assert.IsTrue(o.Equals(o));
 }
 /// <summary>
 /// Indica se o objeto está sendo alterado
 /// </summary>
 /// <returns>Alterado?</returns>
 public bool RnVerificarAlteracao()
 {
     return(!Oid.Equals(new Guid()));
 }
 public EditorState HiddenTxCodigo(out bool active)
 {
     active = Oid.Equals(new Guid());
     return(EditorState.Hidden);
 }
Exemple #19
0
        public void OidEqualSelf()
        {
            Oid o = new Oid(Meta.GetAssetType("Story"), 5, null);

            Assert.IsTrue(o.Equals(o));
        }
Exemple #20
0
        public void OidNotNull()
        {
            Oid o = new Oid(Meta.GetAssetType("Story"), 5, null);

            Assert.IsFalse(o.Equals(null));
        }
Exemple #21
0
        // Processes the next response to GET NEXT/GET BULK request. Map 'rows'
        // contains already received rows  (possibly only partially filled with
        // variable bindings). The method returns new OIDs which are to be used
        // in the subsequent requests. If this is the last response, this array
        // will be empty. Note that 'columnOids' is also modified and nulls are
        // set for columns that have been finished.
        private static Oid[] ProcessResponse(
            Oid[] columnOids, Vb[] vbs, Oid endRowIndex, Hashtable rows)
        {
            int nNonNulls = GetNonNullCount(columnOids);

            Oid[] oids     = new Oid[columnOids.Length];
            Oid   rowIndex = null;

            Vb[] row = null;

            for (int i = 0, o = 0;
                 i < vbs.Length && nNonNulls > 0;
                 i++, o = ++o % columnOids.Length)
            {
                while (columnOids[o] == null)
                {
                    o = ++o % columnOids.Length;
                }
                Oid columnOid = columnOids[o];

                Vb         vb  = vbs[i];
                Oid        oid = vb.Oid;
                SnmpSyntax val = vb.Value;

                // Check whether this Vb should be included in the results
                // and whether this column has been finished. 'val' should
                // never be NULL but some faulty agents send NULLs.
                bool endOfColumn
                    = !oid.StartsWith(columnOid) ||
                      (val != null && val.SmiSyntax == SmiSyntax.EndOfMibView);
                bool includeVb = !endOfColumn;

                Oid rowIdx = null;
                if (!endOfColumn)
                {
                    rowIdx = oid.TrimLeft(columnOid.Length);
                    if (endRowIndex != null)
                    {
                        int res = rowIdx.CompareTo(endRowIndex);
                        endOfColumn = res >= 0;
                        includeVb   = res <= 0;
                    }
                }

                // if a valid value has been returned, store it in the hash
                // table and store its OID for a subsequent request
                if (includeVb)
                {
                    oids[o] = oid;
                    if (rowIndex == null || !rowIdx.Equals(rowIndex))
                    {
                        rowIndex = rowIdx;
                        row      = (Vb[])rows[rowIndex];
                        if (row == null)
                        {
                            row = new Vb[columnOids.Length];
                            rows.Add(rowIndex, row);
                        }
                    }
                    row[o] = vb;
                }

                // if the column has been finished, remove it from further
                // processing
                if (endOfColumn)
                {
                    if (val != null && val.SmiSyntax == SmiSyntax.EndOfMibView)
                    {
                        columnOids[o] = null;
                        nNonNulls--;
                    }
                    oids[o] = null;
                }
            }

            // set finished columns of 'columnOids' to null
            // and remove nulls from 'oids'
            int noids = 0;

            for (int i = 0; i < oids.Length; i++)
            {
                if (oids[i] == null)
                {
                    columnOids[i] = null;
                }
                else
                {
                    oids[noids++] = oids[i];
                }
            }

            // shrink 'oids', if necessary
            if (noids < oids.Length)
            {
                Oid[] o = new Oid[noids];
                Array.Copy(oids, 0, o, 0, noids);
                oids = o;
            }
            return(oids);
        }
Exemple #22
0
        public void TestOidEquality()
        {
            var val = new Oid("4a7067c30a57000000008ecb");
            var other = new Oid("4a7067c30a57000000008ecb");

            Assert.IsTrue(val.Equals(other), "Equals(Oid) did not work");
            Assert.IsTrue(val == other, "== operator did not work");
            Assert.IsTrue(val == val, "Objects should be equal to itself.");
        }
Exemple #23
0
        public void TestOidInEquality()
        {
            var val = new Oid("4a7067c30a57000000008ecb");
            var other = new Oid("5a7067c30a57000000008ecb");
            Oid nilo = null;

            Assert.IsFalse(val == null);
            Assert.IsFalse(nilo == val);
            Assert.IsFalse(val == nilo);
            Assert.IsFalse(val == other);
            Assert.IsFalse(val.Equals(other));
            Assert.IsTrue(val != null);
            Assert.IsTrue(val != other);
        }
 public void OidNotNull()
 {
     Oid o = new Oid(Meta.GetAssetType("Story"), 5, null);
     Assert.IsFalse(o.Equals(null));
 }
        /// <summary>
        /// Returns the Parent node Oid of the specifies node
        /// </summary>
        /// <param name="nodeId"></param>
        /// <param name="oid"></param>
        /// <returns></returns>
        public List<Oid> GetOidParentNodes(string nodeId, Oid oid)
        {
            List<Oid> lOidList = new List<Oid>();
            TreeNode[] lNodes = mTreeViewIT.Nodes.Find(nodeId, true);

            // Locate the node with the same Oid
            foreach (TreeNode node in lNodes)
            {
                if (node.Tag == null)
                {
                    // It is a grouping node
                    Oid parentOid = GetOidParentNode(node);
                    if (oid.Equals(parentOid))
                    {
                        lOidList.Add(parentOid);
                    }
                }
                else
                {
                    InstanceNodeInfo instanceNodeInfo = node.Tag as InstanceNodeInfo;
                    if (instanceNodeInfo != null)
                    {
                        if (instanceNodeInfo.InstanceOid.Equals(oid))
                        {
                            // Get the Oid of the parent node
                            Oid parentOid = GetOidParentNode(node);
                            if (parentOid != null)
                            {
                                lOidList.Add(parentOid);
                            }
                        }
                    }
                }
            }

            return lOidList;
        }