Exemple #1
0
        private Model.ConfigNameSpaceClass GetModel()
        {
            string model      = this.textBox_model.Text;
            string data       = this.textBox_data.Text;
            string business   = this.textBox_business.Text;
            string interface1 = this.textBox_interface.Text;
            string factory    = this.textBox_factory.Text;

            if (model.IsNullOrEmpty())
            {
                MessageBox.Show("实体层命名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(null);
            }
            if (data.IsNullOrEmpty())
            {
                MessageBox.Show("数据层命名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(null);
            }
            if (business.IsNullOrEmpty())
            {
                MessageBox.Show("业务层命名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(null);
            }

            Model.ConfigNameSpaceClass cnsc = new Model.ConfigNameSpaceClass();
            cnsc.Model     = model.Trim();
            cnsc.Data      = data.Trim();
            cnsc.Business  = business.Trim();
            cnsc.Interface = interface1.Trim();
            cnsc.Factory   = factory.Trim();
            return(cnsc);
        }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     Model.ConfigNameSpaceClass cnsc = GetModel();
     if (cnsc != null)
     {
         if (CNSC.Add(cnsc))
         {
             MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             ShowList();
         }
         else
         {
             MessageBox.Show("添加失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Exemple #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            var items = listView1.SelectedItems;

            if (items.Count == 0)
            {
                return;
            }
            var item = items[0];

            Model.ConfigNameSpaceClass cnsc = GetModel();
            if (cnsc != null)
            {
                if (CNSC.Save(cnsc, item.SubItems[0].Text))
                {
                    MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ShowList();
                }
                else
                {
                    MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
        private Model.ConfigNameSpaceClass GetModel()
        {
            string model = this.textBox_model.Text;
            string data = this.textBox_data.Text;
            string business = this.textBox_business.Text;
            string interface1 = this.textBox_interface.Text;
            string factory = this.textBox_factory.Text;

            if (model.IsNullOrEmpty())
            {
                MessageBox.Show("实体层命名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return null;
            }
            if (data.IsNullOrEmpty())
            {
                MessageBox.Show("数据层命名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return null;
            }
            if (business.IsNullOrEmpty())
            {
                MessageBox.Show("业务层命名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return null;
            }

            Model.ConfigNameSpaceClass cnsc = new Model.ConfigNameSpaceClass();
            cnsc.Model = model.Trim();
            cnsc.Data = data.Trim();
            cnsc.Business = business.Trim();
            cnsc.Interface = interface1.Trim();
            cnsc.Factory = factory.Trim();
            return cnsc;
        }