コード例 #1
0
 public void Display()
 {
     using (SqlConnection connection = new SqlConnection(con))
     {
         SqlCommand cmd = new SqlCommand("DisplayRole", connection);
         cmd.CommandType = CommandType.StoredProcedure;
         connection.Open();
         RoleGridView.DataSource = cmd.ExecuteReader();
         RoleGridView.DataBind();
     }
 }
コード例 #2
0
ファイル: List.aspx.cs プロジェクト: apkalexei/HRMS
        protected void RoleGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DeleteRole")
            {
                int        roleId = Convert.ToInt32(e.CommandArgument);
                RoleEntity entity = new RoleEntity()
                {
                    Id = roleId, ApplicationId = Convert.ToInt32(ConfigurationManager.AppSettings["ApplicationId"])
                };
                new FormMapper().DeleteFormsFromRole(entity);
                new UserMapper().DeleteUsersFromRole(entity);
                new RoleMapper().Delete(entity);

                RoleGridView.DataBind();
            }
        }