protected void CheckResx(string rName, string rValue) { ResType type = ResType.Err; foreach (var x in ResTab) { if (!rValue.Contains(x.Value)) continue; type = x.Key; break; } int indx = rValue.IndexOf(':') + 1; string v = rValue.Substring(indx).Trim(); switch (type) { case ResType.Doc: if (!Docs.IsDocExist(rName)) resxError(ResErr.NoDoc, rName); break; case ResType.File: if (!FileOp.isFileExist(rName)) resxError(ResErr.NoFile, rName); break; case ResType.Date: DateTime d = Lib.getDateTime(v); Docs doc = Docs.getDoc(rName, fatal: false); if (doc == null) resxError(ResErr.NoDoc, rName); string sdd = doc.Body.Strng(1, 1); DateTime dd = Lib.getDateTime(sdd); if (dd < d) resxError(ResErr.Obsolete, rName); break; case ResType.Resx: break; default: resxError(ResErr.ErrResource, rName); break; } }
/// <summary> /// GetTSmatchINFO(Model) - Main SaveReport method. Read TSmatchINFO.xlsx and Raw.xml /// </summary> /// <remarks>When no TSmatchINFO.xlsx or Raw.xml files exists, create (or mark to create) them, and check model integrity</remarks> protected void GetTSmatchINFO(Mod mod, bool initRules = false) { Log.set("SR.GetTSmatchINFO(\"" + mod.name + "\")"); model = mod; dINFO = Docs.getDoc(sINFO, fatal: false); if (dINFO == null) error(); model.elements = Raw(model); if (model.isChanged) { //-- no information available from TSmatchINFO.xlsx or it was changed -- doing re-Pricing model.mh.Pricing(ref model, initRules); } else { //- get ModelINFO and pricing from TSmatchINFO.xlsx model.name = dINFO.Body.Strng(Decl.MODINFO_NAME_R, 2); model.setCity(dINFO.Body.Strng(Decl.MODINFO_ADDRESS_R, 2)); //20/8/2017 model.dir = dINFO.Body.Strng(Decl.MODINFO_DIR_R, 2).Trim(); model.date = Lib.getDateTime(dINFO.Body.Strng(Decl.MODINFO_DATE_R, 2)); model.pricingDate = Lib.getDateTime(dINFO.Body.Strng(Decl.MODINFO_PRCDAT_R, 2)); model.pricingMD5 = dINFO.Body.Strng(Decl.MODINFO_PRCMD5_R, 2); GetSavedReport(); GetSavedRules(model, initRules); } if (!CheckModelIntegrity(model)) error(); Log.exit(); }
private void getSupplier(int n) { Docs docSupl = Docs.getDoc(Decl.SUPPLIERS); Date = Lib.getDateTime(docSupl.Body[n, Decl.SUPL_DATE]); Name = (string)docSupl.Body[n, Decl.SUPL_NAME]; Url = (string)docSupl.Body[n, Decl.SUPL_URL]; City = (string)docSupl.Body[n, Decl.SUPL_CITY]; Street = (string)docSupl.Body[n, Decl.SUPL_STREET]; Index = (string)docSupl.Body[n, Decl.SUPL_INDEX]; Telephone = (string)docSupl.Body[n, Decl.SUPL_TEL]; }
public Rule(Docs doc, int i) { date = Lib.getDateTime(doc.Body.Strng(i, Decl.RULE_DATE)); Text = doc.Body.Strng(i, Decl.RULE_RULETEXT); text = Lib.ToLat(Text.ToLower()); synonyms = RuleSynParse(text); ruleDP = new DP(text); sSupl = doc.Body.Strng(i, Decl.RULE_SUPPLIERNAME); sCS = doc.Body.Strng(i, Decl.RULE_COMPSETNAME); if (date > DateTime.Now || date < Decl.OLD || string.IsNullOrWhiteSpace(Text) || string.IsNullOrWhiteSpace(sSupl) || string.IsNullOrWhiteSpace(sCS)) { throw new InvalidCastException("Rule line " + i); } }
public Model(Docs doc, int i, bool doInit = true) { this.date = Lib.getDateTime(doc.Body[i, Decl.MODEL_DATE]); this.name = doc.Body.Strng(i, Decl.MODEL_NAME); this.dir = doc.Body.Strng(i, Decl.MODEL_DIR); this.ifcPath = doc.Body.Strng(i, Decl.MODEL_IFCPATH); this.Made = doc.Body.Strng(i, Decl.MODEL_MADE); this.Phase = doc.Body.Strng(i, Decl.MODEL_PHASE); this.MD5 = doc.Body.Strng(i, Decl.MODEL_MD5); // преобразуем список Правил из вида "5,6,8" в List<Rule> strListRules = doc.Body.Strng(i, Decl.MODEL_R_LIST); if (doInit) { foreach (int n in Lib.GetPars(strListRules)) Rules.Add(new Rule.Rule(n)); } }
public static Model RecentModel() { string date = "1.1.52"; int iMod = 0; Docs doc = Docs.getDoc(Decl.MODELS); for (int i = doc.i0; i <= doc.il; i++) { if (doc.Body[i, Decl.MODEL_NAME] != null) { string modDate = doc.Body.Strng(i, Decl.MODEL_DATE); if (Lib.getDateTime(modDate) > Lib.getDateTime(date)) { date = modDate; iMod = i; } } } return new Model(iMod, doInit: false); }
public bool getSavedReport(bool doRead = false) { //9/4 getModelInfo(); Docs doc = Docs.getDoc(Decl.TSMATCHINFO_MODELINFO); if (isChangedStr(name, doc, 2, 2)) { return(false); } date = Lib.getDateTime(doc.Body.Strng(5, 2)); if (doRead) { Read(); Handler(); Report(); } getSavedGroups(); return(true); }
/// <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
public Resource(string _name, string _type, string _dat) { type = _type; name = _name; date = Lib.getDateTime(_dat); }