Exemplo n.º 1
0
 private void Add_btn_Click(object sender, EventArgs e)
 {
     if (this.usertype.Enabled==false)
     {
         userType = new Renting_Management_System.DAL.UserTypeDAL();
         userTypeMod = new Renting_Management_System.Models.UserTypeMod();
         userTypeMod.UserTypeCode = txtID.Text.Trim();
         userTypeMod.UserTypeName = txtName.Text.Trim();
         userType.AddData(userTypeMod);
         ds.Clear();
         ds = userType.GetAll();
         s1 = new BindingSource();
         s1.DataSource = ds;
         s1.DataMember = ds.Tables[0].TableName;
         bindingNavigator1.BindingSource = s1;
         dataGridView1.DataSource = s1;
         sq1.Refresh(ds);
         MessageBox.Show("添加成功");
     }
     else if (this.Certificatetype.Enabled==false)
     {
         certificateType = new Renting_Management_System.DAL.CertificateTypeDAL();
         certificateTypeMod = new Renting_Management_System.Models.CertificateTypeMod();
         certificateTypeMod.CertificateTypeCode = txtID.Text.Trim();
         certificateTypeMod.CertificateTypeName = txtName.Text.Trim();
         certificateType.AddData(certificateTypeMod);
         ds.Clear();
         ds = certificateType.GetAll();
         s1 = new BindingSource();
         s1.DataSource = ds;
         s1.DataMember = ds.Tables[0].TableName;
         bindingNavigator1.BindingSource = s1;
         dataGridView1.DataSource = s1;
         sq1.Refresh(ds);
         MessageBox.Show("添加成功");
     }
     else if(this.customertype.Enabled==false)
     {
         customerType=new Renting_Management_System.DAL.CustomerTypeDAL();
         customerTypeMod=new Renting_Management_System.Models.CustomerTypeMod();
         customerTypeMod.CustomerTypeCode=txtID.Text.Trim();
         customerTypeMod.CustomerTypeName=txtName.Text.Trim();
         customerType.AddData(customerTypeMod);
         ds.Clear();
         ds=customerType.GetAll();
         s1 = new BindingSource();
         s1.DataSource = ds;
         s1.DataMember = ds.Tables[0].TableName;
         bindingNavigator1.BindingSource = s1;
         dataGridView1.DataSource = s1;
         sq1.Refresh(ds);
         MessageBox.Show("添加成功");
     }
     else if (this.Imagetype.Enabled == false)
     {
         imageType = new Renting_Management_System.DAL.ImageTypeDAL();
         imageTypeMod = new Renting_Management_System.Models.ImageTypeMod();
         imageTypeMod.ImageTypeCode = txtID.Text.Trim();
         imageTypeMod.ImageTypeName = txtName.Text.Trim();
         imageType.AddData(imageTypeMod);
         ds.Clear();
         ds = imageType.GetAll();
         s1 = new BindingSource();
         s1.DataSource = ds;
         s1.DataMember = ds.Tables[0].TableName;
         bindingNavigator1.BindingSource = s1;
         dataGridView1.DataSource = s1;
         sq1.Refresh(ds);
         MessageBox.Show("添加成功");
     }
     else
     {
         MessageBox.Show("请选择相应的表再进行添加");
     }
 }
Exemplo n.º 2
0
        private void Imagetype_Click(object sender, EventArgs e)
        {
            imageType = new Renting_Management_System.DAL.ImageTypeDAL();
            ds.Clear();
            ds = imageType.GetAll();
            s1 = new BindingSource();
            s1.DataSource = ds;
            s1.DataMember = ds.Tables[0].TableName;
            dataGridView1.DataSource = s1;
            this.usertype.Enabled = true;
            this.customertype.Enabled = true;
            this.Imagetype.Enabled = false;

            this.Certificatetype.Enabled = true;
        }