Exemplo n.º 1
0
        public NewFileDialog(DocInfo docInfo)
        {
            InitializeComponent();
            DataContext = App.Settings;
            _docInfo    = docInfo;

            Title = $"PCDMS Mockup - New {docInfo.Type}";
            cboLevel1.SelectedIndex = 0;
            cboLevel2.SelectedIndex = 0;
            cboLevel3.SelectedIndex = 0;
            cboLevel4.SelectedIndex = 0;
            cboLevel5.SelectedIndex = 0;
        }
Exemplo n.º 2
0
        public void Add(string level1, string level2, string level3, string level4, string level5, DocInfo docInfo)
        {
            StringBuilder sbCode = new StringBuilder();

            sbCode.Append($"{level1}-{level2}-{level3}-{level4}-{level5}-");

            var results = App.Settings.DocumentsList.Where(x => x.Name.Contains(sbCode.ToString()));
            int seq     = results.Count() + 1;

            sbCode.Append(seq.ToString("D4"));

            if (string.IsNullOrEmpty(docInfo.Name))
            {
                docInfo.Name = $"New {docInfo.Type}";
            }

            docInfo.Name = $"{sbCode} {docInfo.Name}";

            App.Settings.DocumentsList.Add(docInfo);
        }