Пример #1
0
        private void btn_id_Click(object sender, EventArgs e)
        {
            PropertyKey pro = new PropertyKey();
            pro.Entity = dd_entity.SelectedItem.ToString();
            pro.Name = "Id";
            pro.Field = "id";
            pro.KeyType = "自增型";
            AddProperty(pro, "主键");

            ds.Tables["PropertyKey"].Rows.Add(pro.Entity, pro.Name, pro.Field, pro.KeyType);
            Bind();
        }
Пример #2
0
        private void btn_addAttr_Click(object sender, EventArgs e)
        {
            if (rbtn_1.Checked == true)
            {
                PropertyGeneral pro = new PropertyGeneral();
                pro.Entity = dd_entity.SelectedItem.ToString();
                pro.Name = tb_proName.Text;
                pro.Field = tb_proField.Text;
                pro.ProType = dd_1.SelectedItem.ToString();
                AddProperty(pro, "普通属性");

                ds.Tables["PropertyGeneral"].Rows.Add(pro.Entity, pro.Name, pro.Field, pro.ProType);

            }
            else if (rbtn_2.Checked == true)
            {
                PropertyKey pro = new PropertyKey();
                pro.Entity = dd_entity.SelectedItem.ToString();
                pro.Name = tb_proName.Text;
                pro.Field = tb_proField.Text;
                pro.KeyType = dd_2.SelectedItem.ToString();
                AddProperty(pro, "主键");

                ds.Tables["PropertyKey"].Rows.Add(pro.Entity, pro.Name, pro.Field, pro.KeyType);
            }
            else if (rbtn_3.Checked == true)
            {
                PropertyMoreToOne pro = new PropertyMoreToOne();
                pro.Entity = dd_entity.SelectedItem.ToString();
                pro.Name = tb_proName.Text;
                pro.Field = tb_proField.Text;
                pro.ProType = dd_3.SelectedItem.ToString();
                AddProperty(pro, "多对一");

                ds.Tables["PropertyMoreToOne"].Rows.Add(pro.Entity, pro.Name, pro.Field, pro.ProType);
            }
            else if (rbtn_4.Checked == true)
            {
                PropertyOneToMore pro = new PropertyOneToMore();
                pro.Entity = dd_entity.SelectedItem.ToString();
                pro.Name = tb_proName.Text;
                pro.Field = tb_proField.Text;
                pro.TableName = tb_4.Text;
                pro.KeyColoumName = tb_41.Text;
                pro.EntityName = tb_42.Text;
                pro.Cascade = chb_cascade.Checked;
                pro.Inverse = chb_inverse.Checked;
                AddProperty(pro, "一对多");
                ds.Tables["PropertyOneToMore"].Rows.Add(pro.Entity, pro.Name, pro.Field, pro.TableName, pro.KeyColoumName, pro.EntityName, pro.Cascade.ToString().ToLower(), pro.Inverse.ToString().ToLower());
            }
            Bind();
            tb_proName.Focus();
            tb_proName.SelectAll();
        }