public void Recover(string repNm, RecoverToDo to_do) { Log.set(@"SR.Recover(" + repNm + "\")"); if (!CheckModelIntegrity(model)) Msg.AskFOK("Recovery impossible"); switch (to_do) { case RecoverToDo.CreateRep: Msg.AskFOK("В каталоге модели нет TSmatchINFO.xlsx/" + repNm + ". Создать?"); resetDialog = false; Docs.getDoc(repNm, reset: true, create_if_notexist: true); if (!Docs.IsDocExist(repNm)) Msg.F("SaveDoc.Recover cannot create ", repNm); Recover(repNm, RecoverToDo.ResetRep); break; case RecoverToDo.ResetRep: if (resetDialog) Msg.AskFOK("Вы действительно намерены переписать TSmatchINFO.xlsx/" + repNm + "?"); var w = new WrMod(); switch (repNm) { case Decl.TSMATCHINFO_MODELINFO: w.wrModel(WrM.ModelINFO, model); break; case Decl.TSMATCHINFO_REPORT: log.Info(">>mod.MD5=" + model.MD5 + " =?= " + model.getMD5(model.elements)); mh.Pricing(ref model); log.Info(">>mod.MD5=" + model.MD5 + " =?= " + model.getMD5(model.elements)); w.wrModel(WrM.Report, model); break; } break; } Log.exit(); }
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; } }
protected void SetModDir(Boot boot) { const string me = "SavedReport__SetModelDir_"; Msg = boot.Msg; if (boot.isTeklaActive) { // if Tekla is active - get Path of TSmatch model.name = Path.GetFileNameWithoutExtension(TS.ModInfo.ModelName); model.dir = TS.GetTeklaDir(TS.ModelDir.model); model.phase = TS.ModInfo.CurrentPhase.ToString(); //6/4/17 macroDir = TS.GetTeklaDir(TS.ModelDir.macro); model.HighLightClear(); } else { // if Tekla not active - get model attributes from TSmatchINFO.xlsx in ModelDir model.dir = boot.ModelDir; if (!FileOp.isDirExist(model.dir)) Msg.F(me + "No Model Directory", model.dir); if (!Docs.IsDocExist(Decl.TSMATCHINFO_MODELINFO)) Msg.F(me + "No_TSmatchINFO", model.dir); dINFO = Docs.getDoc(sINFO, fatal: false); if (dINFO == null || dINFO.il < 10 || !FileOp.isDirExist(model.dir)) error(); model.name = dINFO.Body.Strng(Decl.MODINFO_NAME_R, 2); model.phase = dINFO.Body.Strng(Decl.MODINFO_PHASE_R, 2); } }