Exemple #1
0
 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();
 }
Exemple #2
0
 /// <summary>
 /// Save(model) - save means write model in file TSmatchINFO.xlsx
 /// </summary>
 /// <remarks>
 /// Write Documents
 /// - ModelINFO
 /// - Report
 /// - Rules
 /// as the Sheets in Excel file TSmatchINFO.xlsx
 /// </remarks>
 /// <param name="model"></param>
 public void Save(Mod model)
 {
     if (!CheckModelIntegrity(model)) model.mh.Pricing(ref model);
     var w = new WrMod();
     w.wrModel(WrM.ModelINFO, model);
     w.wrModel(WrM.Report, model);
     if (model.Rules.Count == 0) GetSavedRules(model, init: false);
     w.wrModel(WrM.Rules, model);
 }