Exemple #1
0
        /// <summary>
        /// Создать реквизит из текста.
        /// </summary>
        /// <param name="code">Код реквизита.</param>
        /// <param name="text">Текст реквизита.</param>
        /// <returns>Модель реквизита.</returns>
        public static RequisiteModel CreateFromText(string code, string text)
        {
            var requisite = new RequisiteModel();

            requisite.Code        = code;
            requisite.Type        = TextRequisiteType;
            requisite.DecodedText = text;
            return(requisite);
        }
Exemple #2
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 /// <param name="model">Модель.</param>
 public RequisiteModel(RequisiteModel model)
 {
     this.Code            = model.Code;
     this.Value           = model.Value;
     this.ValueLocalizeID = model.ValueLocalizeID;
     this.TypeRu          = model.TypeRu;
     this.TypeEn          = model.TypeEn;
     this.Text            = model.Text;
 }
Exemple #3
0
        /// <summary>
        /// Загрузить реквизит из файла.
        /// </summary>
        /// <param name="code">Код реквизита.</param>
        /// <param name="fileName">Имя файла.</param>
        /// <returns>Модель реквизита.</returns>
        public static RequisiteModel CreateFromFile(string code, string fileName)
        {
            var requisite = new RequisiteModel();

            requisite.Code = code;
            requisite.Type = TextRequisiteType;
            if (File.Exists(fileName))
            {
                var bytes = File.ReadAllBytes(fileName);
                requisite.DecodedText = TransformerEnvironment.CurrentEncoding.GetString(bytes);
            }
            return(requisite);
        }