/// <param name="fetch_rqst"></param> /// <example>FetchInit("SFacc/2:3")</example> public void FetchInit(string fetch_rqst) { Log.set("FetchInit(fetch_rqst)"); try { if (string.IsNullOrEmpty(fetch_rqst)) { FetchInit(); return; } string[] ar_rqst = fetch_rqst.Split('/'); if (!Documents.ContainsKey(ar_rqst[0])) Log.FATAL("нет такого Документа"); string strFetch = ar_rqst[0] + "/" + ar_rqst[1]; if (docDic.ContainsKey(strFetch)) return; // уже инициирован -> return Document doc = getDoc(ar_rqst[0]); string[] cols = ar_rqst[1].Split(':'); int key = Lib.ToInt(cols[0]); int val = Lib.ToInt(cols[1]); Dictionary<string, string> keyDic = new Dictionary<string, string>(); docDic.Add(strFetch, keyDic); DateTime t0 = DateTime.Now; for (int i = 1; i <= doc.Body.iEOL(); i++) { string s1 = doc.Body.Strng(i, key); if (s1 != "") try { keyDic.Add(s1, doc.Body.Strng(i, val)); } catch { Log.Warning("Запрос \"" + fetch_rqst + " Строка " + i + " неуникальное значение \"" + s1 + "\" в ключевом поле запроса!"); } } DateTime t1 = DateTime.Now; new Log("-> " + (t1 - t0)); } catch { Log.FATAL("ошибка запроса \"" + fetch_rqst + "\" для Документа \"" + name + "\""); } finally { Log.exit(); } }
public W_Supplier() { InitializeComponent(); Title = "TSmatch: выбор поставщика"; List <Spl> items = new List <Spl>(); Docs doc = Docs.getDoc(Decl.SUPPLIERS); for (int i = doc.i0; i <= doc.il; i++) { Supl s = new Supl(i); if (s == null || string.IsNullOrWhiteSpace(s.Name) || string.IsNullOrWhiteSpace(s.City)) { continue; } items.Add(new Spl(s.Name, Lib.ToInt(s.Index), s.City, s.Street, s.Url)); suppliers.Add(s); } Spl oldSupl = items.Find(x => x.SuplName == MainWindow.SuplName); if (oldSupl == null) { Msg.F("W_Supplier: No Selected SuplName"); } int ind = items.IndexOf(oldSupl); items[ind].Flag = true; log.Info("Supplier.Count=" + suppliers.Count + "\tInitial Supplier =\"" + oldSupl.SuplName + "\""); items.Sort(); Suppliers.ItemsSource = items; }
// if field of stype not recognized, return -1 //.. f.e. it happaned with constant like "M:C245" public int Col(SType stype) { if (stype.ToString().Contains("UNIT_")) { return(-1); } string str = string.Empty; try { str = dpar[stype]; } catch { } return(Lib.ToInt(str)); }
/// <summary> /// EOL(int tocRow) - setup this Document int numbers EndEOLinTOC, i0, and il - main table borders /// <para>when TSmatch.xlsx document handled, 'EOL' could be in il TOC column</para> /// </summary> /// <param name="tocRow">line number of this Document in TOC</param> /// <history>19.3.2016 /// 2017.8.2 - bug fix; EOL works for TSmatch Document type only /// </history> void EOL(int tocRow) { i0 = Lib.ToInt(toc.Body.Strng(tocRow, Decl.DOC_I0)); string str = toc.Body.Strng(tocRow, Decl.DOC_IL); if (str == "EOL") { if (type != Decl.TSMATCH) Msg.F("Shouldn't be 'EOL' here in TSmatch/TOC", tocRow); string shN = toc.Body.Strng(tocRow, Decl.DOC_SHEET); Mtr m; if (shN == Decl.DOC_TOC) m = toc.Body; else m = FileOp.getSheetValue(toc.Wb.Worksheets[shN]); il = m.iEOL(); } else il = Lib.ToInt(str); }
public int Int(int parNumber = 0) { if (parNumber < 0 || parNumber >= pars.Count) Msg.F("FP.Int() Not supported pars.Count", pars.Count); if(pars[parNumber].GetType() == typeof(string)) { string str = (string)pars[parNumber].par; int result = Lib.ToInt(str); if (result == -1) Msg.F("FP TMP not recognized Int", str); return result; } if (pars[parNumber].par.GetType() == typeof(int)) return (int)pars[parNumber].par; if (pars[parNumber].par.GetType() == typeof(string)) return Lib.ToInt((string)pars[parNumber].par); Msg.F("ErrFP string or integer parametr exected"); return -1; }
public Parameter(string str, ParType _type) : this(str) { ptype = _type; if (ptype == ParType.Integer) par = Lib.ToInt((string)par); if (ptype == ParType.Double) par = Lib.ToDouble((string)par); }