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 void set(string text, object[] data)
 {
     try
     {
         set(_env.translate(text) + ":" + ToolString.joinList(ToolString.toString(data)));
     }
     catch (Exception exc)
     {
         ToolMobile.setRuntimeMsg(exc.ToString());
     }
 }
示例#3
0
        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);
        }
示例#4
0
 public void setListAttr(string name, string attr, string[] vals)
 {
     this.set(name, attr, ToolString.joinList(vals));
 }
示例#5
0
 public string[] getListAttr(string name, string attr, string[] def)
 {
     return(ToolString.explodeList(this.getStringAttr(name, attr, ToolString.joinList(def))));
 }
示例#6
0
 public string[] getList(string name, string[] def)
 {
     return(ToolString.explodeList(this.getString(name, ToolString.joinList(def))));
 }
示例#7
0
 public void setListAttrEnumer(string attr, string[] vals)
 {
     setEnumer(attr, ToolString.joinList(vals));
 }
示例#8
0
 public void setListEnumer(string[] vals)
 {
     setEnumer(ToolString.joinList(vals));
 }
示例#9
0
 public string[] getListAttrEnumer(string attr, string[] def)
 {
     return(ToolString.explodeList(getStringAttrEnumer(attr, ToolString.joinList(def))));
 }
示例#10
0
        public virtual void loadFilterStruct()
        {
            try
            {
                getGrid().beginDataLoad();

                if (!HasFilter)
                {
                    getFilterTreePanel().Visible = false;
                    getFilterGridPanel().Visible = false;
                }
                else
                {
                    getFilterTreePanel().Visible = false;
                    List <MobDataGrid> list = new List <MobDataGrid>();
                    {
                        if (FilterCols.Length > 0)
                        {
                            list.Add(getFilterGrid1());
                        }
                        if (FilterCols.Length > 1)
                        {
                            list.Add(getFilterGrid2());
                        }
                        else
                        {
                            getFilterGrid2().Visible = false;
                        }
                    }

                    filterWrap = new ImplFilterWrapGrid(list.ToArray());
                    //filterWrap = new ImplFilterWrapTree(getFilterTree());
                    filterWrap.FilterChanged += filterWrap_FilterChanged;
                    //getFilter().NodeClick += MobDataReferenceGridFormBase_NodeClick;

                    string stateNameFilterTree = globalStoreName() + "/filtertree";

                    object[][] tree_ = environment.getStateData(stateNameFilterTree) as object[][];

                    if (tree_ == null)
                    {
                        string           name_ = getDsName();
                        ITableDescriptor td_   = environment.getDbDescriptor().getTable(name_);
                        if (td_ == null)
                        {
                            throw new MyExceptionError("Cant find table [" + name_ + "] descriptor");
                        }

                        string tabFullName_ = td_.getNameFull();

                        string    sql_ = string.Format("SELECT DISTINCT {0} FROM {1}", ToolString.joinList(FilterCols), tabFullName_);
                        DataTable tab_ = SqlExecute.execute(environment, sql_, null);
                        tree_ = ToolTable.getGroups(tab_, FilterCols);
                    }

                    filterWrap.fill(tree_);
                    // getFilter().fillTree(tree_);


                    environment.setStateData(stateNameFilterTree, tree_);
                }
            }
            catch (Exception exc)
            {
                ToolMobile.setException(exc);
            }
            finally
            {
                getGrid().endDataLoad();
            }
        }