private void btnYeniTransform_Click(object sender, EventArgs e)
        {
            if (this._convertedDataSet != null)
            {
                var service = new ConvertedDataSetService();
                //this._convertedDataSet.Transforms.Add();
                var tranName = "Transform ";
                var i = 1;
                while (this._convertedDataSet.Transforms.Any(x => x.Name == tranName + i.ToString()))
                    i++;
                tranName += i.ToString();
                var tran = new TransformModel
                    {
                        Name = tranName,
                        Operations = new List<OperationModel>(),
                        Filters = new List<FilterModel>()
                    };
                service.createTransform(this._convertedDataSet.ID, tran);

                reloadTree();

            }
        }
Exemple #2
0
        public void ReloadTree()
        {
            running = true;

            List<int> nodeIndexList = null;
            if (tree.SelectedNode != null)
            {
                nodeIndexList = new List<int>();
                var node = tree.SelectedNode;
                while (node != null)
                {
                    nodeIndexList.Add(node.Index);
                    node = node.Parent;
                }
            }

            var service = new StorMan.Business.ConvertedDataSetService();
            this.cdsList = service.getConvertedDataSets(true);

            tree.Nodes.Clear();
            bodyPanel.Controls.Clear();

            foreach (var cds in cdsList)
            {
                var root = tree.Nodes.Add(cds.Name);
                root.Tag = cds;
                foreach (var tran in cds.Transforms)
                {
                    var tranNode = root.Nodes.Add(tran.Name);
                    tranNode.Tag = new Tuple<TransformModel>(tran);
                    //foreach (var filter in tran.Filters)
                    //{
                    //    var node = tranNode.Nodes.Add(filter.ToString());
                    //    node.Tag = filter;
                    //}
                    var node = tranNode.Nodes.Add("Filtreler");
                    node.Tag = tran.Filters.Select(x => x).ToList();

                    //foreach (var op in tran.Operations)
                    //{
                    //    node = tranNode.Nodes.Add(op.ToString());
                    //    node.Tag = op;
                    //}
                    node = tranNode.Nodes.Add("Operasyonlar");
                    node.Tag = tran;
                }
            }
            tree.ExpandAll();
            running = false;

            if (nodeIndexList != null && nodeIndexList.Count > 0)
            {
                TreeNode node = null;
                var index = -1;
                for (var i = nodeIndexList.Count - 1; i >= 0; i--)
                {
                    index = nodeIndexList[i];
                    if (index < 0)
                        break;
                    if (node != null && node.Nodes.Count <= index)
                        break;
                    var nodeColl = (node == null ? tree.Nodes : node.Nodes);
                    node = nodeColl.Count > index ? nodeColl[index] : (nodeColl.Count > 0 ? nodeColl[nodeColl.Count - 1] : null);
                }

                if (node != null)
                    tree.SelectedNode = node;
            }

            if (tree.Nodes.Count > 0)
                tree_NodeMouseClick(tree, new TreeNodeMouseClickEventArgs(tree.Nodes[0], MouseButtons.Left, 1, 0, 0));
        }
Exemple #3
0
        private void btnVeriKaynaginiSil_Click(object sender, EventArgs e)
        {
            if (bodyPanel.Controls.Count == 0)
                return;

            var service = new ConvertedDataSetService();
            if (bodyPanel.Controls[0] is ConvertedDataSetViewPanel)
            {
                var panel = bodyPanel.Controls[0] as ConvertedDataSetViewPanel;
                var cds = panel.ConvertedDataSet;
                if (cds == null)
                    return;

                if (MessageBox.Show(String.Format("Bu veri kaynağı ({0})ve tüm bağlı dönüşümler silinecek, devam etmek istiyor musunuz?", cds.Name), "", MessageBoxButtons.YesNo,
                                MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    try
                    {
                        service.deleteConvertedDataSet(cds.ID);

                        ReloadTree();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Hata: " + ex.ToString());
                    }
                }
            }
            else if (bodyPanel.Controls[0] is TransformViewPanel)
            {
                var panel = bodyPanel.Controls[0] as TransformViewPanel;
                var tran = panel.Transform;
                if (tran == null)
                    return;

                if (MessageBox.Show(String.Format("Bu dönüşüm ({0}) tüm bağlı filtre ve operasyonlar silinecek, devam etmek istiyor musunuz?", tran.Name), "", MessageBoxButtons.YesNo,
                                MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    try
                    {
                        service.deleteTransform(tran.ID);
                        ReloadTree();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Hata: " + ex.ToString());
                    }
                }
            }
        }
Exemple #4
0
        private void btnYeniVeriKaynagi_Click(object sender, EventArgs e)
        {
            var service = new ConvertedDataSetService();
            service.createConvertedDataSet("Yeni Veri Kaynağı", "http://");

            ReloadTree();
        }
Exemple #5
0
        private void btnDbKaydet_Click(object sender, EventArgs e)
        {
            if (bodyPanel.Controls.Count == 0)
                return;

            var service = new ConvertedDataSetService();
            if (bodyPanel.Controls[0] is FilterViewPanel)
            {
                try
                {
                    var panel = bodyPanel.Controls[0] as FilterViewPanel;
                    var transform = this.CurrentTransform;
                    if (transform == null)
                        return;

                    transform.Filters = panel.FilterList;
                    service.updateTransform(transform);

                    ReloadTree();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Hata: " + ex.ToString());
                }
            }
            else if (bodyPanel.Controls[0] is TransformViewPanel)
            {
                try
                {
                    var panel = bodyPanel.Controls[0] as TransformViewPanel;
                    var transform = panel.Transform;
                    if (transform == null)
                        return;

                    service.updateTransform(transform);

                    ReloadTree();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Hata: " + ex.ToString());
                }
            }
            else if (bodyPanel.Controls[0] is ConvertedDataSetViewPanel)
            {
                try
                {
                    var panel = bodyPanel.Controls[0] as ConvertedDataSetViewPanel;

                    service.updateConvertedDataSet(panel.ConvertedDataSet.ID, panel.ConvertedDataSet.Name, panel.ConvertedDataSet.SourceXmlPath);

                    ReloadTree();
                }
                catch (Exception)
                {

                    throw;
                }
            }
        }