⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 daltypeaddin.cs

📁 通过数据库结构自动 生成三层结构代码,相当不错的一款软件
💻 CS
字号:
namespace Codematic.UserControls
{
    using Maticsoft.AddInManager;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class DALTypeAddIn : UserControl
    {
        private string _guid;
        private string _name;
        private ComboBox cmbox_DALType;
        private IContainer components;
        private Label lblTip;
        private Label lblTitle;

        public DALTypeAddIn()
        {
            this._name = "";
            this._guid = "";
            this.InitializeComponent();
            DataSet addInList = new AddIn().GetAddInList();
            if (addInList != null)
            {
                int count = addInList.Tables[0].Rows.Count;
                if (count > 0)
                {
                    this.cmbox_DALType.DataSource = addInList.Tables[0].DefaultView;
                    this.cmbox_DALType.ValueMember = "Guid";
                    this.cmbox_DALType.DisplayMember = "Name";
                }
                if (count == 1)
                {
                    this._guid = addInList.Tables[0].Rows[0]["Guid"].ToString();
                    this._name = addInList.Tables[0].Rows[0]["Name"].ToString();
                }
            }
        }

        public DALTypeAddIn(string InterfaceName)
        {
            this._name = "";
            this._guid = "";
            this.InitializeComponent();
            DataSet addInList = new AddIn().GetAddInList(InterfaceName);
            if (addInList != null)
            {
                int count = addInList.Tables[0].Rows.Count;
                if (count > 0)
                {
                    this.cmbox_DALType.DataSource = addInList.Tables[0].DefaultView;
                    this.cmbox_DALType.ValueMember = "Guid";
                    this.cmbox_DALType.DisplayMember = "Name";
                }
                if (count == 1)
                {
                    this._guid = addInList.Tables[0].Rows[0]["Guid"].ToString();
                    this._name = addInList.Tables[0].Rows[0]["Name"].ToString();
                }
            }
        }

        private void cmbox_DALType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.cmbox_DALType.SelectedItem != null)
            {
                this._name = this.cmbox_DALType.Text;
                this._guid = this.cmbox_DALType.SelectedValue.ToString();
                if ((this._guid != "") && (this._guid != "System.Data.DataRowView"))
                {
                    AddIn @in = new AddIn(this._guid);
                    this.lblTip.Text = @in.Decription;
                }
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.cmbox_DALType = new ComboBox();
            this.lblTip = new Label();
            this.lblTitle = new Label();
            base.SuspendLayout();
            this.cmbox_DALType.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cmbox_DALType.FormattingEnabled = true;
            this.cmbox_DALType.Location = new Point(0x18, 0);
            this.cmbox_DALType.Name = "cmbox_DALType";
            this.cmbox_DALType.Size = new Size(0xba, 20);
            this.cmbox_DALType.TabIndex = 0;
            this.cmbox_DALType.SelectedIndexChanged += new EventHandler(this.cmbox_DALType_SelectedIndexChanged);
            this.lblTip.AutoSize = true;
            this.lblTip.Location = new Point(0xd6, 4);
            this.lblTip.Name = "lblTip";
            this.lblTip.Size = new Size(0x65, 12);
            this.lblTip.TabIndex = 1;
            this.lblTip.Text = "请先选择代码类型";
            this.lblTitle.AutoSize = true;
            this.lblTitle.Location = new Point(0, 4);
            this.lblTitle.Name = "lblTitle";
            this.lblTitle.Size = new Size(0x17, 12);
            this.lblTitle.TabIndex = 2;
            this.lblTitle.Text = "DAL";
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.lblTitle);
            base.Controls.Add(this.cmbox_DALType);
            base.Controls.Add(this.lblTip);
            this.Name = "DALTypeAddIn";
            base.Size = new Size(0x159, 0x16);
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        public void SetSelectedDALType(string appguid)
        {
            for (int i = 0; i < this.cmbox_DALType.Items.Count; i++)
            {
                DataRow row = (this.cmbox_DALType.Items[i] as DataRowView).Row;
                if (row[this.cmbox_DALType.ValueMember].ToString() == appguid)
                {
                    this.cmbox_DALType.SelectedIndex = i;
                    this._guid = appguid;
                    this._name = row[this.cmbox_DALType.DisplayMember].ToString();
                    AddIn @in = new AddIn(this._guid);
                    this.lblTip.Text = @in.Decription;
                    return;
                }
            }
        }

        public string AppGuid
        {
            get
            {
                return this._guid;
            }
            set
            {
                this._guid = value;
            }
        }

        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                this._name = value;
            }
        }

        public string Title
        {
            get
            {
                return this.lblTitle.Text;
            }
            set
            {
                this.lblTitle.Text = value;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -