Пример #1
0
        protected CFunctionResult _getServiceInformation(string UserIdentity, string Passhash, Guid SessionID, Guid ServiceID)
        {
            Dictionary<string, object> InputParameters = new Dictionary<string, object>();
            InputParameters.Add("UserIdentity", UserIdentity);
            InputParameters.Add("Passhash", Passhash);
            InputParameters.Add("SessionID", SessionID.ToString().ToUpper());
            InputParameters.Add("ServiceID", ServiceID);

            CFunctionResult R = new CFunctionResult()
            {
                FunctionID = "GetServiceInformation",
                InputParameters = InputParameters,
                ResultType = Communication.EnFunctionResultType.ESuccess
            };

            if (ServiceID == null)
            {
                R = CServerHelper.sCompileFunctionResult("GetServiceInformation", Communication.EnFunctionResultType.EError, InputParameters, CGlobalizationHelper.sGetStringResource("ERROR_OBJECT_ID_NULL", CultureInfo.CurrentCulture), null);
                return R;
            }

            CFunctionResult UserResult = CServerHelper.sCheckUser(UserIdentity, Passhash, SessionID);
            if (UserResult.ResultType != Communication.EnFunctionResultType.ESuccess)
            {
                UserResult.FunctionID = "GetServiceInformation";
                UserResult.InputParameters = InputParameters;
                return UserResult;
            }

            CMetaobjectShortcut ServiceShortcut = new CMetaobjectShortcut(ServiceID, CServerEnvironment.DataContext);
            if (ServiceShortcut.Key == CDBConst.CONST_OBJECT_EMPTY_KEY)
            {
                R = CServerHelper.sCompileFunctionResult("GetServiceInformation", Communication.EnFunctionResultType.EError, InputParameters, CGlobalizationHelper.sGetStringResource("ERROR_OBJECT_UNABLE_TO_FIND", CultureInfo.CurrentCulture), null);
                return R;
            }

            var ServiceKey = ServiceShortcut.SourceObjectKey;

            CMenuService Service = new CMenuService(ServiceKey, CServerEnvironment.DataContext);
            if (Service.ID == Guid.Empty)
            {
                R = CServerHelper.sCompileFunctionResult("GetServiceInformation", Communication.EnFunctionResultType.EError, InputParameters, CGlobalizationHelper.sGetStringResource("ERROR_OBJECT_UNABLE_TO_FIND", CultureInfo.CurrentCulture), null);
                return R;
            }

            Service.GetChildren(CServerEnvironment.DataContext, false);
            R.Content = Service;

            return R;
        }