Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            int         roleProductId = Convert.ToInt32(this.cbRoleProductId.SelectedValue);
            int         productId     = Convert.ToInt32(this.tbProductId.Text);
            RoleProduct roleProduct   = new RoleProduct();

            roleProduct.RPId        = roleProductId;
            roleProduct.RPProductId = productId;
            if (RoleProductAccess.AddRoleProduct(roleProduct))
            {
                MessageBox.Show("角色产品添加成功!");
            }
            else
            {
                MessageBox.Show("角色产品添加失败!");
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 界面显示初始化
 /// </summary>
 private void InitializeDataSet()
 {
     this.dataGridView1.AutoGenerateColumns = true;
     this.dataGridView2.AutoGenerateColumns = true;
     this.dataGridView3.AutoGenerateColumns = true;
     this.dataGridView4.AutoGenerateColumns = true;
     this.dataGridView5.AutoGenerateColumns = true;
     this.dataGridView6.AutoGenerateColumns = true;
     this.dataGridView7.AutoGenerateColumns = true;
     SPds = SupplierAccess.Select();
     DTds = DistributorAccess.Select();
     ACds = AdminAccess.ShowSupperUser();
     RLds = RoleAccess.ShowRole();
     ASds = ApplySceneryAccess.selectForApply();
     RPds = RoleProductAccess.ShowRoleProduct();
     SYds = SceneryAccess.ShowSceneryForSupper();
     if (SPds != null)
     {
         dataGridView1.DataSource = SPds.Tables[0];
     }
     if (DTds != null)
     {
         dataGridView2.DataSource = DTds.Tables[0];
     }
     if (RLds != null)
     {
         dataGridView3.DataSource = RLds.Tables[0];
     }
     if (ACds != null)
     {
         dataGridView4.DataSource = ACds.Tables[0];
     }
     if (RPds != null)
     {
         dataGridView5.DataSource = RPds.Tables[0];
     }
     if (ASds != null)
     {
         dataGridView6.DataSource = ASds.Tables[0];
     }
     if (SYds != null)
     {
         dataGridView7.DataSource = SYds.Tables[0];
     }
 }
Ejemplo n.º 3
0
 private void lbRoleProductdelete_Click(object sender, EventArgs e)
 {
     if (indexer != -1)
     {
         DialogResult dr = MessageBox.Show("确定删除?", "确定", MessageBoxButtons.YesNo);
         if (dr == DialogResult.Yes)
         {
             dataGridView5.DataSource = RPds.Tables[0];
             bool isSuccess = RoleProductAccess.DeleteRoleProduct(RPId);
             if (isSuccess)
             {
                 MessageBox.Show("角色产品删除成功");
             }
             DataSet ds = RoleProductAccess.ShowRoleProduct();
             dataGridView5.DataSource = ds.Tables[0];
             if (ds != null)
             {
                 this.Refresh();
             }
         }
     }
 }