public override void Copy(ONInstance instance)
        {
            AdministradorInstance linstance = instance as AdministradorInstance;

            Oid = new AdministradorOid(linstance.Oid);

            PassWordAttr = linstance.PassWordAttr;
            StateObj     = new ONString(linstance.StateObj);

            base.Copy(instance);
        }
        public AdministradorInstance Create_instanceServ(ONInt p_atrid_AdministradorArg, ONString p_passwordArg)
        {
            // Create new context
            using (ONServiceContext lOnContext = new ONServiceContext(OnContext))
            {

                // Call Executive
                AdministradorExecutive lExecutive = new AdministradorExecutive();
                lExecutive.OnContext = lOnContext;
                lExecutive.Instance = Instance;
                Instance = lExecutive.Create_instanceServ(p_atrid_AdministradorArg, p_passwordArg);

            }

            return Instance;
        }
        internal AdministradorInstance Create_instanceServ(ONInt p_atrid_AdministradorArg, ONString p_passwordArg)
        {
            if (Instance != null)
            {
                ONFilterList onfilt = new ONFilterList();
                onfilt.Add("QueryByOid", new QueryByOidFilter(Instance.Oid));
                Instance.Find(onfilt);
            }
            // Execute service
            AdministradorAction lAction = new AdministradorAction(OnContext);
            lAction.Instance = new AdministradorInstance(OnContext);
            Instance = lAction.Create_instanceServ(p_atrid_AdministradorArg, p_passwordArg);

            OnContext.OperationStack.Pop();
            OnContext.OperationStack.Push(Instance);

            return Instance;
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onContext">This parameter has the current context</param>
 /// <param name="instance">This parameter has the instance that exectues the service</param>
 public AdministradorServer(ONServiceContext onContext, AdministradorInstance instance)
     : base(onContext, instance, "Administrador")
 {
 }
        protected override ONInstance InhGetInstance(ONContext onContext, ONFilterList onFilterList)
        {
            // Add oid filter to the list
            ONFilterList lOnFilterList = new ONFilterList(onFilterList);
            lOnFilterList.Add("QueryByOid", new QueryByOidFilter(this));

            // Search Instance
            ONInstance lInstance = new AdministradorInstance(onContext);
            lInstance.Oid = this;
            lInstance = lInstance.Find(lOnFilterList);
            if (lInstance == null)
                lInstance = new AdministradorInstance(onContext);

            return lInstance;
        }
        public void SetPasswordServ(ref string ticket, ref ONOid agentOid, XmlReader xmlReader, XmlWriter xmlWriter, double dtdVersion, string clientName)
        {
            // Process the service arguments
            ONServiceInfo lSInfo = new ONServiceInfo("Clas_1348605050880238Ser_4_Alias", AdministradorClassText.SetPasswordServiceAlias, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias);
            lSInfo.AddOIDArgument("p_thisAdministrador", false, "Administrador", "Clas_1348605050880238Ser_4Arg_1_Alias", AdministradorClassText.SetPassword_P_thisAdministradorArgumentAlias);
            lSInfo.AddDataValuedArgument("p_NewPassword", false, DataTypeEnumerator.Password, 0, "Clas_1348605050880238Ser_4Arg_2_Alias", AdministradorClassText.SetPassword_P_NewPasswordArgumentAlias);

            try
            {
                lSInfo.XML2ON(xmlReader, dtdVersion, true);
            }
            catch (Exception e)
            {
                throw new ONServiceArgumentsException(e, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias, "Clas_1348605050880238Ser_4_Alias", AdministradorClassText.SetPasswordServiceAlias);
            }

            AdministradorOid lP_thisAdministradorArg = (AdministradorOid) ((ONArgumentInfo) lSInfo.mArgumentList["p_thisAdministrador"]).Value;
            ONString lP_NewPasswordArg = (ONString) ((ONArgumentInfo) lSInfo.mArgumentList["p_NewPassword"]).Value;

            // Create Context
            ONServiceContext lOnContext = new ONServiceContext();
            lOnContext.OidAgent = agentOid;

            // Execute Service
            AdministradorInstance lInstance = null;
            try
            {
                ONFilterList lFilterList = new ONFilterList();
                AdministradorInstance lThisInstance = new AdministradorInstance(lOnContext);
                if (lP_thisAdministradorArg != null)
                {
                    lFilterList = new ONFilterList();
                    lFilterList.Add("HorizontalVisibility", new AdministradorHorizontalVisibility());
                    lThisInstance = lP_thisAdministradorArg.GetInstance(lOnContext, lFilterList);
                    if (lThisInstance == null)
                        throw new ONInstanceNotExistException(null, "Clas_1348605050880238_Alias", AdministradorClassText.ClassAlias);
                }

                using (AdministradorServer lServer = new AdministradorServer(lOnContext, lThisInstance))
                {
                    lServer.SetPasswordServ(lP_thisAdministradorArg,lP_NewPasswordArg);
                    lInstance = lServer.Instance;
                }
                ticket = lOnContext.GetTicket(dtdVersion, clientName);
            }
            catch (SecurityException)
            {
                throw new ONAccessAgentValidationException(null);
            }
            catch
            {
                throw;
            }

            // Write Oid
            if (dtdVersion >= 3.1)
            {
                if (lInstance != null)
                    ON2XML(xmlWriter, lInstance.Oid, dtdVersion, ONXml.XMLTAG_OIDFIELD);
            }

            // Write Outbound Arguments
            xmlWriter.WriteStartElement("Arguments");
            // Write Outbound Arguments
            xmlWriter.WriteEndElement(); // Arguments
        }