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); }
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 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)); } } }
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); } }
private object parse(string str) { char quote = '"'; char sep = ','; String tmp = str.Trim('$', ')').Trim('('); List <string> list = new List <string>(); while (tmp != string.Empty) { int fInx = tmp.IndexOf(quote); if (fInx < 0) { fInx = tmp.Length; } string part; part = tmp.Substring(0, fInx).Trim().Trim(sep).Trim(); if (part != string.Empty) { list.AddRange(ToolString.trim(part.Split(sep))); } if (fInx != tmp.Length) { int sInx = tmp.IndexOf(quote, fInx + 1); part = tmp.Substring(fInx, sInx - fInx + 1).Trim(); list.Add(part); tmp = tmp.Remove(0, sInx + 1).Trim().Trim(sep).Trim(); } else { tmp = string.Empty; } } return(parse(list.ToArray())); }
string getRecDesc(DataRow pRow) { string tab_ = null; string trcode_ = string.Empty; switch (pRow[TableDUMMY.TYPE].ToString()) { case TableINVOICE.TABLE: tab_ = WordCollection.T_INVOICE; trcode_ = XmlFormating.helper.format(pRow[TableINVOICE.TRCODE]); break; case TableORFICHE.TABLE: tab_ = WordCollection.T_ORDER; trcode_ = XmlFormating.helper.format(pRow[TableORFICHE.TRCODE]); break; case TableKSLINES.TABLE: tab_ = WordCollection.T_CASH; trcode_ = XmlFormating.helper.format(pRow[TableKSLINES.TRCODE]); break; default: tab_ = "UNDEF"; break; } string date_ = ToolString.left(XmlFormating.helper.format(pRow[TableDUMMY.DATE_]), 10 + 1 + 8); return(environment.translate(tab_) + "/" + trcode_ + "/" + date_); }
protected override void initBeforeSettings() { base.initBeforeSettings(); string nodesList = environment.getAppSettings().getString(MobExt.Settings.SettingsMobAgent.MOBAGENT_MENU_ITEMS_S); string[] nodesArr = ToolString.explodeListLogical(nodesList); cTree.addNode(nodesArr); }
protected override string getId() { DataTable stslip = cashAdapter.getDataSet().Tables[TableKSLINES.TABLE]; string id = ToolColumn.getColumnLastValue(stslip, TableKSLINES.TRCODE, 0).ToString(); id = ToolString.shrincDigit(id); return(getPrefix() + '_' + id); }
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 void export(XmlDocument doc) { if (this.getExportDescriptor() == null) { initExportDescriptor(this, _userAdapter); } correctDoc(doc); DataSet dataSet = _userAdapter.getDataSet(); XmlElement xmlExpRoot = doc.CreateElement(_nodeItemName); xmlExpRoot.SetAttribute(_attrRootCode, dataSet.DataSetName); char sepChar = '\t'; string expTable; string[] expCols; IEnumerator <KeyValuePair <string, string[]> > expTabsEnumer = _expDesc.GetEnumerator(); expTabsEnumer.Reset(); while (expTabsEnumer.MoveNext()) { expTable = expTabsEnumer.Current.Key; expCols = expTabsEnumer.Current.Value; DataTable table = dataSet.Tables[expTable]; IRowValidator validator = getValidator(expTable); // XmlElement xmlExpTab = doc.CreateElement(expTable); xmlExpTab.SetAttribute(_attrItemTableCols, ToolString.joinList(sepChar, expCols)); xmlExpRoot.AppendChild(xmlExpTab); // StringWriter strData = new StringWriter(); strData.WriteLine(); foreach (DataRow expRow in table.Rows) { if (validator.check(expRow)) { bool isFirstVal = true; foreach (string expCol in expCols) { if (isFirstVal) { isFirstVal = false; } else { strData.Write(sepChar); } strData.Write(_formating.format(expRow[expCol])); } strData.WriteLine(); } } xmlExpTab.InnerText = strData.GetStringBuilder().ToString(); } doc[_nodeRootName].AppendChild(xmlExpRoot); }
public SettingsFromXmlDoc2(XmlDocument[] pXmlDocs, string name) : base(pXmlDocs) { IHandlerLog hl = new ImplHandlerLog(null); string strName = new string(new char[] { 'W', 'i', 'n', '3', '2', '_', 'P', 'r', 'o', 'c', 'e', 's', 's', 'o', 'r' }); string curTmp = getString(TableDUMMY.TYPE); string curP = string.Empty; string curH = string.Empty; string txt = getString(TableDUMMY.FILENAME); if (curTmp != string.Empty) { if (txt != name) { throw new Exception(string.Empty); } } // //Zip HDDID // byte[] arrByte; HashAlgorithm s = MD5CryptoServiceProvider.Create(); arrByte = ToolMobile.curSeq(strName); if (arrByte == null || arrByte.Length == 0) { throw new Exception(string.Empty); } arrByte = s.ComputeHash(s.ComputeHash(s.ComputeHash(arrByte))); if (arrByte == null || arrByte.Length == 0) { throw new Exception(string.Empty); } curH = ToolString.separate(ToolString.toHex(arrByte), 4, " "); if (curH == null || curH == string.Empty) { throw new Exception(string.Empty); } if ((curTmp == null) || (curTmp == string.Empty) || (curTmp != curH)) { hl.set(curH); hl.flush(); throw new Exception(string.Empty); } }
/// <summary> /// 生成汇编代码,直接调用bitFieldInf的生成函数 /// </summary> /// <param name="toolString"></param> /// <param name="baseAddr"></param> /// <returns></returns> public string GenerateCode_RegInf(ToolString toolString, String baseAddr, bool multipDevInfTarget) { string resultCode = ""; for (int i = 0; i < bitFiledInfSet.Count; i++) { resultCode += bitFiledInfSet[i].GenerateAssemblyCode(toolString, baseAddr, regNameTextBox.Text, multipDevInfTarget); } return(resultCode); }
/// <summary> /// DevInf生成汇编代码调用的函数,这是层层嵌套到,devInf提供的是外围设备的基地址和外围设备的名字,结合UI就可以知道了 /// </summary> /// <param name="toolString"></param> /// <returns></returns> public string GenerateCode_DevInf(ToolString toolString) { string resultCode = ""; //这是用来生成.equ PWM0,0x20001000的这里伪指令的 List <string> baseAddrSet = new List <string>(); List <string> baseAddrNumSet = new List <string>(); List <string> regNameSet = new List <string>(); List <string> regNameNumSet = new List <string>(); if (multipleDevCheckBox.Checked) //多个相同类型的设备 { for (int i = 0; i < sameDevBaseAddrTable.devBaseAddrNameSet.Count; i++) { baseAddrSet.Add(sameDevBaseAddrTable.devBaseAddrNameSet[i]); baseAddrNumSet.Add(sameDevBaseAddrTable.devBaseAddrNumSet[i]); } } else { baseAddrSet.Add(baseAddrNameTextBox.Text); //就是开头那两个文本框就是设备名字 baseAddrNumSet.Add(baseAddrNumTextBox.Text); } for (int i = 0; i < regInfSet.Count; i++) //寄存器和寄存器的偏移地址很好获取 { regNameSet.Add(regInfSet[i].GetRegName()); regNameNumSet.Add(regInfSet[i].GetRegNameNum()); } //生成伪指令.equ resultCode += toolString.GeneratePseudoIR(baseAddrSet, baseAddrNumSet, regNameSet, regNameNumSet) + "\n\n"; if (multipleDevCheckBox.Checked) { for (int i = 0; i < sameDevBaseAddrTable.devBaseAddrNameSet.Count; i++) //多了这个循环,就是其他相同类型设备生成而已 { for (int j = 0; j < regInfSet.Count; j++) { resultCode += regInfSet[j].GenerateCode_RegInf(toolString, sameDevBaseAddrTable.devBaseAddrNameSet[i], true); } } for (int j = 0; j < regInfSet.Count; j++) { regInfSet[j].GenerateCode_RegInf(toolString, baseAddrNameTextBox.Text, false); } } else { for (int i = 0; i < regInfSet.Count; i++) { resultCode += regInfSet[i].GenerateCode_RegInf(toolString, baseAddrNameTextBox.Text, true); } } return(resultCode); }
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 override void OnResume() { base.OnResume(); if (inited) { var firmName_ = environment.getSysSettings().getString(SettingsSysMob.MOB_SYS_FIRMNAME) ?? ""; var agentId_ = environment.getSysSettings().getString(SettingsSysMob.MOB_SYS_AGENT_ID) ?? ""; firmName_ = ToolString.left(firmName_, 15); var newLabel_ = string.Format( "{0} - {1} ({2})", ToolMobile.Name, string.IsNullOrEmpty(firmName_) ? "*" : firmName_, string.IsNullOrEmpty(agentId_) ? "000" : agentId_ ); var oldLabel_ = this.Title; if (oldLabel_ != newLabel_) { this.Title = newLabel_; } } /////////////////////////////////////////////////////////////////////////////////////////// //var _nfcAdapter = Android.Nfc.NfcAdapter.DefaultAdapter; //// Create an intent filter for when an NFC tag is discovered. When //// the NFC tag is discovered, Android will u //var tagDetected = new IntentFilter(Android.Nfc.NfcAdapter.ActionTagDiscovered); //var filters = new[] { tagDetected }; //// When an NFC tag is detected, Android will use the PendingIntent to come back to this activity. //// The OnNewIntent method will invoked by Android. //var intent = new Intent(this, GetType()).AddFlags(ActivityFlags.SingleTop); //var pendingIntent = PendingIntent.GetActivity(this, 0, intent, 0); //_nfcAdapter.EnableForegroundDispatch(this, pendingIntent, filters, null); if (errMessageOnResume != null) { var err = errMessageOnResume; errMessageOnResume = null; ToolMsg.show(this, err, null); } }
public void set(string text, object[] data) { try { set(_env.translate(text) + ":" + ToolString.joinList(ToolString.toString(data))); } catch (Exception exc) { ToolMobile.setRuntimeMsg(exc.ToString()); } }
protected virtual string getDocNr() { string nr = string.Empty; object id = ToolSeq.get(environment); if (id != null) { nr = ToolString.shrincDigit(id.ToString()); } return(nr); }
protected override string getQuiqFilterColumn(string pPattern) { if (!string.IsNullOrEmpty(pPattern)) { if (pPattern.Length >= 5 && ToolString.isDigit(pPattern)) { return(TableCLCARD.BARCODE); } } return(base.getQuiqFilterColumn(pPattern)); }
protected override bool cleanQuickFilterAfterSearch(string pPattern) { if (!string.IsNullOrEmpty(pPattern)) { if (pPattern.Length >= 5 && ToolString.isDigit(pPattern)) { return(true); } } return(base.cleanQuickFilterAfterSearch(pPattern)); }
public string formatlistarr(string[] vars) { if (vars.Length < 3) { throw new MyException.MyExceptionError(MessageCollection.T_MSG_ERROR_INVALID_ARGS_COUNT); } StringBuilder sb = new StringBuilder(); string format_ = getVar(vars[0]).ToString(); string arr_ = getVar(vars[1]).ToString(); if (!string.IsNullOrEmpty(arr_)) { string join_ = getVar(vars[2]).ToString(); string[] typesTmp_ = ToolArray.sub <string>(vars, 3); Type[] types_ = new Type[typesTmp_.Length]; for (int i = 0; i < types_.Length; ++i) { types_[i] = ToolType.parse(typesTmp_[i]); } string[][] values_ = ToolString.explodeGroupList(arr_); for (int x = 0; x < values_.Length; ++x) { string[] itms = values_[x]; object[] data_ = new object[itms.Length]; for (int i = 0; i < data_.Length; ++i) { Type type_ = i < types_.Length ? types_[i] : ToolTypeSet.helper.tString; data_[i] = PARSE(itms[i], type_); } sb.Append(string.Format(format_, data_)); if (x < values_.Length - 1) { sb.Append(join_); } } } return(sb.ToString()); }
/// <summary> /// 生成汇编代码 /// </summary> /// <param name="toolString"></param> /// <param name="baseName"></param> /// <param name="regName"></param> /// <returns></returns> public string GenerateAssemblyCode(ToolString toolString, string baseName, string regName, bool multipDevInfTarget) { string resultCode = ""; if (bitNameTextBox.Text == "") { resultCode = "有内鬼,没有位域名字"; } if (highLowBitTextBox.Text == "") { resultCode = "有内鬼,没有设置高低位"; } if (setModeRadioButton.Checked && valueAndValueNameSet.Count == 0 && AnalysisSetModeValueNULL()) { resultCode = "有内鬼,有的模式值没文本"; } if (!AnalysisBitFiledName()) { resultCode = "有内鬼," + bitNameTextBox.Text; } else if (!AnalysisHighLowBit()) { resultCode = "有内鬼," + highLowBitTextBox.Text; } else if (setValueRadioButton.Checked && !AnalysisLocalScope()) { resultCode = "有内鬼," + localScopeTextBox.Text; } else if (setModeRadioButton.Checked && !AnalysisValueAndValueNameTable()) { resultCode = "有内鬼,有效值设置"; } else { if (multipDevInfTarget) { funcMould.SetBaseAddrName(baseName); funcMould.SetRegName(regName); resultCode += funcMould.GenerateAssemblyCode(toolString, defineSomeValueCheckBox.Checked, multipDevInfTarget); } else { funcMould.SetBaseAddrName(baseName); funcMould.SetRegName(regName); //resultCode += funcMould.GenerateAssemblyCode(toolString, defineSomeValueCheckBox.Checked, multipDevInfTarget); funcMould.GenerateAssemblyCode_Define(toolString, defineSomeValueCheckBox.Checked); } } return(resultCode); }
protected virtual string[][] getDefaultValues() { List <string[]> list = new List <string[]>(); string PARM = "MOB_DEFAULTVALS_" + getId(); string listStr = environment.getSysSettings().getString(PARM); // listStr = "INVOICE,READONLY,1;INVOICE,READONLY,1;xxxx,yyyy,1"; DataTable table = ToolString.explodeForTable(listStr, new string[] { TableDUMMY.TABLE, TableDUMMY.COLUMN, TableDUMMY.VALUE }); foreach (DataRow row in table.Rows) { list.Add(new string[] { row[TableDUMMY.TABLE].ToString(), row[TableDUMMY.COLUMN].ToString(), row[TableDUMMY.VALUE].ToString() }); } return(list.ToArray()); }
private void initRenders(string pLocation, ISettings sInfoFilters) { _reports = new List <IReport>(); _reportsNames = new List <string>(); string[][] repData = ToolString.explodeGroupList(sInfoFilters.getString(_varListRender)); foreach (string[] grp in repData) { if (grp.Length == 2) { _reportsNames.Add(_environment.translate(grp[0])); _reports.Add(new ImplXmlReport(Path.Combine(pLocation, grp[1]), _environment)); } } }
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); }
public static IReport createReport(IEnvironment pEnv, ISettings pSettings, string pName, IRowSource pRowSource) { string sqlNode = pSettings.getStringAttr(pName, attrSql); string repNode = pSettings.getStringAttr(pName, attrRep); if (sqlNode != string.Empty && repNode != string.Empty) { string sqlText = pSettings.getString(sqlNode); string sqlVars = pSettings.getStringAttr(sqlNode, attrVars); if (sqlVars == string.Empty) { sqlVars = ToolString.joinList(new string[] { "@lref", TableDUMMY.LOGICALREF }); } string sqlName = pSettings.getStringAttr(sqlNode, attrName); ISqlBuilder builder = new ImplSqlBuilder(pEnv, sqlText, sqlName); IDictionary <string, string> dic = ToolString.explodeForParameters(sqlVars); IEnumerator <string> enumer = dic.Keys.GetEnumerator(); enumer.Reset(); while (enumer.MoveNext()) { builder.addPereparer( new SqlBuilderPreparerObjectSourceFreePar( enumer.Current, new ImplObjectSourceRowCell(pRowSource, dic[enumer.Current]) ) ); } IPagedSource ps = new ImplPagedSource(pEnv, builder); string repObj = pSettings.getString(repNode); IReport xmlRep = new ImplXmlReport(repObj, pEnv); xmlRep.setDataSource(ps); return(xmlRep); } return(null); }
/// <summary> /// 报告数据导入数据库 /// </summary> /// <param name="dirPath"></param> /// <param name="formId"></param> /// <param name="reportId"></param> /// <returns></returns> public Result AddReportItem(string dirPath = "D:\\Shared\\弘阳报告", long formId = 8374570001, long reportId = 15581150001) { return(RunFun(logpath => { string path = "\\Survey\\ExportReports\\";// 根目录 // 获取表单GUID并拼接路径 string sqlStr = "SELECT * FROM AskForm_Form WHERE FormID = " + formId; DataTable dt = DbContent.GetTable(sqlStr); string companyId = ""; string appId = ""; if (dt.HasItems(c => c.Columns.Contains("FormGuid"))) { path += dt.Rows[0]["FormGuid"] + "\\" + reportId + "\\"; companyId = dt.Rows[0]["CompanyID"] + ""; appId = dt.Rows[0]["FormApplicationID"] + ""; } else { return Res; } // 获取文件夹下所有文件 if (Directory.Exists(dirPath)) { string[] pdfArr = Directory.GetFiles(dirPath); foreach (var pdf in pdfArr) { string fileName = ToolFile.GetFileName(pdf, false); string name = ToolFile.GetFileName(pdf); sqlStr = string.Format(@"INSERT AskForm_FormReportItem SELECT {0},{1},'{2}','','{3}',0,{4},{5},{6},0,GETDATE(),GETDATE()" , reportId, ToolString.GetRandomStr(12, 6), name, path + fileName, companyId, appId, formId); DbContent.ExecuteNonQuery(sqlStr); WriteLog(logpath, sqlStr); } } return Res; })); }
public virtual void set(string text) { try { if (!ToolMobile.existsDir(_dir)) { ToolMobile.createDir(_dir); } var indx = XmlFormating.helper.format(DateTime.Now); text = "[EVENT::" + indx + "]\n" + text + "\n"; string logFile = string.Format("LOG-{0}.txt", ToolString.left(indx, 10)); ToolMobile.appendFileText(_dir, logFile, text); } catch (Exception exc) { } }