bool SavePage1()
        {
            string sName = txtName.Text.Trim();

            if (!sName.Equals(m_View.Name))
            {
                CView view2 = Program.Ctx.ViewMgr.FindByName(sName);
                if (view2 != null)
                {
                    MessageBox.Show("名称重复!");
                    txtName.Focus();
                    return(false);
                }
            }
            m_View.Name = sName;
            if (cbCatalog.SelectedIndex > 0)
            {
                DataItem     item    = (DataItem)cbCatalog.SelectedItem;
                CViewCatalog catalog = (CViewCatalog)item.Data;
                m_View.UI_ViewCatalog_id = catalog.Id;
            }
            else
            {
                m_View.UI_ViewCatalog_id = Guid.Empty;
            }
            DataItem itemP  = (DataItem)cbMasterTable.SelectedItem;
            CTable   tableP = (CTable)itemP.Data;

            m_View.FW_Table_id = tableP.Id;


            return(true);
        }
    //获取视图目录
    void GetViewCatalog()
    {
        string pid       = Request["pid"];
        Guid   Parent_id = Guid.Empty;

        if (!string.IsNullOrEmpty(pid))
        {
            Parent_id = new Guid(pid);
        }
        //context.Response.Write(@"[{text: 'Report'}]");
        string             sJson          = "[";
        List <CBaseObject> lstViewCatalog = Global.GetCtx(Session["TopCompany"].ToString()).ViewCatalogMgr.GetList();

        foreach (CBaseObject obj in lstViewCatalog)
        {
            CViewCatalog catalog = (CViewCatalog)obj;
            if (catalog.Parent_id == Parent_id)
            {
                string sItem = string.Format("{{ isexpand: \"false\", name: \"nodeViewCatalog\",\"id\":\"{0}\",\"text\": \"{1}\",\"url\": \"View/ViewPanel.aspx?catalog_id={0}\", children: [] }},",
                                             catalog.Id,
                                             catalog.Name);
                sJson += sItem;
            }
        }
        sJson  = sJson.TrimEnd(",".ToCharArray());
        sJson += "]";
        Response.Write(sJson);
    }
