Beispiel #1
0
        public override void Save()
        {
            //Save task to main config
            this._xmlDoc = new XmlDocument();
            this._xmlDoc.Load(ReportConfig.ConfigLocations["ReportConfig"]);
            XmlNode rootNode = this.GetItemRootNode();

            //Clear all the children nodes
            rootNode.RemoveAll();
            this.RecreateItemXmlNodesForMainConfig(rootNode);
            this._xmlDoc.Save(ReportConfig.ConfigLocations["ReportConfig"]);

            foreach (var item in ReportConfig.ConfigLocations.Keys)
            {
                if (item != "ReportConfig")
                {
                    this._xmlDoc = new XmlDocument();
                    this._xmlDoc.Load(ReportConfig.ConfigLocations[item]);
                    XmlNode rootNode1 = this.GetItemRootNode();
                    //Clear all the children nodes
                    rootNode1.RemoveAll();
                    var itemCollection = new ReportItemDictionary <ReportTask>();
                    itemCollection.Add(item, this.ItemCollection[item]);
                    this.RecreateItemXmlNodes(rootNode1, itemCollection);
                    this._xmlDoc.Save(ReportConfig.ConfigLocations[item]);
                }
            }
        }
Beispiel #2
0
        public ReportItemDictionary <QVField> GetCurrentSelection()
        {
            ReportItemDictionary <QVField> qc = new ReportItemDictionary <QVField>();
            var selections = this._doc.GetCurrentSelections();

            for (int i = 0; i < selections.Selections.Length; i++)
            {
                string fieldName = selections.VarId[i];
                var    field     = this._doc.Fields(fieldName);

                QlikView.Common.QVField qvField = new QlikView.Common.QVField();
                qvField.Name = field.Name();
                var values = field.GetSelectedValues();
                for (int j = 0; j < values.Count; j++)
                {
                    qvField.Values.Add(new QlikView.Common.FieldValue()
                    {
                        Value     = values[j].Text,
                        IsNumeric = values[j].IsNumeric,
                        Number    = values[j].Number
                    });
                }

                qc.Add(qvField.Name, qvField);
            }

            return(qc);
        }
Beispiel #3
0
        private ReportItemDictionary <QlikViewReport> GetReportsByTask(string task)
        {
            ReportItemDictionary <QlikViewReport> itemCollection = new ReportItemDictionary <QlikViewReport>();

            foreach (var item in this.ItemCollection)
            {
                if (item.Value.Parents.ContainsKey(task))
                {
                    itemCollection.Add(item);
                }
                else if (item.Value.Parents.Count == 0 && task == "ReportConfig")
                {
                    itemCollection.Add(item);
                }
            }

            return(itemCollection);
        }
Beispiel #4
0
        private ReportItemDictionary <Filter> GetFiltersByTask(string task)
        {
            ReportItemDictionary <Filter> itemCollection = new ReportItemDictionary <Filter>();

            foreach (var item in this.ItemCollection)
            {
                if (item.Value.Parents.Count > 0 && item.Value.Parents.Where(x => x.Value.Parents.ContainsKey(task)).Count() > 0)
                {
                    itemCollection.Add(item);
                }
                //if the filter has no parents or all the parents have no perants, save to the main config
                else if ((item.Value.Parents.Count == 0 || (item.Value.Parents.Count > 0 && item.Value.Parents.Where(x => x.Value.Parents.Count > 0).Count() == 0)) &&
                         task == "ReportConfig")
                {
                    itemCollection.Add(item);
                }
            }

            return(itemCollection);
        }
Beispiel #5
0
        private void FilterView_Load(object sender, EventArgs e)
        {
            this.comboBoxConnection.DataSource = ReportConfig.ConnectionManager.ItemCollection.Select(x => x.Key).ToList();

            if (string.IsNullOrEmpty(this.Item.Name))
            {
                this.btnAdd.Visible    = true;
                this.btnUpdate.Visible = false;

                if (ReportConfig.ConnectionManager.ItemCollection.Count == 0)
                {
                    this.btnAdd.Enabled = false;
                }
            }
            else
            {
                this.txtName.Enabled   = false;
                this.btnAdd.Visible    = false;
                this.btnUpdate.Visible = true;

                this.txtName.Text = this.Item.Name;
                this.txtDesc.Text = this.Item.Description;

                this.comboBoxConnection.SelectedItem = this.Item.Connection.Name;

                foreach (var item in this.Item.Fields)
                {
                    FieldCollection.Add(item.Key, item.Value);
                }

                foreach (var item in this.Item.Variables)
                {
                    VariableCollection.Add(item.Key, item.Value);
                }

                this.RefreshFieldDataGrid();
                this.RefreshVariableDataGrid();
            }
        }
        public ReportItemDictionary<QVField> GetCurrentSelection()
        {
            ReportItemDictionary<QVField> qc = new ReportItemDictionary<QVField>();
            var selections = this._doc.GetCurrentSelections();
            for (int i = 0; i < selections.Selections.Length; i++)
            {
                string fieldName = selections.VarId[i];
                var field = this._doc.Fields(fieldName);

                QlikView.Common.QVField qvField = new QlikView.Common.QVField();
                qvField.Name = field.Name();
                var values = field.GetSelectedValues();
                for (int j = 0; j < values.Count; j++)
                {
                    qvField.Values.Add(new QlikView.Common.FieldValue()
                    {
                        Value = values[j].Text,
                        IsNumeric = values[j].IsNumeric,
                        Number = values[j].Number
                    });
                }

                qc.Add(qvField.Name, qvField);
            }

            return qc;
        }