Exemple #1
0
        public String GetTemplateFilePath(PerformanceTemplate template)
        {
            String path = template.TemplateFilePath;

            path = Path.Combine(this.TemplateFloder, path);
            return(path);
        }
Exemple #2
0
        public PerformanceTemplateInfo CreateTemplateInfo(PerformanceTemplate template)
        {
            PerformanceTemplateInfo templateInfo = new PerformanceTemplateInfo(template);

            templateInfo.IsExistedTemplateFile = this.ExistingTemplateFile(template);
            templateInfo.Manager = this;
            return(templateInfo);
        }
Exemple #3
0
        /// <summary>
        /// 判断指定绩效模板对应的模板文件是否存在
        /// </summary>
        /// <param name="template"></param>
        /// <returns></returns>
        public Boolean ExistingTemplateFile(PerformanceTemplate template)
        {
            Boolean existed = false;
            String  path    = template.TemplateFilePath;

            path = Path.Combine(this.TemplateFloder, path);

            existed = File.Exists(path);
            return(existed);
        }
Exemple #4
0
        /// <summary>
        /// 保存绩效模板信息,若存在则覆盖,若未指定文件名称,则使用模板名称作为文件名称
        /// </summary>
        /// <param name="template"></param>
        public void SavePerformanceTemplate(PerformanceTemplate template, String fileName = null)
        {
            if (fileName == null)
            {
                fileName = template.Name + TemplateInfoFileExt;
            }
            String filePath = Path.Combine(this.TemplateFloder, fileName);

            if (!File.Exists(filePath))
            {
                File.Create(filePath).Dispose();
            }
            DataSerializer.Serialize(template, filePath);
        }
Exemple #5
0
        public Boolean CheckTemplateVaild(PerformanceTemplate template)
        {
            if (template == null || template.SchemaItems == null || template.SchemaItems.Length == 0)
            {
                return(false);
            }

            var tableSchemaItems = template.SchemaItems.Where(t => t.ItemType == TemplateSchemaItemType.Table);

            foreach (var tableSchemaItem in tableSchemaItems)
            {
                if (!tableSchemaItem.TableIndex.HasValue)
                {
                    return(false);
                }
                if (tableSchemaItem.TableIndex < 0)
                {
                    return(false);
                }

                if (tableSchemaItem.FillSchema != null)
                {
                    if (!tableSchemaItem.FillSchema.RowIndex.HasValue || tableSchemaItem.FillSchema.RowIndex.Value < 0)
                    {
                        return(false);
                    }
                }

                if (tableSchemaItem.ExtractSchema != null)
                {
                    if (!tableSchemaItem.ExtractSchema.RowIndex.HasValue)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemple #6
0
 public PerformanceTemplateInfo(PerformanceTemplate template) : this()
 {
     this.Template = template;
 }
 public void Init(PerformanceTemplate template)
 {
     this.PerformanceTemplate     = template;
     this.TemplateSchemaItemTable = this.PerformanceTemplate.SchemaItems.ToDictionary(t => t.Name);
 }