private void exeCmdGroup(StringBuilder pBuilder, XmlNode pNode, DataSet pDataSet) { string tabName = pNode.Attributes[_constAttrTable].Value; string filter = ToolXml.getAttribValue(pNode, _constAttrFilter, string.Empty); DataTable table = pDataSet.Tables[tabName]; table.DefaultView.RowFilter = filter; string[] colsArr = ToolString.explodeList(pNode.Attributes[_constAttrList].Value); DataTable[] grpTabs = ToolTable.explodeForGroups(table, colsArr); foreach (DataTable curTab in grpTabs) { if (curTab.DefaultView.Count > 0) { pDataSet.Tables.Remove(tabName); pDataSet.Tables.Add(curTab); setVars(curTab.DefaultView[0].Row); eval(pNode, pDataSet, pBuilder); } } pDataSet.Tables.Remove(tabName); pDataSet.Tables.Add(table); }
//public static Node[] Find(Node pNode, string pCode, bool pSub) //{ // List<Node> list = new List<Node>(); // foreach (Node node in pNode.getChildNodes()) // { // if (node.Code == pCode) // list.Add(node); // if (node.getChildCount() > 0) // list.AddRange(Find(node, pCode, pSub)); // } // return list.ToArray(); //} //List<string> listNodes = new List<string>(); //public string[] getNodes() //{ // return listNodes.ToArray(); //} //public void addNode(string nodeCode) //{ // listNodes.Add(nodeCode); //} //public void addNode(string[] nodeCodes) //{ // listNodes.AddRange(nodeCodes); //} void addNode(ISettings pSettings) { if (string.IsNullOrEmpty(getGlobalObjactName())) { return; } // ToolMobile.log("tree [" + getGlobalObjactName() + "] read struct"); Dictionary <string, string> dic = getNodes(pSettings); foreach (string nodeCode in dic.Keys) { string[] parents = ToolString.explodeList(dic[nodeCode]); Node lastNodes = RootNode; foreach (string nodeParentCode in parents) { Node res_ = lastNodes.Search(nodeParentCode, true); if (res_ == null) { res_ = new Node(nodeParentCode, string.Empty); lastNodes.Add(res_); } lastNodes = res_; } if (lastNodes != null) { lastNodes.Add(new Node(nodeCode, string.Empty)); } } }
void initFilters(ISettings sInfoFilters) { _filters.Clear(); if (sInfoFilters != null) { string[] filters = sInfoFilters.getAllSettings(); foreach (string filter in filters) { FilterInfo fInfo = new FilterInfo(); // fInfo.type = sInfoFilters.getStringAttr(filter, _attrFType); fInfo.code = filter; fInfo.desc = _environment.translate(sInfoFilters.getStringAttr(filter, _attrName)); fInfo.dataReference = _environment.getRefFactory().get(sInfoFilters.getStringAttr(filter, _attrRef)); fInfo.valueColumns = ToolString.explodeList(sInfoFilters.getStringAttr(filter, _attrRefColsVal)); fInfo.showColumns = ToolString.explodeList(sInfoFilters.getStringAttr(filter, _attrRefColsShow)); fInfo.showColumnsDesc = _environment.translate(ToolString.explodeList(sInfoFilters.getStringAttr(filter, _attrRefColsShowDesc))); fInfo.sqlPlaces = ToolString.explodeList(sInfoFilters.getStringAttr(filter, _attrSqlPlace)); fInfo.sqlTables = ToolString.explodeList(sInfoFilters.getStringAttr(filter, _attrSqlTable)); fInfo.sqlColumns = ToolString.explodeGroupList(sInfoFilters.getStringAttr(filter, _attrSqlCols)); fInfo.sqlParameters = ToolString.explodeList(sInfoFilters.getStringAttr(filter, _attrSqlParams));; fInfo.sqlParameter = sInfoFilters.getStringAttr(filter, _attrSqlParam); Type type = ToolType.parse(sInfoFilters.getStringAttr(filter, _attrSqlParamType)); fInfo.sqlParameterValue = sInfoFilters.getAttr(filter, _attrSqlParamValue, type, DBNull.Value); fInfo.flagRequire = sInfoFilters.getBoolAttr(filter, _attrRequire); fInfo.flagMulti = sInfoFilters.getBoolAttr(filter, _attrMulti); // _filters.Add(new ImplFilter(_environment, this, fInfo)); } } }
public ImplReportSource(IEnvironment pEnv, string pLocation) { //if (!Path.IsPathRooted(pLocation)) // pLocation = Path.Combine(ToolMobile.curDir(), pLocation); pLocation = ToolMobile.getFullPath(pLocation); _environment = pEnv; ISettings sInfo = new SettingsFromFileExt(pLocation, _fileInfo, _environment); initRenders(pLocation, sInfo); //var fileContent = ToolMobile.readFileText(Path.Combine(pLocation, sInfo.getString(_varFileDS))); var fileContent = ToolMobile.getFsOrResourceText(pLocation, sInfo.getString(_varFileDS)); _sqlQueryes = getSqlQueryes(fileContent); _aliases = ToolString.explodeList(sInfo.getString(_varListAlias, "TABLE")); string filtersFile = sInfo.getString(_varFileFilter, string.Empty); if (filtersFile != string.Empty) { initFilters(new SettingsFromFileExt(pLocation, filtersFile, _environment)); } else { initFilters(null); } }
protected virtual string[] getDescs() { string PARM = "MOB_DESCS_" + getId(); string list = environment.getSysSettings().getString(PARM); string[] items = ToolString.trim(ToolString.explodeList(list)); return(items); }
public object done() { Action startJob_ = () => { log.exceuteInContext = _done; log.show(); }; Action askFirm_ = () => { string firms_ = CurrentVersion.ENV.getFirms(); if (firms_ == string.Empty) { startJob_.Invoke(); } else { List <string> lNr = new List <string>(); List <string> lDesc = new List <string>(); string[] arr_ = ToolString.explodeList(firms_); // for (int i = 0; i < arr_.Length; i += 2) { lNr.Add(arr_[i]); lDesc.Add(arr_[i + 1]); } // ToolMsg.askList(null, lDesc.ToArray(), (s, e) => { int nr_ = XmlFormating.helper.parseInt(lNr[e.Which]); int port_ = CurrentVersion.getPortByFirmNr(nr_); CurrentVersion.ENV.setEnv(CurrentVersion.ENV.PORT, XmlFormating.helper.format(port_)); startJob_.Invoke(); } ); } }; ToolMsg.confirm(null, string.Format("{0} - {1}", MessageCollection.T_MSG_COMMIT_BEGIN, MessageCollection.T_MSG_DATA_RECEIVING), () => { askFirm_(); //log.exceuteInContext = _done; //log.show(); }, null); return(null); }
protected virtual string[] getQuiqFilterColumns() { if (quiqFilterColumns_ == null) { var s_ = settings.getString(SettingsAvaAgent.MOB_QSEARCH_COLS_S, null); quiqFilterColumns_ = string.IsNullOrEmpty(s_) ? new string[0] : ToolString.explodeList(s_); } if (quiqFilterColumns_.Length > 0) { return(quiqFilterColumns_); } return(null); }
void checkDoc(DataTable trans) { bool isCancelled = false; foreach (DataRow rowCurent in trans.Rows) { if (rowCurent.RowState != DataRowState.Deleted) { isCancelled = ((short)ToolCell.isNull(rowCurent[TableKSLINES.CANCELLED], (short)ConstBool.yes) == (short)ConstBool.yes); } } foreach (DataRow rowCurent in trans.Rows) { if (rowCurent.RowState != DataRowState.Deleted) { string[] arrReqCols = ToolString.explodeList(environment.getSysSettings().getString("MOB_REQCOLS_" + getId())); foreach (string col in arrReqCols) { if (col != string.Empty && rowCurent.Table.Columns.Contains(col)) { string val = ToolCell.isNull(rowCurent, col, string.Empty).ToString().Trim(); if (val == string.Empty) { throw new MyBaseException(MessageCollection.T_MSG_SET_REQFIELDS); } } } if (!isCancelled) { if (!CurrentVersion.ENV.isZeroDocAllowed()) { double amount = (double)rowCurent[TableKSLINES.AMOUNT]; if (amount < ConstValues.minPositive) { throw new MyBaseException(MessageCollection.T_MSG_EMPTY_DOC); } } } if ((string)ToolCell.isNull(rowCurent[TableKSLINES.CLIENTREF], string.Empty) == string.Empty) { throw new MyBaseException(MessageCollection.T_MSG_SET_CLIENT); } } } }
public override void globalRead(IEnvironment pEnv, ISettings pSettings) { base.globalRead(pEnv, pSettings); //string infoList = pSettings.getString(InfoSource); //if (infoList != string.Empty) //{ // IDictionary<string, string> dic = ToolString.explodeForParameters(infoList); // IEnumerator<string> enumer = dic.Keys.GetEnumerator(); // enumer.Reset(); // while (enumer.MoveNext()) // { // MobMenuItem item = new MobMenuItem(); // item.Text = pEnv.translate(dic[enumer.Current]); // item.activity = ReportFactory.createActivity(pEnv, pSettings, enumer.Current, rowSource ); // this.MenuItems.Add(item); // } //} //else // this.Enabled = false; string infoList = pSettings.getString(InfoSource); if (infoList != string.Empty) { string[] arr = ToolString.explodeList(pSettings.getString(InfoSource)); foreach (string srcName in arr) { //check //MobMenuItem item = new MobMenuItem(); //item.Text = pEnv.translate(pSettings.getStringAttr(srcName, "name")); //string location = pSettings.getStringAttr(srcName, "location"); //string[] arrParm = ToolString.explodeList(pSettings.getStringAttr(srcName, "params")); //string[] arrCols = ToolString.explodeList(pSettings.getStringAttr(srcName, "cols")); //item.activity = new NodeActivity(pEnv, rowSource, location, arrParm, arrCols); //item.Click += new EventHandler(item_Click); //this.MenuItems.Add(item); } } else { this.Enabled = false; } }
protected virtual void initExportDescriptor(IDataExchangeExt pDataExchange, IAdapterUser pUserAdapter) { string attrExpDesc = "expdesc"; string attrTab = "table"; string attrCols = "cols"; string[] arrDesc = ToolString.explodeList(_environment.getAppSettings().getStringAttr(pUserAdapter.getAdapterDataSet().getCode(), attrExpDesc)); IDictionary <string, string[]> data = new Dictionary <string, string[]>(); foreach (string desc in arrDesc) { data.Add( _environment.getAppSettings().getStringAttr(desc, attrTab), ToolString.explodeList(_environment.getAppSettings().getStringAttr(desc, attrCols)) ); } pDataExchange.setExportDescriptor(data); }
protected virtual CmdMenuItem[] createMenuItems() { List <CmdMenuItem> list = new List <CmdMenuItem>(); list = new List <CmdMenuItem>(); // if (reference != null && reference.getReferenceMode() != null && reference.getReferenceMode().batchModeIndexes != null) { string[] indx_ = reference.getReferenceMode().batchModeIndexes; //0 bound to Ok button //if (indx_.Length > 0) // list.Add(new CmdMenuItem() { CmdType = CmdType.batch1, Text = ToolMobile.getEnvironment().translate(indx_[0]) }); if (indx_.Length > 1) { list.Add(new CmdMenuItem() { CmdType = CmdType.batch2, Text = ToolMobile.getEnvironment().translate(indx_[1]) }); } if (indx_.Length > 2) { list.Add(new CmdMenuItem() { CmdType = CmdType.batch3, Text = ToolMobile.getEnvironment().translate(indx_[2]) }); } if (indx_.Length > 3) { list.Add(new CmdMenuItem() { CmdType = CmdType.batch4, Text = ToolMobile.getEnvironment().translate(indx_[3]) }); } if (indx_.Length > 4) { list.Add(new CmdMenuItem() { CmdType = CmdType.batch5, Text = ToolMobile.getEnvironment().translate(indx_[4]) }); } } // list.Add(new CmdMenuItem() { CmdType = CmdType.refresh, Text = ToolMobile.getEnvironment().translate(WordCollection.T_REFRESH) }); list.Add(new CmdMenuItem() { CmdType = CmdType.add, Text = ToolMobile.getEnvironment().translate(WordCollection.T_ADD) }); list.Add(new CmdMenuItem() { CmdType = CmdType.view, Text = ToolMobile.getEnvironment().translate(WordCollection.T_VIEW) }); list.Add(new CmdMenuItem() { CmdType = CmdType.edit, Text = ToolMobile.getEnvironment().translate(WordCollection.T_EDIT) }); list.Add(new CmdMenuItem() { CmdType = CmdType.copy, Text = ToolMobile.getEnvironment().translate(WordCollection.T_COPY) }); list.Add(new CmdMenuItem() { CmdType = CmdType.delete, Text = ToolMobile.getEnvironment().translate(WordCollection.T_DELETE) }); string infoList = settings.getString("INFO_SOURCE"); if (infoList != string.Empty) { string[] arr = ToolString.explodeList(infoList); int indx_ = 0; foreach (string srcName in arr) { string text = ToolMobile.getEnvironment().translate(settings.getStringAttr(srcName, "name")); string location = settings.getStringAttr(srcName, "location"); string[] arrParm = ToolString.explodeList(settings.getStringAttr(srcName, "params")); string[] arrCols = ToolString.explodeList(settings.getStringAttr(srcName, "cols")); IActivity activity_ = new RefMenuItemActivity(ToolMobile.getEnvironment(), (IRowSource)getGrid(), location, arrParm, arrCols); list.Add(new CmdMenuItem() { CmdType = (CmdType)((int)CmdType.info1 + indx_), Text = text, activity = activity_ }); ++indx_; } } return(list.ToArray()); }
public string[] getListAttr(string name, string attr, string[] def) { return(ToolString.explodeList(this.getStringAttr(name, attr, ToolString.joinList(def)))); }
public string[] getList(string name, string[] def) { return(ToolString.explodeList(this.getString(name, ToolString.joinList(def)))); }
public string[] getListAttr(string name, string attr) { return(ToolString.explodeList(this.getStringAttr(name, attr))); }
public string[] getList(string name) { return(ToolString.explodeList(this.getString(name))); }
public string[] getListAttrEnumer(string attr, string[] def) { return(ToolString.explodeList(getStringAttrEnumer(attr, ToolString.joinList(def)))); }
public string[] getListAttrEnumer(string attr) { return(ToolString.explodeList(getStringAttrEnumer(attr))); }
public void import(XmlDocument doc) { XmlElement rootNode = doc[_nodeRootName]; char sepChar = '\t'; string adpName = _userAdapter.getAdapterDataSet().getCode(); foreach (XmlNode itemNode in rootNode.ChildNodes) { if ((itemNode.Name == _nodeItemName) && (itemNode.Attributes[_attrRootCode].Value == adpName)) { _userAdapter.add(); DataSet dataSet = _userAdapter.getDataSet(); foreach (XmlNode itemNodeTable in itemNode.ChildNodes) { string colsList = itemNodeTable.Attributes[_attrItemTableCols].Value; string[] colsArr = ToolString.explodeList(sepChar, colsList); string tableName = itemNodeTable.Name; DataTable tableD = dataSet.Tables[tableName]; if (tableD == null) { throw new MyException.MyExceptionError(MessageCollection.T_MSG_ERROR_INNER, new object[] { tableName }); } tableD.Clear(); string data = itemNode.InnerText; // StringReader reader = new StringReader(data); var lineIndx = 0; var commitCounter = 0; string line; var listCode = new List <string>(); while ((line = reader.ReadLine()) != null) { ++lineIndx; try { if (line != string.Empty) { string[] arrData = ToolString.explodeList(sepChar, line); //line.Split(sepChar); if (arrData == null || arrData.Length != colsArr.Length) { throw new MyException.MyExceptionError(MessageCollection.T_MSG_ERROR_INVALID_ARGS_COUNT, new object[] { line }); } // if (lineIndx > 10) // break; var rowDic = new Dictionary <string, string>(); for (int indxColD = 0; indxColD < colsArr.Length; ++indxColD) { var col = colsArr[indxColD]; var colVal = arrData[indxColD]; if (col == "CODE") { var keyCode = colVal.ToUpperInvariant(); if (keyCode == "") { //throw new Exception("Record CODE is empty: index: " + lineIndx); colVal = "EMPTYCODE" + lineIndx; } else if (listCode.Contains(keyCode)) { throw new Exception("Record dublicate: " + keyCode); } else { listCode.Add(keyCode); } } rowDic[col] = colVal; } switch (tableName) { //case "FIRMPARAMS": // SqlExecute.executeNonQuery(_environment, "INSERT INTO L_FIRMPARAMS (LOGICALREF,CODE,VALUE) VALUES (@P1,@P2,@P3 )", // new object[] { rowDic["CODE"], rowDic["CODE"], rowDic["VALUE"] }); // break; //case "CLCARD": // SqlExecute.executeNonQuery(_environment, "INSERT INTO LG_$FIRM$_CLCARD (LOGICALREF,CODE,CLGRPCODE,CLGRPCODESUB) VALUES (@P1,@P2,@P3,@P4)", // new object[] { rowDic["LOGICALREF"], rowDic["CODE"], rowDic["CLGRPCODE"], rowDic["CLGRPCODESUB"] }); // break; //case "ITEMS": // SqlExecute.executeNonQuery(_environment, "INSERT INTO LG_$FIRM$_ITEMS (LOGICALREF,CODE,STGRPCODE,STGRPCODESUB) VALUES (@P1,@P2,@P3,@P4)", // new object[] { rowDic["LOGICALREF"], rowDic["CODE"], rowDic["STGRPCODE"], rowDic["STGRPCODESUB"] }); // break; default: { DataRow newRowD = _userAdapter.addRowToTable(tableD); foreach (var pair in rowDic) { DataColumn dCol = tableD.Columns[pair.Key]; if (dCol == null) { throw new MyException.MyExceptionError(MessageCollection.T_MSG_ERROR_INNER, new object[] { pair.Key }); } var value_ = _formating.parse(pair.Value, dCol.DataType); newRowD[dCol] = value_; } } break; } ++commitCounter; //if (commitCounter > 1) //{ // _userAdapter.update(); // _userAdapter.clear(); // tableD.Clear(); // // // // // commitCounter = 0; //} } } catch (Exception exc) { ToolMobile.setRuntimeMsg(line); ToolMobile.setRuntimeMsg(exc.ToString()); throw new Exception(exc.Message, exc); } } } _userAdapter.update(); } } }