Exemplo n.º 1
0
        //接受参数事件
        private void MidModule_EventSend(object sender, object data, object e)
        {
            if (sender != null)
            {
                Model.EventInfo einfo = e as Model.EventInfo;
                if (einfo.Title != "表单代码生成器")
                {
                    return;
                }
                Form fr = sender as Form;
                if (fr.Text == "对象资源管理器")
                {
                    dinfo = data as DbDataInfo;
                    string msg = "数据库:" + dinfo.DbName;
                    if (DbDataType.GetDbDataType(dinfo.NameType).ToString() != "数据库")
                    {
                        msg = msg + " " + DbDataType.GetDbDataType(dinfo.NameType).ToString() + ":" + dinfo.Name;

                        getdgv_left_Data(dinfo.Name);
                    }
                    lb_DbMessage.Text      = msg;
                    textEditorControl.Text = "";
                }
            }
        }
 //接受参数事件
 private void MidModule_EventSend(object sender, object data, object e)
 {
     if (sender != null)
     {
         Model.EventInfo einfo = e as Model.EventInfo;
         if (einfo.Title != "修改字段数据")
         {
             return;
         }
         Form fr = sender as Form;
         if (fr.Text == "对象资源管理器")
         {
             dinfo = data as DbDataInfo;
             DbDataTypeEnum ddt = DbDataType.GetDbDataType(dinfo.NameType);
             if (ddt != DbDataTypeEnum.表)
             {
                 MessageBox.Show("请选择表。");
                 return;
             }
             string msg = "数据库:" + dinfo.DbName;
             if (DbDataType.GetDbDataType(dinfo.NameType).ToString() != "数据库")
             {
                 msg = msg + " " + DbDataType.GetDbDataType(dinfo.NameType).ToString() + ":" + dinfo.Name;
             }
             lb_DbMessage.Text = msg;
             QueryData();
         }
     }
 }
Exemplo n.º 3
0
        private void tv_Db_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            try
            {
                tv_Db.SelectedNode = e.Node;
                DbDataInfo info = null;
                if (tv_Db.SelectedNode != null)
                {
                    string str1 = tv_Db.SelectedNode.Text;
                    info = tv_Db.SelectedNode.Tag as DbDataInfo;
                }

                //if ((sender as TreeView) != null)
                //{ tv_Db.SelectedNode = tv_Db.GetNodeAt(e.X, e.Y); }

                if (e.Button == MouseButtons.Right && info != null)
                {
                    Point p = PointToScreen(new Point(e.X + 10, e.Y + 35));
                    cms.Items.Clear();
                    DbDataTypeEnum dtype = DbDataType.GetDbDataType(info.NameType);
                    switch (dtype)
                    {
                    case DbDataTypeEnum.务器:
                        break;

                    case DbDataTypeEnum.数据库:
                        GetDbMenu(cms, info);
                        break;

                    case DbDataTypeEnum.表:
                        GetTableMenu(cms, info);
                        break;

                    case DbDataTypeEnum.视图:
                        GetViewMenu(cms, info);
                        break;

                    case DbDataTypeEnum.存储过程:
                        break;
                    }
                    cms.Show(p);
                }

                if (e.Button == MouseButtons.Left && info != null)
                {
                    Model.EventInfo einfo = new Model.EventInfo();
                    einfo.Title = "表单代码生成器";
                    Common.MidModule.SendData(this, info, einfo);//发送参数值
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 //接受参数事件
 private void MidModule_EventSend(object sender, object data, object e)
 {
     if (sender != null)
     {
         Model.EventInfo einfo = e as Model.EventInfo;
         if (einfo.Title != "表结构查询")
         {
             return;
         }
         Form fr = sender as Form;
         if (fr.Text == "对象资源管理器")
         {
             dinfo = data as DbDataInfo;
             string msg = "数据库:" + dinfo.DbName;
             if (DbDataType.GetDbDataType(dinfo.NameType).ToString() != "数据库")
             {
                 msg = msg + " " + DbDataType.GetDbDataType(dinfo.NameType).ToString() + ":" + dinfo.Name;
             }
             lb_DbMessage.Text        = msg;
             dataGridView1.DataSource = null;
         }
     }
 }
Exemplo n.º 5
0
        private void MenuClicked(object sender, EventArgs e)
        {
            dal = new DbLink();
            string            MenuName = (sender as ToolStripMenuItem).Text;
            ToolStripMenuItem tmi      = sender as ToolStripMenuItem;
            DbDataInfo        dinfo    = tmi.Tag as DbDataInfo;

            Model.EventInfo einfo = new Model.EventInfo();
            switch (MenuName)
            {
            case "连接":
                GetdbData(dinfo);
                break;

            case "断开":
                tv_Db.SelectedNode.Nodes.Clear();
                break;

            case "重连接":
                GetdbData(dinfo);
                break;

            case "注销":
                if (dal.DbLink_Del(dinfo.DbLinkID) == 1)
                {
                    tv_Db.Nodes.Remove(tv_Db.SelectedNode);
                }
                break;

            case "浏览表结构":
                if (FindDocument("表结构查询") == null)
                {
                    FormTableQuery sm = new FormTableQuery();
                    sm.Show(DockPanel);
                }
                else
                {
                    Form f = FindDocument("表结构查询") as Form;
                    f.Focus();
                }

                einfo.Title = "表结构查询";
                Common.MidModule.SendData(this, dinfo, einfo);    //发送参数值
                break;

            case "浏览视图结构":
                if (FindDocument("表结构查询") == null)
                {
                    FormTableQuery sm = new FormTableQuery();
                    sm.Show(DockPanel);
                }
                else
                {
                    Form f = FindDocument("表结构查询") as Form;
                    f.Focus();
                }

                einfo.Title = "表结构查询";
                Common.MidModule.SendData(this, dinfo, einfo);    //发送参数值
                break;

            case "导入数据":
                if (FindDocument("数据导入") == null)
                {
                    FormImportData sm = new FormImportData();
                    sm.Show(DockPanel);
                }
                else
                {
                    Form f = FindDocument("数据导入") as Form;
                    f.Focus();
                }

                einfo.Title = "数据导入";
                Common.MidModule.SendData(this, dinfo, einfo);    //发送参数值
                break;

            case "修改字段数据":
                if (FindDocument("修改字段数据") == null)
                {
                    FormFieldData sm = new FormFieldData();
                    sm.Show(DockPanel);
                }
                else
                {
                    Form f = FindDocument("修改字段数据") as Form;
                    f.Focus();
                }

                einfo.Title = "修改字段数据";
                Common.MidModule.SendData(this, dinfo, einfo);    //发送参数值
                break;

            case "表单代码生成器":
                if (FindDocument("表单代码生成器") == null)
                {
                    FormCreater sm = new FormCreater();
                    sm.Show(DockPanel);
                }
                else
                {
                    Form f = FindDocument("表单代码生成器") as Form;
                    f.Focus();
                }
                einfo.Title = "表单代码生成器";
                Common.MidModule.SendData(this, dinfo, einfo);    //发送参数值
                break;
            }
        }