示例#1
0
        public void Delete_instanceServ(
            [ONInboundArgument("Clas_1348605050880238Ser_2Arg_1_Alias", AdministradorClassText.Delete_instance_P_thisAdministradorArgumentAlias, "", "Clas_1348605050880238Ser_2_Alias", AdministradorClassText.Delete_instanceServiceAlias, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias, AllowsNull = false)] AdministradorOid p_thisAdministradorArg)
        {
            try
            {
                AdministradorData lData = new AdministradorData(OnContext);


                // Delete instance
                lData.UpdateDeleted(Instance);
            }
            catch (Exception e)
            {
                if (e is ONException)
                {
                    throw e;
                }
                else
                {
                    string ltraceItem = "Definition class: Administrador, Service: delete_instance, Component: AdministradorAction, Method: Delete_instanceServ";
                    if (e is ONSystemException)
                    {
                        ONSystemException lException = e as ONSystemException;
                        lException.addTraceInformation(ltraceItem);
                        throw lException;
                    }
                    throw new ONSystemException(e, ltraceItem);
                }
            }
        }
示例#2
0
        public AdministradorInstance Create_instanceServ(
            [ONInboundArgument("Clas_1348605050880238Ser_1Arg_1_Alias", AdministradorClassText.Create_instance_P_atrid_AdministradorArgumentAlias, "autonumeric", "Clas_1348605050880238Ser_1_Alias", AdministradorClassText.Create_instanceServiceAlias, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias, AllowsNull = false)] ONInt p_atrid_AdministradorArg,
            [ONInboundArgument("Clas_1348605050880238Ser_1Arg_2_Alias", AdministradorClassText.Create_instance_P_passwordArgumentAlias, "password", "Clas_1348605050880238Ser_1_Alias", AdministradorClassText.Create_instanceServiceAlias, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias, Length = AdministradorXml.LENGTHPASSWORDADMINISTRADOR, AllowsNull = false)] ONString p_passwordArg)
        {
            try
            {
                AdministradorData lData = new AdministradorData(OnContext);

                #region Construct OID
                Instance.Oid = new AdministradorOid();
                Instance.Oid.Id_AdministradorAttr = new ONInt(p_atrid_AdministradorArg);
                #endregion Construct OID

                #region Argument initialization 'p_password' (password)
                // Cipher password argument
                Instance.PassWordAttr = new ONString(ONSecureControl.CipherPassword(p_passwordArg.TypedValue));
                #endregion Argument initialization 'p_password' (password)

                #region Autonumeric attribute 'id_Administrador'
                if (Instance.Id_AdministradorAttr < new ONInt(0))
                {
                    AdministradorData lAutonumericData = new AdministradorData(OnContext);
                    lAutonumericData.ClassName = "Administrador";
                    //Get Autonumeric
                    Instance.Oid.Id_AdministradorAttr = lAutonumericData.GetAutonumericid_Administrador();
                }
                #endregion Autonumeric attribute 'id_Administrador'

                //Search if instance exists
                if (lData.Exist(Instance.Oid, null))
                {
                    throw new ONInstanceExistException(null, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias);
                }

                //Update the new instance
                lData.UpdateAdded(Instance);
            }
            catch (Exception e)
            {
                if (e is ONException)
                {
                    throw e;
                }
                else
                {
                    string ltraceItem = "Definition class: Administrador, Service: create_instance, Component: AdministradorAction, Method: Create_instanceServ";
                    if (e is ONSystemException)
                    {
                        ONSystemException lException = e as ONSystemException;
                        lException.addTraceInformation(ltraceItem);
                        throw lException;
                    }
                    throw new ONSystemException(e, ltraceItem);
                }
            }

            return(Instance);
        }
        /// <summary>Solves the filters defined in this class</summary>
        /// <param name="linkedTo">This parameter has the related instance to retrieve the requested instances</param>
        /// <param name="filters">This parameter has all the filters defined with this class</param>
        /// <param name="orderCriteria">This parameter has the name of the order criteria to add to SQL statement</param>
        /// <param name="startRowOID">This parameter has the OID necessary to start the search</param>
        /// <param name="blockSize">This parameter represents the number of instances to be returned</param>
        public override ONCollection QueryByFilter(ONLinkedToList linkedTo, ONFilterList filters, ONDisplaySet displaySet, string orderCriteria, ONOid startRowOID, int blockSize)
        {
            // OrderCriteria
            ONOrderCriteria lComparer = GetOrderCriteria(orderCriteria);

            // Horizontal visibility
            if (filters == null)
            {
                filters = new ONFilterList();
            }
            filters.Add("HorizontalVisibility", new AdministradorHorizontalVisibility());

            // Linked To List
            if (linkedTo == null)
            {
                linkedTo = new ONLinkedToList();
            }

            // Call Data
            try
            {
                AdministradorData lData       = new AdministradorData(OnContext);
                ONCollection      lCollection = lData.ExecuteQuery(linkedTo, filters, displaySet, lComparer, startRowOID, blockSize);

                // OrderCriteria
                if (lComparer != null)
                {
                    lCollection.Sort(lComparer);
                }

                return(lCollection);
            }
            catch (Exception e)
            {
                if (e is ONException)
                {
                    throw e;
                }
                else
                {
                    string ltraceItem = "Error in query, Method: ExecuteQuery, Component: AdministradorQuery";
                    if (e is ONSystemException)
                    {
                        ONSystemException lException = e as ONSystemException;
                        lException.addTraceInformation(ltraceItem);
                        throw lException;
                    }
                    throw new ONSystemException(e, ltraceItem);
                }
            }
        }
        /// <summary>Solves the filters defined in this class</summary>
        /// <param name="linkedTo">This parameter has the related instance to retrieve the requested instances</param>
        /// <param name="filters">This parameter has all the filters defined with this class</param>
        /// <param name="orderCriteria">This parameter has the name of the order criteria to add to SQL statement</param>
        /// <param name="startRowOID">This parameter has the OID necessary to start the search</param>
        /// <param name="blockSize">This parameter represents the number of instances to be returned</param>
        public override ONCollection QueryByFilter(ONLinkedToList linkedTo, ONFilterList filters, ONDisplaySet displaySet, string orderCriteria, ONOid startRowOID, int blockSize)
        {
            // OrderCriteria
            ONOrderCriteria lComparer = GetOrderCriteria(orderCriteria);

            // Horizontal visibility
            if (filters == null)
                filters = new ONFilterList();
            filters.Add("HorizontalVisibility", new AdministradorHorizontalVisibility());

            // Linked To List
            if (linkedTo == null)
                linkedTo = new ONLinkedToList();

            // Call Data
            try
            {
                AdministradorData lData = new AdministradorData(OnContext);
                ONCollection lCollection = lData.ExecuteQuery(linkedTo, filters, displaySet, lComparer, startRowOID, blockSize);

                // OrderCriteria
                if (lComparer != null)
                    lCollection.Sort(lComparer);

                return lCollection;
            }
            catch (Exception e)
            {
                if (e is ONException)
                {
                    throw e;
                }
                else
                {
                    string ltraceItem = "Error in query, Method: ExecuteQuery, Component: AdministradorQuery";
              					if (e is ONSystemException)
              					{
              						ONSystemException lException = e as ONSystemException;
                                    lException.addTraceInformation(ltraceItem);
                                    throw lException;
                    }
              					throw new ONSystemException(e, ltraceItem);
              				}
              			}
        }
        public Administrador Get(string codigo)
        {
            var administrador = new AdministradorData().Get(codigo);

            return(administrador);
        }
        public Administrador AcessoIntranet(string pCodigo)
        {
            var administrador = new AdministradorData().AcessoIntranet(pCodigo);

            return(administrador);
        }