public Task(WorkDB aDB) : base(aDB) { mSes = new Session(); pFileName = string.Empty; }
public bool New() { bool ret = true; mSes = new Session(); pFileName = string.Empty; return ret; }
/// <summary> /// Загрузка сессии из файла [pFileName]. /// </summary> /// <returns> /// true - сессия успешно загружена; /// false - не загружена, ошибка в pError. /// </returns> public bool Load() { mErr.Clear(); if (pFileName.Length == 0) { mErr.text = "Не определена сессия (имя файла)!"; return false; } try { FileStream f = new FileStream(pFileName, FileMode.Open, FileAccess.Read); /// РАСПОЗНАЕМ версию сессии по расширению: string ext = Path.GetExtension(pFileName).ToLower(); if (ext.Equals(Performer.CURRENT_SESSION_EXT)) { // Текущая версия XmlSerializer xs = new XmlSerializer(typeof(Session)); mSes = (Session)xs.Deserialize(f); } else if (ext.Equals(".sq2")) { // Преобразуем из версии 2 в текущую версию XmlSerializer xs = new XmlSerializer(typeof(CommandAS.QueryLib2.Session)); CommandAS.QueryLib2.Session ses2 = (CommandAS.QueryLib2.Session)xs.Deserialize(f); mSes = new Session(ses2); } f.Close(); } catch (Exception ex) { mErr.ex = ex; } return mErr.IsOk; }
public void Load(Performer aPrf) { if (SelectedNode != null) _prevSelectedQuery = SelectedNode.Tag as Query; Nodes.Clear(); mCurrSession = aPrf.pSes; if (aPrf == null || aPrf.pQueries.Count == 0) return; Stack ownStack = new Stack(16); string [] ss = null; string [] prevSS = new string[0]; TreeNode node = null; //ArrayList qns = new ArrayList(_ses.Queries.Count); //foreach (Query q in _ses.Queries) // qns.Add(q.Name); // qns.Sort(); CompareQueryName cqn = new CompareQueryName(); aPrf.pQueries.Sort(cqn); foreach (Query q in aPrf.pQueries) { if (q.Hidden && (!pViewHidden)) continue; /// если установлен запрет на отображение, через виртуальную /// функцию _IsProhibition if (_IsProhibition(q)) continue; ss = q.Name.Split(PathSeparator.ToCharArray()); int ii = 0; for (; ii < prevSS.Length && ii < ss.Length && prevSS[ii].Equals(ss[ii]); ii++) { continue; } for(int jj = prevSS.Length-ii; jj>0 && ownStack.Count>0; jj--) ownStack.Pop(); for (; ii < ss.Length; ii++) { node = new TreeNode(ss[ii]); node.Tag = q; if (ownStack.Count > 0) { ((TreeNode)ownStack.Peek()).Nodes.Add(node); if (q.Hidden) node.ForeColor = SystemColors.GrayText; } else { Nodes.Add(node); } ownStack.Push(node); } prevSS = ss; } if (_prevSelectedQuery != null) SelectedNode = FindNodeByQuery(Nodes, _prevSelectedQuery); if (pViewHidden) ViewCodeText(Nodes); }
public Performer(WorkDB aDB) { mSes = null; mDB = aDB; //pCommonParamCollection = null; mDS = null; //new DataSet(RESULT_SET_NAME); mTab = null; //new DataTable(RESULT_TAB_NAME); mErr = new Error(); mTempFiles = new TemporaryFiles(); pTempPath = Path.GetTempPath(); pFileName = string.Empty; pResultMessage = string.Empty; mExecTime = new TimeSpan(0); }