Exemplo n.º 1
0
 /// <summary>
 /// List<Form> Init(int toc_line) - initiate all Forms for Document in toc_line.
 /// </summary>
 /// <param name="toc_line">line number in TOC</param>
 /// <returns>form list</returns>
 public static List<Form> Init(int toc_line)
 {
     Log.set("Init(" + toc_line + ")");
     //------------------------------------------------------------------------------
     language = true; //en-US for Englisg Debug. Remove or comment this line later  !
     //------------------------------------------------------------------------------
     List<Form> Forms = new List<Form>();
     for (int col = Decl.DOC_FORMS, i = 0; i < 10; i++)
     {
         string s = Lang(tocMtr.Strng(toc_line, col++));
         if (string.IsNullOrEmpty(s)) continue;
         if (FileOp.isNamedRangeExist(Wb, s))
         {
             List<int> _r = new List<int>();
             List<int> _c = new List<int>();
             string sf = s + "_F";
             if (FileOp.isNamedRangeExist(Wb, sf))
             {
                 Mtr format = new Mtr(Wb.Names.Item(sf).RefersToRange.Value);
                 for (int c = 1; c <= format.iEOC(); c++)
                     for (int r = 1; r <= format.iEOL(); r++)
                     {
                         string f = format.Strng(r, c);
                         if (f.Contains("{") & f.Contains("}")) { _r.Add(r); _c.Add(c); }
                     }
             }
             Forms.Add(new Form(s, _r, _c));
         }
     }
     Log.exit();
     return Forms;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Stamp.Check(mtr) - проверка mtr на соответствие Штампу в stmp. ОК->true, несовпадение->false
 /// </summary>
 /// <param name="mtr"></param>
 /// <returns>bool: true если проверка Штампа дает совпадение сигнатуры</returns>
 /// <history> 12.12.2013
 /// 25.12.13 (ПХ) ToString вместо Value2 для проверяемой ячейки
 /// 13.1.14 - работа с матрицами
 /// 18.1.14 - (ПХ) рефакторинг. Теперь сверяем strToCheck в mtr и SigInStamp в Штампе
 /// </history>
 public bool Check(Mtr mtr)
 {
     string sigInStamp = signature.ToLower();
     foreach (var pos in stampPosition) {
         string strToCheck = mtr.Strng(pos[0], pos[1]).ToLower();
         if (typeStamp == "=") {
             if (strToCheck == sigInStamp) return true;
         } else {
             if (strToCheck.Contains(sigInStamp)) return true;
         }
     }
     return false;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Start(TOCdir) - prepare further works with the Documents; setup data from TOC
 /// </summary>
 /// <param name="FileDir">Directory, Path to TSmatch.xlsx</param>
 /// <history> 22.1.2016
 /// 12.3.2016 - multilanguage Heders support
 /// 14.3.2016 - Form class support
 /// 19.3.2016 - use EOL method
 /// 30.3.2016 - Start(TOCdir) and getDoc with #template interaction with Bootstrap
 /// 17.4.2016 - tocStart extracted from Start for initial TOC open
 /// </history>
 public static void Start(Dictionary<string, string> _Templates)
 {
     Log.set("Document.Start(#Templates)");
     Templates = _Templates;
     //2/8            Document toc = tocStart(Templates["#TOC"]);
     toc = tocStart(Templates["#TOC"]);
     Mtr mtr = toc.Body;
     for (int i = toc.i0; i <= toc.il; i++)
     {
         string docName = mtr.Strng(i, Decl.DOC_NAME);
         if (docName != "")
         {
             Document doc = new Document(docName);
             // mtr относится только к TOCmatch, а не ко всем Документам,
             //.. то есть реально загружаем ТОС, а остальные Документы- потом
             if (doc.name == Decl.DOC_TOC) doc = toc;
             Documents.Add(docName, doc);
             doc.MadeTime = Lib.getDateTime(mtr[i, Decl.DOC_TIME]);
             doc.ResLines = Lib.ToIntList(mtr.Strng(i, Decl.DOC_TYPE), '/');
             doc.MadeStep = mtr.Strng(i, Decl.DOC_MADESTEP);
             doc.FileName = mtr.Strng(i, Decl.DOC_FILE);
             doc.FileDirectory = mtr.Strng(i, Decl.DOC_DIR);
             doc.type = mtr.Strng(i, Decl.DOC_TYPE);
             doc.isNewDoc = (doc.type == Decl.DOC_TYPE_N);
             doc.SheetN = mtr.Strng(i, Decl.DOC_SHEET);
             if (doc.type == Decl.TSMATCH_TYPE) doc.Sheet = toc.Wb.Worksheets[doc.SheetN];
             doc.creationDate = Lib.getDateTime(mtr[i, Decl.DOC_CREATED]);
             doc.Supplier = mtr.Strng(i, Decl.DOC_SUPPLIER);
             doc.LoadDescription = mtr.Strng(i, Decl.DOC_STRUCTURE_DESCRIPTION);
             doc.forms = Form.Init(i);
             doc.Loader = mtr.Strng(i, Decl.DOC_LOADER);
             doc.EOL(i);
             int j;
             for (j = i + 1; j <= mtr.iEOL() && mtr.Strng(j, Decl.DOC_NAME) == ""; j++) ;
             doc.stamp = new Stamp(i, j - 1);
         } //if docName !=""
     } // for по строкам TOC
     Log.exit();
 } // end Start