Example #1
0
        public string GetComponents(int viewID, long viewStamp, int startIndex, int count)
        {
            try
            {
                UserRights userRights;
                AppData.CheckLoggedOn(out userRights);

                SchemeView    schemeView = GetSchemeView(viewID, userRights);
                ComponentsDTO dto        = new ComponentsDTO(count);
                dto.ViewStamp = schemeView.Stamp;

                if (SchemeUtils.ViewStampsMatched(viewStamp, schemeView.Stamp))
                {
                    dto.CopyComponents(schemeView.Components.Values, startIndex, count);
                }

                return(JsSerializer.Serialize(dto));
            }
            catch (Exception ex)
            {
                AppData.Log.WriteException(ex, Localization.UseRussian ?
                                           "Ошибка при получении компонентов схемы с ид.={0}" :
                                           "Error getting components of the scheme with ID={0}", viewID);
                return(GetErrorDtoJs(ex));
            }
        }
Example #2
0
        public string GetComponents(string editorID, long viewStamp, int startIndex, int count)
        {
            try
            {
                AllowAccess();
                ComponentsDTO dto = new ComponentsDTO();

                if (CheckArguments(editorID, viewStamp, dto))
                {
                    lock (Editor.SchemeView.SyncRoot)
                    {
                        dto.CopyComponents(Editor.SchemeView.Components.Values, startIndex, count);
                    }
                }

                return(JsSerializer.Serialize(dto));
            }
            catch (Exception ex)
            {
                AppData.Log.WriteException(ex, Localization.UseRussian ?
                                           "Ошибка при получении компонентов схемы" :
                                           "Error getting scheme components");
                return(JsSerializer.GetErrorJson(ex));
            }
        }