Beispiel #3
0
        private void MenuItemDelViewCatalog_Click(object sender, EventArgs e)
        {
            if (treeLeft.SelectedNode == null)
            {
                return;
            }
            string sMsg = string.Format("确认删除 {0} ?", treeLeft.SelectedNode.Text);

            if (MessageBox.Show(sMsg, "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            TreeNodeTag tag = (TreeNodeTag)treeLeft.SelectedNode.Tag;

            if (tag.NodeType != TreeNodeType.ViewCatalog)
            {
                return;
            }
            CViewCatalog catalog = (CViewCatalog)tag.Data;

            catalog.m_ObjectMgr.Delete(catalog);
            if (!catalog.m_ObjectMgr.Save(true))
            {
                MessageBox.Show("删除目录失败!");
                return;
            }

            treeLeft.SelectedNode.Parent.Nodes.Remove(treeLeft.SelectedNode);
        }
Beispiel #4
0
        //新建视图菜单
        private void MenuItemNewViewCatalog_Click(object sender, EventArgs e)
        {
            if (treeLeft.SelectedNode == null)
            {
                return;
            }

            string sVal = "";

_ReTry:
            InputForm frm = new InputForm();

            frm.lbTitle.Text = "请输入目录名称:";
            frm.txtVal.Text  = sVal;
            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            sVal = frm.txtVal.Text.Trim();
            if (sVal == "")
            {
                MessageBox.Show("名称不能空!");
                goto _ReTry;
            }
            if (Program.Ctx.ViewCatalogMgr.FindByName(sVal) != null)
            {
                MessageBox.Show("目录已经存在!");
                goto _ReTry;
            }
            CViewCatalog catalog = new CViewCatalog();

            catalog.Ctx  = Program.Ctx;
            catalog.Name = sVal;
            Program.Ctx.ViewCatalogMgr.AddNew(catalog);
            if (!Program.Ctx.ViewCatalogMgr.Save(true))
            {
                MessageBox.Show("添加目录失败!");
                return;
            }

            TreeNode node = new TreeNode();

            node.Text               = catalog.Name;
            node.ImageIndex         = 10;
            node.SelectedImageIndex = 10;
            TreeNodeTag tag = new TreeNodeTag();

            tag.NodeType = TreeNodeType.ViewCatalog;
            tag.Data     = catalog;
            node.Tag     = tag;

            treeLeft.SelectedNode.Nodes.Add(node);
        }
Beispiel #5
0
        private void MenuItemEditViewCatalog_Click(object sender, EventArgs e)
        {
            if (treeLeft.SelectedNode == null)
            {
                return;
            }
            TreeNodeTag tag = (TreeNodeTag)treeLeft.SelectedNode.Tag;

            if (tag.NodeType != TreeNodeType.ViewCatalog)
            {
                return;
            }
            CViewCatalog catalog = (CViewCatalog)tag.Data;

            string sVal = catalog.Name;

_ReTry:
            InputForm frm = new InputForm();

            frm.lbTitle.Text = "请输入目录名称:";
            frm.txtVal.Text  = sVal;
            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            sVal = frm.txtVal.Text.Trim();
            if (sVal == catalog.Name)
            {
                return;
            }
            if (sVal == "")
            {
                MessageBox.Show("名称不能空!");
                goto _ReTry;
            }
            if (Program.Ctx.ViewCatalogMgr.FindByName(sVal) != null)
            {
                MessageBox.Show("目录已经存在!");
                goto _ReTry;
            }

            catalog.Name = sVal;
            Program.Ctx.ViewCatalogMgr.Update(catalog);
            if (!Program.Ctx.ViewCatalogMgr.Save(true))
            {
                MessageBox.Show("修改目录失败!");
                return;
            }


            treeLeft.SelectedNode.Text = sVal;
        }
Beispiel #6
0
    bool SavePage1()
    {
        string sName = txtName.Text.Trim();

        if (!sName.Equals(m_View.Name))
        {
            CView view2 = Global.GetCtx(Session["TopCompany"].ToString()).ViewMgr.FindByName(sName);
            if (view2 != null)
            {
                RegisterStartupScript("starup", "<script>alert('名称重复!');</script>");
                txtName.Focus();
                return(false);
            }
        }
        m_View.Name = sName;
        if (cbCatalog.SelectedIndex > 0)
        {
            string       catalog_id = cbCatalog.SelectedItem.Value;
            CViewCatalog catalog    = (CViewCatalog)Global.GetCtx(Session["TopCompany"].ToString()).ViewCatalogMgr.Find(new Guid(catalog_id));
            m_View.UI_ViewCatalog_id = catalog.Id;
        }
        else
        {
            m_View.UI_ViewCatalog_id = Guid.Empty;
        }
        //如果是修改,并修改了主表,则清空旧字段
        Guid guidMT = new Guid(cbMasterTable.SelectedItem.Value);

        if (!m_bIsNew && guidMT != m_View.FW_Table_id)
        {
            m_View.ColumnInViewMgr.RemoveAll();
        }
        m_View.FW_Table_id = guidMT;
        CViewDetail ViewDetail = (CViewDetail)m_View.ViewDetailMgr.GetFirstObj();
        //如果是修改,并修改了从表,则清空旧字段
        Guid guidDT = new Guid(cbDetailTable.SelectedItem.Value);

        if (!m_bIsNew && guidDT != ViewDetail.FW_Table_id)
        {
            ViewDetail.ColumnInViewDetailMgr.RemoveAll();
        }
        ViewDetail.FW_Table_id = guidDT;
        ViewDetail.PrimaryKey  = new Guid(cbPrimaryKey.SelectedItem.Value);
        ViewDetail.ForeignKey  = new Guid(cbForeignKey.SelectedItem.Value);

        m_View.ViewDetailMgr.Update(ViewDetail);

        return(true);
    }
Beispiel #7
0
        bool SavePage1()
        {
            string sName = txtName.Text.Trim();

            if (!sName.Equals(m_View.Name))
            {
                CView view2 = Program.Ctx.ViewMgr.FindByName(sName);
                if (view2 != null)
                {
                    MessageBox.Show("名称重复!");
                    txtName.Focus();
                    return(false);
                }
            }
            m_View.Name = sName;
            if (cbCatalog.SelectedIndex > 0)
            {
                DataItem     item    = (DataItem)cbCatalog.SelectedItem;
                CViewCatalog catalog = (CViewCatalog)item.Data;
                m_View.UI_ViewCatalog_id = catalog.Id;
            }
            else
            {
                m_View.UI_ViewCatalog_id = Guid.Empty;
            }
            DataItem itemP  = (DataItem)cbMasterTable.SelectedItem;
            CTable   tableP = (CTable)itemP.Data;

            m_View.FW_Table_id = tableP.Id;
            DataItem    itemF      = (DataItem)cbDetailTable.SelectedItem;
            CTable      tableF     = (CTable)itemF.Data;
            CViewDetail ViewDetail = (CViewDetail)m_View.ViewDetailMgr.GetFirstObj();

            ViewDetail.FW_Table_id = tableF.Id;
            DataItem itemPK   = (DataItem)cbPrimaryKey.SelectedItem;
            CColumn  columnPK = (CColumn)itemPK.Data;

            ViewDetail.PrimaryKey = columnPK.Id;
            DataItem itemFK   = (DataItem)cbForeignKey.SelectedItem;
            CColumn  columnFK = (CColumn)itemFK.Data;

            ViewDetail.ForeignKey = columnFK.Id;

            m_View.ViewDetailMgr.Update(ViewDetail);

            return(true);
        }
        void LoadCatalog()
        {
            cbCatalog.Items.Clear();
            cbCatalog.Items.Add("");
            int iDefaultIdx           = 0;
            List <CBaseObject> lstObj = Program.Ctx.ViewCatalogMgr.GetList();

            foreach (CBaseObject obj in lstObj)
            {
                CViewCatalog catalog = (CViewCatalog)obj;
                DataItem     item    = new DataItem(catalog.Name, catalog);
                int          idx     = cbCatalog.Items.Add(item);
                if (catalog.Id == m_Catalog_id)
                {
                    iDefaultIdx = idx;
                }
            }
            cbCatalog.SelectedIndex = iDefaultIdx;
        }
Beispiel #9
0
    void LoadCatalog()
    {
        cbCatalog.Items.Clear();
        cbCatalog.Items.Add("");
        int iDefaultIdx           = 0;
        List <CBaseObject> lstObj = Global.GetCtx(Session["TopCompany"].ToString()).ViewCatalogMgr.GetList();

        foreach (CBaseObject obj in lstObj)
        {
            CViewCatalog catalog = (CViewCatalog)obj;
            ListItem     item    = new ListItem(catalog.Name, catalog.Id.ToString());
            cbCatalog.Items.Add(item);
            if (catalog.Id == m_Catalog_id)
            {
                iDefaultIdx = cbCatalog.Items.Count - 1;
            }
        }
        cbCatalog.SelectedIndex = iDefaultIdx;
    }
    bool SavePage1()
    {
        string sName = txtName.Text.Trim();

        if (!sName.Equals(m_View.Name))
        {
            CView view2 = Global.GetCtx(Session["TopCompany"].ToString()).ViewMgr.FindByName(sName);
            if (view2 != null)
            {
                RegisterStartupScript("starup", "<script>alert('名称重复!');</script>");
                txtName.Focus();
                return(false);
            }
        }
        m_View.Name = sName;
        if (cbCatalog.SelectedIndex > 0)
        {
            string       catalog_id = cbCatalog.SelectedItem.Value;
            CViewCatalog catalog    = (CViewCatalog)Global.GetCtx(Session["TopCompany"].ToString()).ViewCatalogMgr.Find(new Guid(catalog_id));
            m_View.UI_ViewCatalog_id = catalog.Id;
        }
        else
        {
            m_View.UI_ViewCatalog_id = Guid.Empty;
        }
        //如果是修改,并修改了主表,则清空旧字段
        Guid guidMT = new Guid(cbMasterTable.SelectedItem.Value);

        if (!m_bIsNew && guidMT != m_View.FW_Table_id)
        {
            m_View.ColumnInViewMgr.RemoveAll();
        }
        m_View.FW_Table_id = guidMT;
        for (int i = 0; i < listViewDetail.Items.Count; i++)
        {
            CViewDetail vd = (CViewDetail)m_View.ViewDetailMgr.Find(new Guid(listViewDetail.Items[i].Value));
            vd.Idx = i;
            m_View.ViewDetailMgr.Update(vd);
        }


        return(true);
    }
Beispiel #11
0
    //获取视图目录名
    void GetViewCatalogName()
    {
        string id   = Request["id"];
        Guid   guid = Guid.Empty;

        if (!string.IsNullOrEmpty(id))
        {
            guid = new Guid(id);
        }
        else
        {
            return;
        }

        CViewCatalog catalog = (CViewCatalog)Global.GetCtx(Session["TopCompany"].ToString()).ViewCatalogMgr.Find(guid);

        if (catalog != null)
        {
            Response.Write(catalog.Name);
        }
    }
Beispiel #12
0
        void LoopLoadViewCatalog(Guid Parent_id, TreeNode pNode)
        {
            List <CBaseObject> lstViewCatalog = Program.Ctx.ViewCatalogMgr.GetList();

            foreach (CBaseObject obj in lstViewCatalog)
            {
                CViewCatalog catalog = (CViewCatalog)obj;
                if (catalog.Parent_id == Parent_id)
                {
                    TreeNode node = new TreeNode();
                    node.Text               = catalog.Name;
                    node.ImageIndex         = 10;
                    node.SelectedImageIndex = 10;
                    TreeNodeTag tag = new TreeNodeTag();
                    tag.NodeType = TreeNodeType.ViewCatalog;
                    tag.Data     = catalog;
                    node.Tag     = tag;

                    pNode.Nodes.Add(node);

                    LoopLoadViewCatalog(catalog.Id, node);
                }
            }
        }
Beispiel #13
0
        private void treeLeft_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNodeTag tag = (TreeNodeTag)e.Node.Tag;

            if (tag == null)
            {
                return;
            }

            if (tag.NodeType == TreeNodeType.TableRoot)
            {
                tablePanel.Dock    = DockStyle.Fill;
                tablePanel.Visible = true;
                tablePanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.DiagramRoot)
            {
                diagramPanel.Dock    = DockStyle.Fill;
                diagramPanel.Visible = true;
                diagramPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.UserRoot)
            {
                TreeNodeTag ptag    = (TreeNodeTag)e.Node.Parent.Tag;
                CCompany    Company = (CCompany)ptag.Data;
                userPanel.Company = Company;
                userPanel.Dock    = DockStyle.Fill;
                userPanel.Visible = true;
                userPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.OrgRoot)
            {
                TreeNodeTag ptag    = (TreeNodeTag)e.Node.Parent.Tag;
                CCompany    Company = (CCompany)ptag.Data;
                orgPanel.Company = Company;
                orgPanel.Dock    = DockStyle.Fill;
                orgPanel.Visible = true;
                orgPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.RoleRoot)
            {
                TreeNodeTag ptag    = (TreeNodeTag)e.Node.Parent.Tag;
                CCompany    Company = (CCompany)ptag.Data;
                rolePanel.Company = Company;
                rolePanel.Dock    = DockStyle.Fill;
                rolePanel.Visible = true;
                rolePanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.AccessRoot)
            {
                TreeNodeTag ptag    = (TreeNodeTag)e.Node.Parent.Tag;
                CCompany    Company = (CCompany)ptag.Data;
                accessPanel.Company = Company;
                accessPanel.Dock    = DockStyle.Fill;
                accessPanel.Visible = true;
                accessPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.WindowCatalogRoot)
            {
                windowPanel.Catalog = null;
                windowPanel.Dock    = DockStyle.Fill;
                windowPanel.Visible = true;
                windowPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.WindowCatalog)
            {
                CWindowCatalog catalog = (CWindowCatalog)tag.Data;
                windowPanel.Catalog = catalog;
                windowPanel.Dock    = DockStyle.Fill;
                windowPanel.Visible = true;
                windowPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.ViewCatalogRoot)
            {
                viewPanel.Catalog = null;
                viewPanel.Dock    = DockStyle.Fill;
                viewPanel.Visible = true;
                viewPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.ViewCatalog)
            {
                CViewCatalog catalog = (CViewCatalog)tag.Data;
                viewPanel.Catalog = catalog;
                viewPanel.Dock    = DockStyle.Fill;
                viewPanel.Visible = true;
                viewPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.FormCatalogRoot)
            {
                formPanel.Catalog = null;
                formPanel.Dock    = DockStyle.Fill;
                formPanel.Visible = true;
                formPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.FormCatalog)
            {
                CFormCatalog catalog = (CFormCatalog)tag.Data;
                formPanel.Catalog = catalog;
                formPanel.Dock    = DockStyle.Fill;
                formPanel.Visible = true;
                formPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.SubSystemRoot)
            {
                subSystemPanel.Dock    = DockStyle.Fill;
                subSystemPanel.Visible = true;
                subSystemPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.SubDiagram)
            {
                TreeNode    pNode  = e.Node.Parent;
                TreeNodeTag tagP   = (TreeNodeTag)pNode.Tag;
                CSystem     system = (CSystem)tagP.Data;
                if (system.FW_Diagram_id == Guid.Empty)
                {
                    SelDiagramForm frm = new SelDiagramForm();
                    if (frm.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    system.FW_Diagram_id = frm.m_SelDiagram.Id;
                    if (!Program.Ctx.SystemMgr.Update(system))
                    {
                        MessageBox.Show("修改失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    DesignerForm frm2 = new DesignerForm();
                    frm2.m_Diagram = frm.m_SelDiagram;
                    frm2.Show(this);
                }
                else
                {
                    CDiagram diagram = (CDiagram)Program.Ctx.DiagramMgr.Find(system.FW_Diagram_id);
                    if (diagram == null)
                    {
                        SelDiagramForm frm = new SelDiagramForm();
                        if (frm.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        system.FW_Diagram_id = frm.m_SelDiagram.Id;
                        if (!Program.Ctx.SystemMgr.Update(system))
                        {
                            MessageBox.Show("修改失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        DesignerForm frm2 = new DesignerForm();
                        frm2.m_Diagram = frm.m_SelDiagram;
                        frm2.Show(this);
                    }
                    else
                    {
                        DesignerForm frm2 = new DesignerForm();
                        frm2.m_Diagram = diagram;
                        frm2.Show(this);
                    }
                }
            }
            else if (tag.NodeType == TreeNodeType.WindowCatalog)
            {
            }
            else if (tag.NodeType == TreeNodeType.ReportCompany)
            {
                TreeNodeTag ptag    = (TreeNodeTag)e.Node.Tag;
                CCompany    Company = (CCompany)ptag.Data;
                reportPanel.Company = Company;
                reportPanel.Catalog = null;
                reportPanel.Dock    = DockStyle.Fill;
                reportPanel.Visible = true;
                reportPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.ReportCatalog)
            {
                CCompany Company = null;
                TreeNode p       = e.Node.Parent;
                while (p != null)
                {
                    TreeNodeTag ptag = (TreeNodeTag)p.Tag;
                    if (ptag.NodeType == TreeNodeType.ReportCompany)
                    {
                        Company = (CCompany)ptag.Data;
                        break;
                    }
                    p = p.Parent;
                }
                reportPanel.Company = Company;
                CReportCatalog catalog = (CReportCatalog)tag.Data;
                reportPanel.Catalog = catalog;
                reportPanel.Dock    = DockStyle.Fill;
                reportPanel.Visible = true;
                reportPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.WorkflowCompany)
            {
                TreeNodeTag ptag    = (TreeNodeTag)e.Node.Tag;
                CCompany    Company = (CCompany)ptag.Data;
                workflowDefPanel.Company = Company;
                workflowDefPanel.Catalog = null;
                workflowDefPanel.Dock    = DockStyle.Fill;
                workflowDefPanel.Visible = true;
                workflowDefPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.WorkflowCatalog)
            {
                CCompany Company = null;
                TreeNode p       = e.Node.Parent;
                while (p != null)
                {
                    TreeNodeTag ptag = (TreeNodeTag)p.Tag;
                    if (ptag.NodeType == TreeNodeType.WorkflowCompany)
                    {
                        Company = (CCompany)ptag.Data;
                        break;
                    }
                    p = p.Parent;
                }
                workflowDefPanel.Company = Company;
                CWorkflowCatalog catalog = (CWorkflowCatalog)tag.Data;
                workflowDefPanel.Catalog = catalog;
                workflowDefPanel.Dock    = DockStyle.Fill;
                workflowDefPanel.Visible = true;
                workflowDefPanel.BringToFront();
            }
            else if (tag.NodeType == TreeNodeType.MenuRoot)
            {
                menuPanel.Dock    = DockStyle.Fill;
                menuPanel.Visible = true;
                menuPanel.BringToFront();
            }
        }
Beispiel #14
0
        private void btOk_Click(object sender, EventArgs e)
        {
            string sName = txtName.Text.Trim();

            if (sName == "")
            {
                MessageBox.Show("名称不能空!");
                txtName.Focus();
                return;
            }
            if (!sName.Equals(m_View.Name))
            {
                CView view2 = Program.Ctx.ViewMgr.FindByName(sName);
                if (view2 != null)
                {
                    MessageBox.Show("名称重复!");
                    txtName.Focus();
                    return;
                }
            }
            if (listColumn.Items.Count == 0)
            {
                MessageBox.Show("请选择字段!");
                return;
            }

            m_View.Name = sName;
            if (cbCatalog.SelectedIndex < 1)
            {
                m_View.UI_ViewCatalog_id = Guid.Empty;
            }
            else
            {
                DataItem     item    = (DataItem)cbCatalog.SelectedItem;
                CViewCatalog catalog = (CViewCatalog)item.Data;
                m_View.UI_ViewCatalog_id = catalog.Id;
            }
            m_View.FW_Table_id = m_MainTb_id;

            foreach (DataGridViewRow row in dataGridView.Rows)
            {
                CColumnInView civ = (CColumnInView)row.Tag;
                civ.Caption = row.Cells[1].Value.ToString();
            }

            if (m_bIsNew)
            {
                Program.Ctx.ViewMgr.AddNew(m_View);
            }
            else
            {
                Program.Ctx.ViewMgr.Update(m_View);
            }

            if (!Program.Ctx.ViewMgr.Save(true))
            {
                MessageBox.Show("保存失败!");
                return;
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }