コード例 #1
0
        public string GetSchemeDoc(int viewID, long viewStamp)
        {
            try
            {
                UserRights userRights;
                AppData.CheckLoggedOn(out userRights);

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

                if (SchemeUtils.ViewStampsMatched(viewStamp, schemeView.Stamp))
                {
                    dto.SchemeDoc = schemeView.SchemeDoc;
                }

                return(JsSerializer.Serialize(dto));
            }
            catch (Exception ex)
            {
                AppData.Log.WriteException(ex, Localization.UseRussian ?
                                           "Ошибка при получении свойств документа схемы с ид.={0}" :
                                           "Error getting document properties of the scheme with ID={0}", viewID);
                return(GetErrorDtoJs(ex));
            }
        }
コード例 #2
0
        public string GetLoadErrors(int viewID, long viewStamp)
        {
            try
            {
                UserRights userRights;
                AppData.CheckLoggedOn(out userRights);

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

                if (SchemeUtils.ViewStampsMatched(viewStamp, schemeView.Stamp))
                {
                    dto.Data = schemeView.LoadErrors.ToArray();
                }

                return(JsSerializer.Serialize(dto));
            }
            catch (Exception ex)
            {
                AppData.Log.WriteException(ex, Localization.UseRussian ?
                                           "Ошибка при получении ошибок при загрузке схемы с ид.={0}" :
                                           "Error getting loading errors of the scheme with ID={0}", viewID);
                return(GetErrorDtoJs(ex));
            }
        }
コード例 #3
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));
            }
        }
コード例 #4
0
        public string GetImages(int viewID, long viewStamp, int startIndex, int totalDataSize)
        {
            try
            {
                UserRights userRights;
                AppData.CheckLoggedOn(out userRights);

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

                if (SchemeUtils.ViewStampsMatched(viewStamp, schemeView.Stamp))
                {
                    dto.CopyImages(schemeView.SchemeDoc.Images.Values, startIndex, totalDataSize);
                }

                return(JsSerializer.Serialize(dto));
            }
            catch (Exception ex)
            {
                AppData.Log.WriteException(ex, Localization.UseRussian ?
                                           "Ошибка при получении изображений схемы с ид.={0}" :
                                           "Error getting images of the scheme with ID={0}", viewID);
                return(GetErrorDtoJs(ex));
            }
        }
コード例 #5
0
        /// <summary>
        /// Проверить аргументы метода сервиса
        /// </summary>
        private bool CheckArguments(string editorID, long viewStamp, SchemeDTO dto)
        {
            if (editorID == Editor.EditorID)
            {
                SchemeView schemeView = Editor.SchemeView;

                if (schemeView != null)
                {
                    dto.ViewStamp = schemeView.Stamp;

                    if (SchemeUtils.ViewStampsMatched(viewStamp, schemeView.Stamp))
                    {
                        return(true);
                    }
                }
            }
            else
            {
                dto.EditorUnknown = true;
            }

            return(false);
        }